@hubspot/cli 7.8.0-experimental.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -27
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/getStarted.test.js +2 -2
- package/commands/__tests__/mcp.test.js +1 -1
- package/commands/__tests__/project.test.js +2 -3
- package/commands/account/auth.js +1 -0
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -6
- package/commands/app/migrate.js +13 -19
- package/commands/app/secret/add.js +2 -1
- package/commands/app/secret/delete.js +2 -1
- package/commands/app/secret/list.js +2 -1
- package/commands/app/secret/update.js +2 -1
- package/commands/app/secret.js +2 -1
- package/commands/app.js +2 -2
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +17 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -37
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +8 -13
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.d.ts +1 -3
- package/commands/getStarted.js +68 -20
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mcp/__tests__/setup.test.js +2 -2
- package/commands/mcp/setup.js +11 -2
- package/commands/mcp.js +3 -3
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +15 -13
- package/commands/project/__tests__/create.test.js +6 -6
- package/commands/project/__tests__/deploy.test.js +3 -7
- package/commands/project/__tests__/devUnifiedFlow.test.js +2 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/logs.test.js +1 -4
- package/commands/project/__tests__/migrate.test.js +7 -7
- package/commands/project/__tests__/migrateApp.test.js +3 -7
- package/commands/project/__tests__/profile.test.js +1 -1
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +7 -10
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +4 -11
- package/commands/project/deploy.js +5 -5
- package/commands/project/dev/deprecatedFlow.js +9 -18
- package/commands/project/dev/index.js +21 -18
- package/commands/project/dev/unifiedFlow.js +15 -8
- package/commands/project/download.js +15 -16
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +9 -9
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.js +12 -21
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +33 -12
- package/commands/project/migrateApp.js +10 -17
- package/commands/project/open.js +6 -14
- package/commands/project/profile/add.js +3 -3
- package/commands/project/profile/delete.js +1 -2
- package/commands/project/profile.js +2 -3
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +7 -7
- package/commands/project/watch.js +13 -22
- package/commands/project.js +4 -3
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +39 -64
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/testAccount/importData.d.ts +1 -1
- package/commands/testAccount/importData.js +1 -1
- package/commands/testAccount.js +1 -1
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +365 -111
- package/lang/en.js +409 -158
- package/lang/en.lyaml +4 -4
- package/lib/__tests__/buildAccount.test.js +4 -3
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/hasFeature.test.js +145 -7
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +19 -56
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.d.ts +2 -8
- package/lib/app/migrate.js +6 -81
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +32 -64
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configMigrate.js +88 -9
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +22 -1
- package/lib/constants.js +26 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +9 -36
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/hasFeature.js +6 -0
- package/lib/lang.js +6 -5
- package/lib/links.d.ts +1 -0
- package/lib/links.js +14 -7
- package/lib/mcp/setup.js +1 -1
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +74 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/fireAlarmMiddleware.js +15 -5
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projects/__tests__/AppDevModeInterface.test.js +87 -90
- package/lib/projects/__tests__/LocalDevProcess.test.js +231 -19
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +89 -63
- package/lib/projects/__tests__/deploy.test.js +73 -8
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +6 -2
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +39 -39
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +82 -7
- package/lib/projects/create/index.js +4 -4
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +16 -13
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +10 -1
- package/lib/projects/localDev/AppDevModeInterface.js +118 -89
- package/lib/projects/localDev/DevServerManager.d.ts +11 -29
- package/lib/projects/localDev/DevServerManager.js +19 -61
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/LocalDevLogger.d.ts +4 -0
- package/lib/projects/localDev/LocalDevLogger.js +27 -6
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
- package/lib/projects/localDev/LocalDevProcess.d.ts +7 -5
- package/lib/projects/localDev/LocalDevProcess.js +93 -21
- package/lib/projects/localDev/LocalDevState.d.ts +12 -8
- package/lib/projects/localDev/LocalDevState.js +27 -17
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +6 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +94 -33
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/project.d.ts +3 -2
- package/lib/projects/localDev/helpers/project.js +49 -10
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +7 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +19 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/pollProjectBuildAndDeploy.js +4 -4
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +17 -8
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +9 -2
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +30 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectProjectTemplatePrompt.js +2 -0
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.d.ts +1 -0
- package/lib/theme/__tests__/migrate.test.js +233 -0
- package/lib/theme/migrate.d.ts +13 -0
- package/lib/theme/migrate.js +90 -0
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +112 -8
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +72 -0
- package/lib/ui/uiMessages.js +75 -0
- package/lib/usageTracking.js +8 -8
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateFunctionTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/cms/HsCreateModuleTool.js +1 -1
- package/mcp-server/tools/cms/HsCreateTemplateTool.js +1 -1
- package/mcp-server/tools/cms/HsFunctionLogsTool.js +2 -2
- package/mcp-server/tools/cms/HsListFunctionsTool.js +1 -1
- package/mcp-server/tools/cms/HsListTool.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateModuleTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsCreateTemplateTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsFunctionLogsTool.test.js +2 -2
- package/mcp-server/tools/cms/__tests__/HsListFunctionsTool.test.js +1 -1
- package/mcp-server/tools/cms/__tests__/HsListTool.test.js +1 -1
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/AddFeatureToProjectTool.js +3 -3
- package/mcp-server/tools/project/CreateProjectTool.d.ts +3 -3
- package/mcp-server/tools/project/CreateProjectTool.js +5 -5
- package/mcp-server/tools/project/DeployProjectTool.js +1 -1
- package/mcp-server/tools/project/DocFetchTool.js +2 -2
- package/mcp-server/tools/project/DocsSearchTool.d.ts +4 -1
- package/mcp-server/tools/project/DocsSearchTool.js +7 -7
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.d.ts +4 -1
- package/mcp-server/tools/project/GetConfigValuesTool.js +13 -7
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +1 -1
- package/mcp-server/tools/project/UploadProjectTools.js +2 -2
- package/mcp-server/tools/project/ValidateProjectTool.js +1 -1
- package/mcp-server/tools/project/__tests__/AddFeatureToProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DeployProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +2 -2
- package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +14 -12
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +9 -8
- package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +1 -1
- package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/constants.d.ts +1 -1
- package/mcp-server/tools/project/constants.js +9 -3
- package/mcp-server/utils/__tests__/cliConfig.test.d.ts +1 -0
- package/mcp-server/utils/__tests__/cliConfig.test.js +110 -0
- package/mcp-server/utils/cliConfig.d.ts +1 -0
- package/mcp-server/utils/cliConfig.js +12 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +8 -12
- package/types/LocalDev.d.ts +19 -3
- package/ui/components/HorizontalSelectPrompt.js +1 -1
- package/ui/index.js +1 -1
- package/commands/getStartedV2.d.ts +0 -9
- package/commands/getStartedV2.js +0 -39
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- package/ui/components/Ascii.d.ts +0 -10
- package/ui/components/Ascii.js +0 -11
- package/ui/views/GetStarted.d.ts +0 -7
- package/ui/views/GetStarted.js +0 -157
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
- /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
- /package/lib/{projects/create/__tests__/v3.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lib/middleware/utils.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function isTargetedCommand(commandParts, targetCommandMap) {
|
|
2
|
-
const currentCommand = commandParts[0];
|
|
3
|
-
if (!targetCommandMap[currentCommand]) {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
if (targetCommandMap[currentCommand].target) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
const subCommands = targetCommandMap[currentCommand].subCommands || {};
|
|
10
|
-
if (commandParts.length > 1) {
|
|
11
|
-
return isTargetedCommand(commandParts.slice(1), subCommands);
|
|
12
|
-
}
|
|
13
|
-
return false;
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import LocalDevState from './LocalDevState.js';
|
|
2
|
-
import LocalDevLogger from './LocalDevLogger.js';
|
|
3
|
-
type DevServerManagerV2ConstructorOptions = {
|
|
4
|
-
localDevState: LocalDevState;
|
|
5
|
-
logger: LocalDevLogger;
|
|
6
|
-
};
|
|
7
|
-
declare class DevServerManagerV2 {
|
|
8
|
-
private initialized;
|
|
9
|
-
private started;
|
|
10
|
-
private devServers;
|
|
11
|
-
private localDevState;
|
|
12
|
-
constructor(options: DevServerManagerV2ConstructorOptions);
|
|
13
|
-
private iterateDevServers;
|
|
14
|
-
setup(): Promise<void>;
|
|
15
|
-
start(): Promise<void>;
|
|
16
|
-
fileChange({ filePath, event, }: {
|
|
17
|
-
filePath: string;
|
|
18
|
-
event: string;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
cleanup(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
export default DevServerManagerV2;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
|
-
import { startPortManagerServer, stopPortManagerServer, } from '@hubspot/local-dev-lib/portManager';
|
|
3
|
-
import { getHubSpotApiOrigin, getHubSpotWebsiteOrigin, } from '@hubspot/local-dev-lib/urls';
|
|
4
|
-
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
5
|
-
import AppDevModeInterface from './AppDevModeInterface.js';
|
|
6
|
-
import { lib } from '../../../lang/en.js';
|
|
7
|
-
class DevServerManagerV2 {
|
|
8
|
-
initialized;
|
|
9
|
-
started;
|
|
10
|
-
devServers;
|
|
11
|
-
localDevState;
|
|
12
|
-
constructor(options) {
|
|
13
|
-
this.initialized = false;
|
|
14
|
-
this.started = false;
|
|
15
|
-
this.localDevState = options.localDevState;
|
|
16
|
-
const AppsDevServer = new AppDevModeInterface({
|
|
17
|
-
localDevState: options.localDevState,
|
|
18
|
-
localDevLogger: options.logger,
|
|
19
|
-
});
|
|
20
|
-
this.devServers = [AppsDevServer];
|
|
21
|
-
}
|
|
22
|
-
async iterateDevServers(callback) {
|
|
23
|
-
await Promise.all(this.devServers.map(devServer => callback(devServer)));
|
|
24
|
-
}
|
|
25
|
-
async setup() {
|
|
26
|
-
let env;
|
|
27
|
-
const accountConfig = getAccountConfig(this.localDevState.targetTestingAccountId);
|
|
28
|
-
if (accountConfig) {
|
|
29
|
-
env = accountConfig.env;
|
|
30
|
-
}
|
|
31
|
-
await startPortManagerServer();
|
|
32
|
-
await this.iterateDevServers(async (serverInterface) => {
|
|
33
|
-
if (serverInterface.setup) {
|
|
34
|
-
// @TODO: In the future, update UIE Dev Server to use LocalDevState
|
|
35
|
-
await serverInterface.setup({
|
|
36
|
-
components: this.localDevState.projectNodes,
|
|
37
|
-
profileData: this.localDevState.projectProfileData,
|
|
38
|
-
logger,
|
|
39
|
-
urls: {
|
|
40
|
-
api: getHubSpotApiOrigin(env),
|
|
41
|
-
web: getHubSpotWebsiteOrigin(env),
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
this.initialized = true;
|
|
47
|
-
}
|
|
48
|
-
async start() {
|
|
49
|
-
if (this.initialized) {
|
|
50
|
-
await this.iterateDevServers(async (serverInterface) => {
|
|
51
|
-
if (serverInterface.start) {
|
|
52
|
-
await serverInterface.start();
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new Error(lib.DevServerManager.notInitialized);
|
|
58
|
-
}
|
|
59
|
-
this.started = true;
|
|
60
|
-
}
|
|
61
|
-
async fileChange({ filePath, event, }) {
|
|
62
|
-
if (this.started) {
|
|
63
|
-
this.iterateDevServers(async (serverInterface) => {
|
|
64
|
-
if (serverInterface.fileChange) {
|
|
65
|
-
await serverInterface.fileChange(filePath, event);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async cleanup() {
|
|
71
|
-
if (this.started) {
|
|
72
|
-
await this.iterateDevServers(async (serverInterface) => {
|
|
73
|
-
if (serverInterface.cleanup) {
|
|
74
|
-
await serverInterface.cleanup();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
await stopPortManagerServer();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export default DevServerManagerV2;
|
package/ui/components/Ascii.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import figlet from 'figlet';
|
|
3
|
-
type AsciiProps = {
|
|
4
|
-
font?: figlet.Fonts;
|
|
5
|
-
horizontalLayout?: figlet.KerningMethods;
|
|
6
|
-
verticalLayout?: figlet.KerningMethods;
|
|
7
|
-
text?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function Ascii({ font, horizontalLayout, verticalLayout, text, }: AsciiProps): React.ReactNode;
|
|
10
|
-
export default Ascii;
|
package/ui/components/Ascii.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import figlet from 'figlet';
|
|
3
|
-
import { Box, Text } from 'ink';
|
|
4
|
-
export function Ascii({ font = 'Slant Relief', horizontalLayout = 'default', verticalLayout = 'default', text = '', }) {
|
|
5
|
-
return (_jsx(Box, { alignSelf: "center", children: _jsx(Text, { color: "#FF7A59", children: figlet.textSync(text, {
|
|
6
|
-
font,
|
|
7
|
-
horizontalLayout,
|
|
8
|
-
verticalLayout,
|
|
9
|
-
}) }) }));
|
|
10
|
-
}
|
|
11
|
-
export default Ascii;
|
package/ui/views/GetStarted.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { GetStartedArgs } from '../../commands/getStarted.js';
|
|
3
|
-
export type GetStartedProps = {
|
|
4
|
-
args: ArgumentsCamelCase<GetStartedArgs>;
|
|
5
|
-
};
|
|
6
|
-
export declare function getGetStarted(props: GetStartedProps): React.ReactNode;
|
|
7
|
-
export declare function GetStarted({ args }: GetStartedProps): React.ReactNode;
|
package/ui/views/GetStarted.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
|
-
import { useTerminalSize } from '../lib/useTerminalSize.js';
|
|
5
|
-
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
6
|
-
import { Box, Text } from 'ink';
|
|
7
|
-
import figures from 'figures';
|
|
8
|
-
import { AlertBox, InfoBox, } from '../components/StatusMessageBoxes.js';
|
|
9
|
-
import { commands } from '../../lang/en.js';
|
|
10
|
-
import Ascii from '../components/Ascii.js';
|
|
11
|
-
import { HorizontalSelectPrompt } from '../components/HorizontalSelectPrompt.js';
|
|
12
|
-
import { INK_COLORS } from '../styles.js';
|
|
13
|
-
import { TextInput, Spinner, ConfirmInput, ThemeProvider, extendTheme, defaultTheme, Badge, } from '@inkjs/ui';
|
|
14
|
-
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
15
|
-
import path from 'path';
|
|
16
|
-
import { cloneGithubRepo } from '@hubspot/local-dev-lib/github';
|
|
17
|
-
import { HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, PROJECT_CONFIG_FILE, } from '../../lib/constants.js';
|
|
18
|
-
import { getProjectConfig, validateProjectConfig, writeProjectConfig, } from '../../lib/projects/config.js';
|
|
19
|
-
import { getProjectPackageJsonLocations, installPackages, } from '../../lib/dependencyManagement.js';
|
|
20
|
-
import { handleProjectUpload } from '../../lib/projects/upload.js';
|
|
21
|
-
import { useV3Api } from '../../lib/projects/platformVersion.js';
|
|
22
|
-
import { pollProjectBuildAndDeploy } from '../../lib/projects/pollProjectBuildAndDeploy.js';
|
|
23
|
-
import { getProjectBuildDetailUrl, getProjectDeployDetailUrl, } from '../../lib/projects/urls.js';
|
|
24
|
-
import { BoxWithTitle } from '../components/BoxWithTitle.js';
|
|
25
|
-
export function getGetStarted(props) {
|
|
26
|
-
return _jsx(GetStarted, { ...props });
|
|
27
|
-
}
|
|
28
|
-
const customTheme = extendTheme(defaultTheme, {
|
|
29
|
-
components: {
|
|
30
|
-
Spinner: {
|
|
31
|
-
styles: {
|
|
32
|
-
frame: () => ({
|
|
33
|
-
color: '#FF7A59',
|
|
34
|
-
}),
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
export function GetStarted({ args }) {
|
|
40
|
-
const { derivedAccountId } = args;
|
|
41
|
-
const toolTips = [
|
|
42
|
-
'Run hs doctor to diagnose common cli installation problems',
|
|
43
|
-
'Use hs project add to quickly add new features to your project',
|
|
44
|
-
'Unified apps are coming to the cli soon',
|
|
45
|
-
'Use hs test-account create to create and seed test accounts',
|
|
46
|
-
];
|
|
47
|
-
const accountName = uiAccountDescription(derivedAccountId);
|
|
48
|
-
const { columns, rows } = useTerminalSize();
|
|
49
|
-
const templateSource = 'robrown-hubspot/hubspot-project-components-ua-app-objects-beta';
|
|
50
|
-
const projectTemplate = {
|
|
51
|
-
name: 'private-app-get-started-template',
|
|
52
|
-
label: 'CRM getting started project with private apps',
|
|
53
|
-
path: 'projects/private-app-get-started-template',
|
|
54
|
-
};
|
|
55
|
-
const repo = templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
56
|
-
const cloneRepo = async () => {
|
|
57
|
-
await cloneGithubRepo(repo, projectSource, {
|
|
58
|
-
sourceDir: projectTemplate.path,
|
|
59
|
-
tag: undefined,
|
|
60
|
-
hideLogs: true,
|
|
61
|
-
});
|
|
62
|
-
setIsCloned(true);
|
|
63
|
-
};
|
|
64
|
-
const [projectType, setProjectType] = useState('');
|
|
65
|
-
const [showProjectTypeError, setShowProjectTypeError] = useState(false);
|
|
66
|
-
const [projectName, setProjectName] = useState('');
|
|
67
|
-
const [projectSource, setProjectSource] = useState('');
|
|
68
|
-
const [isCloned, setIsCloned] = useState(false);
|
|
69
|
-
const [isConfigUpdated, setIsConfigUpdated] = useState(false);
|
|
70
|
-
const [areDepsInstalled, setAreDepsInstalled] = useState(false);
|
|
71
|
-
const [isUploading, setIsUploading] = useState(null);
|
|
72
|
-
const [isUploaded, setIsUploaded] = useState(false);
|
|
73
|
-
const [projectPollResult, setProjectPollResult] = useState(null);
|
|
74
|
-
useEffect(() => {
|
|
75
|
-
if (projectType === 'CMS') {
|
|
76
|
-
setShowProjectTypeError(true);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
setShowProjectTypeError(false);
|
|
80
|
-
}
|
|
81
|
-
}, [projectType]);
|
|
82
|
-
const updateProjectConfig = () => {
|
|
83
|
-
const projectConfigPath = path.join(projectSource, PROJECT_CONFIG_FILE);
|
|
84
|
-
const parsedConfigFile = JSON.parse(fs.readFileSync(projectConfigPath).toString());
|
|
85
|
-
writeProjectConfig(projectConfigPath, {
|
|
86
|
-
...parsedConfigFile,
|
|
87
|
-
name: projectName,
|
|
88
|
-
});
|
|
89
|
-
setIsConfigUpdated(true);
|
|
90
|
-
};
|
|
91
|
-
const installDeps = async () => {
|
|
92
|
-
const installLocations = await getProjectPackageJsonLocations(projectSource);
|
|
93
|
-
await installPackages({
|
|
94
|
-
installLocations: installLocations,
|
|
95
|
-
});
|
|
96
|
-
setAreDepsInstalled(true);
|
|
97
|
-
};
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
if (projectSource && !isCloned) {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
cloneRepo();
|
|
102
|
-
}, 500);
|
|
103
|
-
}
|
|
104
|
-
if (projectSource && isCloned) {
|
|
105
|
-
setTimeout(() => {
|
|
106
|
-
updateProjectConfig();
|
|
107
|
-
}, 500);
|
|
108
|
-
}
|
|
109
|
-
}, [projectSource, isCloned]);
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (isConfigUpdated && !areDepsInstalled) {
|
|
112
|
-
setTimeout(() => {
|
|
113
|
-
installDeps();
|
|
114
|
-
}, 500);
|
|
115
|
-
}
|
|
116
|
-
}, [isConfigUpdated]);
|
|
117
|
-
const uploadProject = async () => {
|
|
118
|
-
const { projectConfig: newProjectConfig, projectDir: newProjectDir } = await getProjectConfig(projectSource);
|
|
119
|
-
validateProjectConfig(newProjectConfig, newProjectDir);
|
|
120
|
-
const { result, uploadError } = await handleProjectUpload({
|
|
121
|
-
accountId: derivedAccountId,
|
|
122
|
-
projectConfig: newProjectConfig,
|
|
123
|
-
projectDir: newProjectDir,
|
|
124
|
-
callbackFunc: pollProjectBuildAndDeploy,
|
|
125
|
-
uploadMessage: 'Initial upload from get-started command',
|
|
126
|
-
forceCreate: true, // Auto-create project on HubSpot
|
|
127
|
-
isUploadCommand: false,
|
|
128
|
-
sendIR: useV3Api(newProjectConfig.platformVersion),
|
|
129
|
-
skipValidation: false,
|
|
130
|
-
});
|
|
131
|
-
if (result) {
|
|
132
|
-
setIsUploaded(true);
|
|
133
|
-
setProjectPollResult(result);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const [toolTipIndex, setToolTipIndex] = useState(0);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const interval = setInterval(() => {
|
|
139
|
-
setToolTipIndex(prevIndex => (prevIndex + 1) % toolTips.length);
|
|
140
|
-
}, 5000);
|
|
141
|
-
return () => clearInterval(interval);
|
|
142
|
-
}, []);
|
|
143
|
-
useEffect(() => {
|
|
144
|
-
if (isUploading === true) {
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
uploadProject();
|
|
147
|
-
}, 500);
|
|
148
|
-
}
|
|
149
|
-
}, [isUploading]);
|
|
150
|
-
return (_jsx(ThemeProvider, { theme: customTheme, children: _jsxs(Box, { flexDirection: "column", width: columns, height: rows, children: [_jsx(Ascii, { text: "HubSpot CLI", font: "Standard" }), _jsx(InfoBox, { title: commands.getStarted.startTitle, message: commands.getStarted.startDescription +
|
|
151
|
-
'\n' +
|
|
152
|
-
commands.getStarted.guideOverview(accountName) }), projectType !== 'App' && (_jsxs(Box, { flexDirection: "column", gap: 0, children: [_jsx(HorizontalSelectPrompt, { prompt: commands.getStarted.prompts.selectOption, options: ['App', 'CMS'], onSelect: setProjectType, defaultOption: 'App' }), showProjectTypeError && (_jsx(AlertBox, { title: "Bad Choice", message: "I didn't hook up the CMS flow for this demo" }))] })), projectType === 'App' && (_jsx(_Fragment, { children: _jsxs(Box, { flexDirection: "column", padding: 1, gap: 1, borderStyle: "round", borderColor: "#FF7A59", children: [_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsxs(Box, { flexDirection: "row", flexBasis: "50%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "Project Name:" }), projectName === '' ? (_jsx(TextInput, { placeholder: "give your project a name", onSubmit: setProjectName })) : (_jsx(Text, { children: projectName }))] }), _jsxs(Box, { flexDirection: "row", flexBasis: "50%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "Project Source:" }), projectSource === '' && projectName !== '' ? (_jsx(TextInput, { defaultValue: path.resolve(getCwd(), projectName), placeholder: path.resolve(getCwd(), projectName), onSubmit: setProjectSource })) : (_jsx(Text, { children: projectSource }))] })] }), projectSource && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isCloned ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project downloaded"] })) : (_jsx(Spinner, { type: "dots", label: "Downloading project" })) })), projectSource && isCloned && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isConfigUpdated ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project config updated"] })) : (_jsx(Spinner, { type: "dots", label: "Updating project config" })) })), isConfigUpdated && (_jsxs(Box, { flexDirection: "column", width: "100%", gap: 0, children: [_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsx(Badge, { color: INK_COLORS.SUCCESS_GREEN, children: "Success" }), _jsx(Text, { children: commands.project.create.logs.success(projectName, projectSource) })] }), _jsx(Text, { children: commands.getStarted.prompts.projectCreated.title }), _jsx(Text, { children: commands.getStarted.prompts.projectCreated.description })] })), isConfigUpdated && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: areDepsInstalled ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project dependencies installed"] })) : (_jsx(Spinner, { type: "dots", label: "Installing project dependencies" })) })), areDepsInstalled && isUploading === null && (_jsxs(Box, { flexDirection: "row", width: "100%", gap: 1, children: [_jsx(Text, { color: INK_COLORS.WARNING_YELLOW, children: "Would you like to upload your project to HubSpot?" }), isUploading === null ? (_jsx(ConfirmInput, { onConfirm: () => {
|
|
153
|
-
setIsUploading(true);
|
|
154
|
-
}, onCancel: () => {
|
|
155
|
-
setIsUploading(false);
|
|
156
|
-
} })) : (_jsx(Text, { color: INK_COLORS.SUCCESS_GREEN, children: isUploading }))] })), isUploading === true && (_jsx(Box, { flexDirection: "row", width: "100%", gap: 1, children: isUploaded ? (_jsxs(Text, { color: INK_COLORS.SUCCESS_GREEN, children: [figures.tick, " Project uploaded, built, and deployed"] })) : (_jsx(Spinner, { type: "dots", label: "Uploading, building, and deploying project" })) })), projectPollResult && (_jsxs(Box, { flexDirection: "column", width: "100%", gap: 1, children: [_jsxs(Box, { flexDirection: "row", alignSelf: "center", width: "100%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "View build in HubSpot:" }), _jsx(Text, { color: INK_COLORS.INFO_BLUE, children: getProjectBuildDetailUrl(projectName, projectPollResult.buildId, derivedAccountId) })] }), _jsxs(Box, { flexDirection: "row", alignSelf: "center", width: "100%", gap: 1, children: [_jsx(Text, { color: "#FF7A59", children: "View deploy in HubSpot:" }), _jsx(Text, { color: INK_COLORS.INFO_BLUE, children: getProjectDeployDetailUrl(projectName, projectPollResult.deployResult?.deployId || 0, derivedAccountId) })] })] }))] }) })), _jsx(BoxWithTitle, { title: "Tips", message: toolTips[toolTipIndex], borderColor: "gray" })] }) }));
|
|
157
|
-
}
|
/package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/list.test.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|