From bfd4948fb988307959a1984a7d0b9a257105a67c Mon Sep 17 00:00:00 2001 From: Hardikkumar Nai <80053762+hardiknai-techm@users.noreply.github.com> Date: Tue, 12 Oct 2021 20:08:34 +0530 Subject: [PATCH] absulte_path setting (#984) * absulte_path setting * resolve build time error --- .vscode/settings.json | 3 +- jest.config.js | 2 ++ src/Explorer/Panes/AddCollectionPanel.tsx | 28 +++++++++---------- .../CassandraAddCollectionPane.tsx | 18 ++++++------ .../DeleteCollectionConfirmationPane.tsx | 26 ++++++++--------- .../Panes/DeleteDatabaseConfirmationPanel.tsx | 24 ++++++++-------- .../Panes/SettingsPane/SettingsPane.tsx | 16 +++++------ .../Panes/StringInputPane/StringInputPane.tsx | 6 ++-- .../Panes/UploadFilePane/UploadFilePane.tsx | 6 ++-- .../Panes/UploadItemsPane/UploadItemsPane.tsx | 6 ++-- tsconfig.json | 22 ++++----------- webpack.config.js | 1 + 12 files changed, 76 insertions(+), 82 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ba70984cf..0716cae8f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,5 +22,6 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": true, "source.organizeImports": true - } + }, + "typescript.preferences.importModuleSpecifier": "non-relative" } diff --git a/jest.config.js b/jest.config.js index 7e8ceb81e..e08536252 100644 --- a/jest.config.js +++ b/jest.config.js @@ -129,6 +129,8 @@ module.exports = { // The test environment that will be used for testing // testEnvironment: "jest-environment-jsdom", + modulePaths: ["node_modules", "/src"], + // Options that will be passed to the testEnvironment // testEnvironmentOptions: {}, diff --git a/src/Explorer/Panes/AddCollectionPanel.tsx b/src/Explorer/Panes/AddCollectionPanel.tsx index 56a76fc97..028b3c426 100644 --- a/src/Explorer/Panes/AddCollectionPanel.tsx +++ b/src/Explorer/Panes/AddCollectionPanel.tsx @@ -13,21 +13,21 @@ import { Text, TooltipHost, } from "@fluentui/react"; +import * as Constants from "Common/Constants"; +import { createCollection } from "Common/dataAccess/createCollection"; +import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; +import { configContext, Platform } from "ConfigContext"; +import * as DataModels from "Contracts/DataModels"; +import { SubscriptionType } from "Contracts/SubscriptionType"; +import { useSidePanel } from "hooks/useSidePanel"; import React from "react"; -import * as Constants from "../../Common/Constants"; -import { createCollection } from "../../Common/dataAccess/createCollection"; -import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"; -import { configContext, Platform } from "../../ConfigContext"; -import * as DataModels from "../../Contracts/DataModels"; -import { SubscriptionType } from "../../Contracts/SubscriptionType"; -import { useSidePanel } from "../../hooks/useSidePanel"; -import { CollectionCreation } from "../../Shared/Constants"; -import { Action } from "../../Shared/Telemetry/TelemetryConstants"; -import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; -import { userContext } from "../../UserContext"; -import { getCollectionName } from "../../Utils/APITypeUtils"; -import { isCapabilityEnabled, isServerlessAccount } from "../../Utils/CapabilityUtils"; -import { getUpsellMessage } from "../../Utils/PricingUtils"; +import { CollectionCreation } from "Shared/Constants"; +import { Action } from "Shared/Telemetry/TelemetryConstants"; +import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor"; +import { userContext } from "UserContext"; +import { getCollectionName } from "Utils/APITypeUtils"; +import { isCapabilityEnabled, isServerlessAccount } from "Utils/CapabilityUtils"; +import { getUpsellMessage } from "Utils/PricingUtils"; import { CollapsibleSectionComponent } from "../Controls/CollapsiblePanel/CollapsibleSectionComponent"; import { ThroughputInput } from "../Controls/ThroughputInput/ThroughputInput"; import Explorer from "../Explorer"; diff --git a/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx b/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx index 69e84ee03..64ee3fb3f 100644 --- a/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx +++ b/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx @@ -1,14 +1,14 @@ import { Checkbox, Dropdown, IDropdownOption, Link, Stack, Text, TextField } from "@fluentui/react"; +import * as Constants from "Common/Constants"; +import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; +import { InfoTooltip } from "Common/Tooltip/InfoTooltip"; +import { useSidePanel } from "hooks/useSidePanel"; import React, { FunctionComponent, useState } from "react"; -import * as Constants from "../../../Common/Constants"; -import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils"; -import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip"; -import { useSidePanel } from "../../../hooks/useSidePanel"; -import * as SharedConstants from "../../../Shared/Constants"; -import { Action } from "../../../Shared/Telemetry/TelemetryConstants"; -import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; -import { userContext } from "../../../UserContext"; -import { isServerlessAccount } from "../../../Utils/CapabilityUtils"; +import * as SharedConstants from "Shared/Constants"; +import { Action } from "Shared/Telemetry/TelemetryConstants"; +import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor"; +import { userContext } from "UserContext"; +import { isServerlessAccount } from "Utils/CapabilityUtils"; import { ThroughputInput } from "../../Controls/ThroughputInput/ThroughputInput"; import Explorer from "../../Explorer"; import { CassandraAPIDataClient } from "../../Tables/TableDataClient"; diff --git a/src/Explorer/Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane.tsx b/src/Explorer/Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane.tsx index 858ba3bc4..81eeb6621 100644 --- a/src/Explorer/Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane.tsx +++ b/src/Explorer/Panes/DeleteCollectionConfirmationPane/DeleteCollectionConfirmationPane.tsx @@ -1,18 +1,18 @@ import { Text, TextField } from "@fluentui/react"; +import { Areas } from "Common/Constants"; +import { deleteCollection } from "Common/dataAccess/deleteCollection"; +import DeleteFeedback from "Common/DeleteFeedback"; +import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; +import { Collection } from "Contracts/ViewModels"; +import { useSidePanel } from "hooks/useSidePanel"; +import { useTabs } from "hooks/useTabs"; import React, { FunctionComponent, useState } from "react"; -import { Areas } from "../../../Common/Constants"; -import { deleteCollection } from "../../../Common/dataAccess/deleteCollection"; -import DeleteFeedback from "../../../Common/DeleteFeedback"; -import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils"; -import { Collection } from "../../../Contracts/ViewModels"; -import { useSidePanel } from "../../../hooks/useSidePanel"; -import { useTabs } from "../../../hooks/useTabs"; -import { DefaultExperienceUtility } from "../../../Shared/DefaultExperienceUtility"; -import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; -import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; -import { userContext } from "../../../UserContext"; -import { getCollectionName } from "../../../Utils/APITypeUtils"; -import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils"; +import { DefaultExperienceUtility } from "Shared/DefaultExperienceUtility"; +import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants"; +import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor"; +import { userContext } from "UserContext"; +import { getCollectionName } from "Utils/APITypeUtils"; +import * as NotificationConsoleUtils from "Utils/NotificationConsoleUtils"; import { useDatabases } from "../../useDatabases"; import { useSelectedNode } from "../../useSelectedNode"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; diff --git a/src/Explorer/Panes/DeleteDatabaseConfirmationPanel.tsx b/src/Explorer/Panes/DeleteDatabaseConfirmationPanel.tsx index 24fbb1cf5..88eb8d064 100644 --- a/src/Explorer/Panes/DeleteDatabaseConfirmationPanel.tsx +++ b/src/Explorer/Panes/DeleteDatabaseConfirmationPanel.tsx @@ -1,18 +1,18 @@ import { Text, TextField } from "@fluentui/react"; import { useBoolean } from "@fluentui/react-hooks"; +import { Areas } from "Common/Constants"; +import { deleteDatabase } from "Common/dataAccess/deleteDatabase"; +import DeleteFeedback from "Common/DeleteFeedback"; +import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; +import { Collection, Database } from "Contracts/ViewModels"; +import { useSidePanel } from "hooks/useSidePanel"; +import { useTabs } from "hooks/useTabs"; import React, { FunctionComponent, useState } from "react"; -import { Areas } from "../../Common/Constants"; -import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase"; -import DeleteFeedback from "../../Common/DeleteFeedback"; -import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils"; -import { Collection, Database } from "../../Contracts/ViewModels"; -import { useSidePanel } from "../../hooks/useSidePanel"; -import { useTabs } from "../../hooks/useTabs"; -import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility"; -import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; -import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; -import { userContext } from "../../UserContext"; -import { logConsoleError } from "../../Utils/NotificationConsoleUtils"; +import { DefaultExperienceUtility } from "Shared/DefaultExperienceUtility"; +import { Action, ActionModifiers } from "Shared/Telemetry/TelemetryConstants"; +import * as TelemetryProcessor from "Shared/Telemetry/TelemetryProcessor"; +import { userContext } from "UserContext"; +import { logConsoleError } from "Utils/NotificationConsoleUtils"; import { useDatabases } from "../useDatabases"; import { useSelectedNode } from "../useSelectedNode"; import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent"; diff --git a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx index db0746276..92d432f34 100644 --- a/src/Explorer/Panes/SettingsPane/SettingsPane.tsx +++ b/src/Explorer/Panes/SettingsPane/SettingsPane.tsx @@ -1,13 +1,13 @@ import { Checkbox, ChoiceGroup, IChoiceGroupOption, SpinButton } from "@fluentui/react"; +import * as Constants from "Common/Constants"; +import { InfoTooltip } from "Common/Tooltip/InfoTooltip"; +import { configContext } from "ConfigContext"; +import { useSidePanel } from "hooks/useSidePanel"; import React, { FunctionComponent, MouseEvent, useState } from "react"; -import * as Constants from "../../../Common/Constants"; -import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip"; -import { configContext } from "../../../ConfigContext"; -import { useSidePanel } from "../../../hooks/useSidePanel"; -import { LocalStorageUtility, StorageKey } from "../../../Shared/StorageUtility"; -import * as StringUtility from "../../../Shared/StringUtility"; -import { userContext } from "../../../UserContext"; -import { logConsoleInfo } from "../../../Utils/NotificationConsoleUtils"; +import { LocalStorageUtility, StorageKey } from "Shared/StorageUtility"; +import * as StringUtility from "Shared/StringUtility"; +import { userContext } from "UserContext"; +import { logConsoleInfo } from "Utils/NotificationConsoleUtils"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; export const SettingsPane: FunctionComponent = () => { diff --git a/src/Explorer/Panes/StringInputPane/StringInputPane.tsx b/src/Explorer/Panes/StringInputPane/StringInputPane.tsx index 8c8ce3b9e..eb9df4ad3 100644 --- a/src/Explorer/Panes/StringInputPane/StringInputPane.tsx +++ b/src/Explorer/Panes/StringInputPane/StringInputPane.tsx @@ -1,8 +1,8 @@ import { TextField } from "@fluentui/react"; +import * as ViewModels from "Contracts/ViewModels"; +import { useTabs } from "hooks/useTabs"; import React, { FormEvent, FunctionComponent, useState } from "react"; -import * as ViewModels from "../../../Contracts/ViewModels"; -import { useTabs } from "../../../hooks/useTabs"; -import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils"; +import { logConsoleError, logConsoleInfo, logConsoleProgress } from "Utils/NotificationConsoleUtils"; import * as FileSystemUtil from "../../Notebook/FileSystemUtil"; import { NotebookContentItem } from "../../Notebook/NotebookContentItem"; import NotebookV2Tab from "../../Tabs/NotebookV2Tab"; diff --git a/src/Explorer/Panes/UploadFilePane/UploadFilePane.tsx b/src/Explorer/Panes/UploadFilePane/UploadFilePane.tsx index 7a5296adb..d60ee4b27 100644 --- a/src/Explorer/Panes/UploadFilePane/UploadFilePane.tsx +++ b/src/Explorer/Panes/UploadFilePane/UploadFilePane.tsx @@ -1,7 +1,7 @@ +import { Upload } from "Common/Upload/Upload"; +import { useSidePanel } from "hooks/useSidePanel"; import React, { ChangeEvent, FunctionComponent, useState } from "react"; -import { Upload } from "../../../Common/Upload/Upload"; -import { useSidePanel } from "../../../hooks/useSidePanel"; -import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils"; +import { logConsoleError, logConsoleInfo, logConsoleProgress } from "Utils/NotificationConsoleUtils"; import { NotebookContentItem } from "../../Notebook/NotebookContentItem"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; diff --git a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx index 62c8f67cf..388b8d944 100644 --- a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx +++ b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx @@ -1,8 +1,8 @@ import { DetailsList, DetailsListLayoutMode, IColumn, SelectionMode } from "@fluentui/react"; +import { Upload } from "Common/Upload/Upload"; +import { UploadDetailsRecord } from "Contracts/ViewModels"; import React, { ChangeEvent, FunctionComponent, useState } from "react"; -import { Upload } from "../../../Common/Upload/Upload"; -import { UploadDetailsRecord } from "../../../Contracts/ViewModels"; -import { logConsoleError } from "../../../Utils/NotificationConsoleUtils"; +import { logConsoleError } from "Utils/NotificationConsoleUtils"; import { getErrorMessage } from "../../Tables/Utilities"; import { useSelectedNode } from "../../useSelectedNode"; import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm"; diff --git a/tsconfig.json b/tsconfig.json index 45097fb68..39dad0788 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,18 +15,13 @@ "target": "es2017", "experimentalDecorators": true, "emitDecoratorMetadata": true, - "lib": [ - "es5", - "es6", - "dom" - ], + "lib": ["es5", "es6", "dom"], "jsx": "react", "moduleResolution": "node", "resolveJsonModule": true, "noEmit": true, - "types": [ - "jest" - ] + "types": ["jest"], + "baseUrl": "src" }, "typedocOptions": { "entryPoints": [ @@ -42,11 +37,6 @@ "includes": "./src/SelfServe/Documentation", "disableSources": true }, - "include": [ - "./src/**/*", - "./utils/**/*" - ], - "exclude": [ - "./src/**/__mocks__/**/*" - ] -} \ No newline at end of file + "include": ["src", "./src/**/*", "./utils/**/*"], + "exclude": ["./src/**/__mocks__/**/*"] +} diff --git a/webpack.config.js b/webpack.config.js index e6bcbe1e0..de87af5a2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -227,6 +227,7 @@ module.exports = function (_env = {}, argv = {}) { rules, }, resolve: { + modules: [path.resolve(__dirname, "src"), "node_modules"], alias: { process: "process/browser", },