@hubspot/cli 7.5.11-experimental.0 → 7.6.0-beta.1
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 +102 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +74 -87
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -58
- package/commands/app/migrate.d.ts +1 -2
- package/commands/app/migrate.js +7 -8
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -8
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +29 -28
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -12
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +37 -46
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +18 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -74
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +18 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -41
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -10
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +17 -8
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +17 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +52 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +77 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -29
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +17 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +17 -11
- package/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/deploy.d.ts +2 -0
- package/commands/project/deploy.js +67 -13
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +9 -1
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +88 -31
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +81 -41
- package/commands/project/listBuilds.js +2 -5
- package/commands/project/migrate.d.ts +1 -0
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +1 -0
- package/commands/project/upload.js +22 -8
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -22
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -48
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +100 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -15
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -17
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +32 -26
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -47
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -134
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -75
- package/lang/en.d.ts +1135 -660
- package/lang/en.js +935 -471
- package/lang/en.lyaml +30 -213
- package/lib/accountTypes.js +1 -2
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +29 -6
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/commonOpts.d.ts +1 -3
- package/lib/commonOpts.js +1 -1
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +34 -55
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +29 -0
- package/lib/constants.js +30 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +3 -2
- package/lib/errorHandlers/index.js +7 -0
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -5
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +218 -0
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +5 -3
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +18 -3
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +60 -20
- package/lib/projects/urls.d.ts +3 -0
- package/lib/projects/urls.js +17 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +38 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -24
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +4 -1
- package/lib/prompts/promptUtils.js +5 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -0
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +19 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +104 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +24 -16
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +10 -1
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
package/lib/configMigrate.js
CHANGED
|
@@ -4,54 +4,44 @@ exports.handleMigration = handleMigration;
|
|
|
4
4
|
exports.handleMerge = handleMerge;
|
|
5
5
|
const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
|
|
6
6
|
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
7
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
7
|
const promptUtils_1 = require("./prompts/promptUtils");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
async function handleMigration(
|
|
8
|
+
const en_1 = require("../lang/en");
|
|
9
|
+
const logger_1 = require("./ui/logger");
|
|
10
|
+
async function handleMigration(deprecatedConfigPath, hideWarning) {
|
|
11
|
+
if (!hideWarning) {
|
|
12
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || (0, migrate_1.getConfigPath)(undefined, false)));
|
|
13
|
+
logger_1.uiLogger.log('');
|
|
14
|
+
}
|
|
15
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMigration.description(config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
16
|
+
logger_1.uiLogger.log('');
|
|
12
17
|
const { shouldMigrateConfig } = await (0, promptUtils_1.promptUser)({
|
|
13
18
|
name: 'shouldMigrateConfig',
|
|
14
19
|
type: 'confirm',
|
|
15
|
-
message:
|
|
16
|
-
deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
|
|
17
|
-
config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
18
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
19
|
-
}),
|
|
20
|
+
message: en_1.lib.configMigrate.handleMigration.confirmPrompt,
|
|
20
21
|
});
|
|
21
22
|
if (!shouldMigrateConfig) {
|
|
22
|
-
(0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
|
|
23
|
-
command: 'hs config migrate',
|
|
24
|
-
type: 'migration',
|
|
25
|
-
step: 'Reject migration via prompt',
|
|
26
|
-
}, accountId);
|
|
27
23
|
return false;
|
|
28
24
|
}
|
|
29
|
-
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(
|
|
25
|
+
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(deprecatedConfigPath);
|
|
30
26
|
(0, migrate_1.migrateConfig)(deprecatedConfig);
|
|
31
|
-
(
|
|
32
|
-
command: 'hs config migrate',
|
|
33
|
-
type: 'migration',
|
|
34
|
-
step: 'Confirm migration via prompt',
|
|
35
|
-
successful: true,
|
|
36
|
-
}, accountId);
|
|
37
|
-
logger_1.logger.success((0, lang_1.i18n)('lib.configMigrate.migrationSuccess', {
|
|
38
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
39
|
-
}));
|
|
27
|
+
logger_1.uiLogger.success(en_1.lib.configMigrate.handleMigration.success);
|
|
40
28
|
return true;
|
|
41
29
|
}
|
|
42
|
-
async function
|
|
30
|
+
async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force) {
|
|
43
31
|
const { initialConfig, conflicts, } = (0, migrate_1.mergeConfigProperties)(globalConfig, deprecatedConfig, force);
|
|
44
32
|
if (conflicts.length > 0) {
|
|
33
|
+
const properties = conflicts.map(c => c.property);
|
|
34
|
+
const propertyList = properties.length <= 2
|
|
35
|
+
? properties.join(' and ')
|
|
36
|
+
: `${properties.slice(0, -1).join(', ')}, and ${properties.at(-1)}`;
|
|
37
|
+
logger_1.uiLogger.log('');
|
|
38
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.handleMergeConfigProperties.mergeConflictMessage(conflicts.length, propertyList));
|
|
45
39
|
for (const conflict of conflicts) {
|
|
46
40
|
const { property, newValue, oldValue } = conflict;
|
|
47
41
|
const { shouldOverwrite } = await (0, promptUtils_1.promptUser)({
|
|
48
42
|
name: 'shouldOverwrite',
|
|
49
43
|
type: 'confirm',
|
|
50
|
-
message:
|
|
51
|
-
property,
|
|
52
|
-
oldValue: `${oldValue}`,
|
|
53
|
-
newValue: `${newValue}`,
|
|
54
|
-
}),
|
|
44
|
+
message: en_1.lib.configMigrate.handleMergeConfigProperties.mergeConfigConflictPrompt(property, newValue.toString(), oldValue.toString()),
|
|
55
45
|
});
|
|
56
46
|
if (shouldOverwrite) {
|
|
57
47
|
// @ts-expect-error Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
|
|
@@ -61,44 +51,33 @@ async function mergeConfigProperties(globalConfig, deprecatedConfig, force) {
|
|
|
61
51
|
}
|
|
62
52
|
return initialConfig;
|
|
63
53
|
}
|
|
64
|
-
async function handleMerge(
|
|
54
|
+
async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
55
|
+
if (!hideWarning) {
|
|
56
|
+
logger_1.uiLogger.warn(en_1.lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || (0, migrate_1.getConfigPath)(undefined, false)));
|
|
57
|
+
logger_1.uiLogger.log('');
|
|
58
|
+
}
|
|
59
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMerge.description(config_1.ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
60
|
+
logger_1.uiLogger.log('');
|
|
65
61
|
const { shouldMergeConfigs } = await (0, promptUtils_1.promptUser)({
|
|
66
62
|
name: 'shouldMergeConfigs',
|
|
67
63
|
type: 'confirm',
|
|
68
|
-
message:
|
|
69
|
-
deprecatedConfigPath: (0, migrate_1.getConfigPath)(configPath, false) ||
|
|
70
|
-
config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
71
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
72
|
-
}),
|
|
64
|
+
message: en_1.lib.configMigrate.handleMerge.confirmPrompt,
|
|
73
65
|
});
|
|
74
66
|
if (!shouldMergeConfigs) {
|
|
75
|
-
(0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
|
|
76
|
-
command: 'hs config migrate',
|
|
77
|
-
type: 'merge',
|
|
78
|
-
step: 'Reject merge via prompt',
|
|
79
|
-
}, accountId);
|
|
80
67
|
return false;
|
|
81
68
|
}
|
|
82
|
-
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(
|
|
69
|
+
const deprecatedConfig = (0, migrate_1.getDeprecatedConfig)(deprecatedConfigPath);
|
|
83
70
|
const globalConfig = (0, migrate_1.getGlobalConfig)();
|
|
84
71
|
if (!deprecatedConfig || !globalConfig) {
|
|
85
72
|
return true;
|
|
86
73
|
}
|
|
87
|
-
const mergedConfig = await
|
|
74
|
+
const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
|
|
88
75
|
const { skippedAccountIds } = (0, migrate_1.mergeExistingConfigs)(mergedConfig, deprecatedConfig);
|
|
89
76
|
if (skippedAccountIds.length > 0) {
|
|
90
|
-
logger_1.
|
|
91
|
-
|
|
92
|
-
|
|
77
|
+
logger_1.uiLogger.log('');
|
|
78
|
+
logger_1.uiLogger.log(en_1.lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
|
|
79
|
+
logger_1.uiLogger.log('');
|
|
93
80
|
}
|
|
94
|
-
logger_1.
|
|
95
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
96
|
-
}));
|
|
97
|
-
(0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
|
|
98
|
-
command: 'hs config migrate',
|
|
99
|
-
type: 'merge',
|
|
100
|
-
step: 'Confirm merge via prompt',
|
|
101
|
-
successful: true,
|
|
102
|
-
}, accountId);
|
|
81
|
+
logger_1.uiLogger.success(en_1.lib.configMigrate.handleMerge.success);
|
|
103
82
|
return true;
|
|
104
83
|
}
|
package/lib/configOptions.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare function setAllowUsageTracking({ accountId, allowUsageTracking, }
|
|
|
3
3
|
accountId: number;
|
|
4
4
|
allowUsageTracking?: boolean;
|
|
5
5
|
}): Promise<void>;
|
|
6
|
+
export declare function setAllowAutoUpdates({ accountId, allowAutoUpdates, }: {
|
|
7
|
+
accountId: number;
|
|
8
|
+
allowAutoUpdates?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
6
10
|
export declare function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }: {
|
|
7
11
|
accountId: number;
|
|
8
12
|
defaultCmsPublishMode?: CmsPublishMode;
|
package/lib/configOptions.js
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setAllowUsageTracking = setAllowUsageTracking;
|
|
4
|
+
exports.setAllowAutoUpdates = setAllowAutoUpdates;
|
|
4
5
|
exports.setDefaultCmsPublishMode = setDefaultCmsPublishMode;
|
|
5
6
|
exports.setHttpTimeout = setHttpTimeout;
|
|
6
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
7
7
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
8
8
|
const files_1 = require("@hubspot/local-dev-lib/constants/files");
|
|
9
9
|
const text_1 = require("@hubspot/local-dev-lib/text");
|
|
10
10
|
const usageTracking_1 = require("./usageTracking");
|
|
11
11
|
const promptUtils_1 = require("./prompts/promptUtils");
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
default: true,
|
|
31
|
-
},
|
|
32
|
-
]);
|
|
12
|
+
const en_1 = require("../lang/en");
|
|
13
|
+
const logger_1 = require("./ui/logger");
|
|
14
|
+
async function enableOrDisableBooleanFieldPrompt(fieldName) {
|
|
15
|
+
const isEnabled = await (0, promptUtils_1.listPrompt)(en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.message(fieldName), {
|
|
16
|
+
choices: [
|
|
17
|
+
{
|
|
18
|
+
name: en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.labels
|
|
19
|
+
.enabled,
|
|
20
|
+
value: true,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: en_1.lib.configOptions.enableOrDisableBooleanFieldPrompt.labels
|
|
24
|
+
.disabled,
|
|
25
|
+
value: false,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
defaultAnswer: true,
|
|
29
|
+
});
|
|
33
30
|
return isEnabled;
|
|
34
31
|
}
|
|
35
32
|
async function setAllowUsageTracking({ accountId, allowUsageTracking, }) {
|
|
@@ -39,25 +36,29 @@ async function setAllowUsageTracking({ accountId, allowUsageTracking, }) {
|
|
|
39
36
|
isEnabled = allowUsageTracking;
|
|
40
37
|
}
|
|
41
38
|
else {
|
|
42
|
-
isEnabled = await
|
|
39
|
+
isEnabled = await enableOrDisableBooleanFieldPrompt(en_1.lib.configOptions.setAllowUsageTracking.fieldName);
|
|
43
40
|
}
|
|
44
41
|
(0, config_1.updateAllowUsageTracking)(isEnabled);
|
|
45
|
-
logger_1.
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setAllowUsageTracking.success(isEnabled.toString()));
|
|
43
|
+
}
|
|
44
|
+
async function setAllowAutoUpdates({ accountId, allowAutoUpdates, }) {
|
|
45
|
+
(0, usageTracking_1.trackCommandUsage)('config-set-allow-auto-updates', undefined, accountId);
|
|
46
|
+
let isEnabled;
|
|
47
|
+
if (typeof allowAutoUpdates === 'boolean') {
|
|
48
|
+
isEnabled = allowAutoUpdates;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
isEnabled = await enableOrDisableBooleanFieldPrompt(en_1.lib.configOptions.setAllowAutoUpdates.fieldName);
|
|
52
|
+
}
|
|
53
|
+
(0, config_1.updateAllowAutoUpdates)(isEnabled);
|
|
54
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setAllowAutoUpdates.success(isEnabled.toString()));
|
|
48
55
|
}
|
|
49
56
|
const ALL_CMS_PUBLISH_MODES = Object.values(files_1.CMS_PUBLISH_MODE);
|
|
50
57
|
async function selectCmsPublishMode() {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
pageSize: 20,
|
|
56
|
-
message: (0, lang_1.i18n)(`commands.config.subcommands.set.options.defaultMode.promptMessage`),
|
|
57
|
-
choices: ALL_CMS_PUBLISH_MODES,
|
|
58
|
-
default: files_1.CMS_PUBLISH_MODE.publish,
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
58
|
+
const cmsPublishMode = await (0, promptUtils_1.listPrompt)(en_1.lib.configOptions.setDefaultCmsPublishMode.promptMessage, {
|
|
59
|
+
choices: ALL_CMS_PUBLISH_MODES,
|
|
60
|
+
defaultAnswer: files_1.CMS_PUBLISH_MODE.publish,
|
|
61
|
+
});
|
|
61
62
|
return cmsPublishMode;
|
|
62
63
|
}
|
|
63
64
|
async function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }) {
|
|
@@ -71,21 +72,17 @@ async function setDefaultCmsPublishMode({ accountId, defaultCmsPublishMode, }) {
|
|
|
71
72
|
newDefault = defaultCmsPublishMode;
|
|
72
73
|
}
|
|
73
74
|
else {
|
|
74
|
-
logger_1.
|
|
75
|
-
validModes: (0, text_1.commaSeparatedValues)(ALL_CMS_PUBLISH_MODES),
|
|
76
|
-
}));
|
|
75
|
+
logger_1.uiLogger.error(en_1.lib.configOptions.setDefaultCmsPublishMode.error((0, text_1.commaSeparatedValues)(ALL_CMS_PUBLISH_MODES)));
|
|
77
76
|
newDefault = await selectCmsPublishMode();
|
|
78
77
|
}
|
|
79
78
|
(0, config_1.updateDefaultCmsPublishMode)(newDefault);
|
|
80
|
-
logger_1.
|
|
81
|
-
mode: newDefault,
|
|
82
|
-
}));
|
|
79
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setDefaultCmsPublishMode.success(newDefault));
|
|
83
80
|
}
|
|
84
81
|
async function enterTimeout() {
|
|
85
82
|
const { timeout } = await (0, promptUtils_1.promptUser)([
|
|
86
83
|
{
|
|
87
84
|
name: 'timeout',
|
|
88
|
-
message:
|
|
85
|
+
message: en_1.lib.configOptions.setHttpTimeout.promptMessage,
|
|
89
86
|
type: 'input',
|
|
90
87
|
default: 30000,
|
|
91
88
|
},
|
|
@@ -102,7 +99,5 @@ async function setHttpTimeout({ accountId, httpTimeout, }) {
|
|
|
102
99
|
newHttpTimeout = httpTimeout;
|
|
103
100
|
}
|
|
104
101
|
(0, config_1.updateHttpTimeout)(newHttpTimeout);
|
|
105
|
-
logger_1.
|
|
106
|
-
timeout: newHttpTimeout,
|
|
107
|
-
}));
|
|
102
|
+
logger_1.uiLogger.success(en_1.lib.configOptions.setHttpTimeout.success(newHttpTimeout));
|
|
108
103
|
}
|
package/lib/constants.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const PROJECT_ERROR_TYPES: {
|
|
|
49
49
|
readonly BUILD_NOT_IN_PROGRESS: "BuildPipelineErrorType.BUILD_NOT_IN_PROGRESS";
|
|
50
50
|
readonly SUBBUILD_FAILED: "BuildPipelineErrorType.DEPENDENT_SUBBUILD_FAILED";
|
|
51
51
|
readonly SUBDEPLOY_FAILED: "DeployPipelineErrorType.DEPENDENT_SUBDEPLOY_FAILED";
|
|
52
|
+
readonly DEPLOY_CONTAINS_REMOVALS: "DeployPipelineErrorType.WARNING_DEPLOY_CONTAINS_REMOVALS";
|
|
52
53
|
};
|
|
53
54
|
export declare const PROJECT_TASK_TYPES: {
|
|
54
55
|
[key: string]: string;
|
|
@@ -78,3 +79,31 @@ export declare const FEATURES: {
|
|
|
78
79
|
readonly UNIFIED_THEME_PREVIEW: "cms:react:unifiedThemePreview";
|
|
79
80
|
readonly UNIFIED_APPS: "Developers:UnifiedApps:PrivateBeta";
|
|
80
81
|
};
|
|
82
|
+
export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
83
|
+
UPLOAD_SUCCESS: string;
|
|
84
|
+
UPLOAD_FAILURE: string;
|
|
85
|
+
UPDATE_PROJECT_NODES: string;
|
|
86
|
+
UPDATE_APP_DATA: string;
|
|
87
|
+
UPDATE_PROJECT_DATA: string;
|
|
88
|
+
};
|
|
89
|
+
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
90
|
+
UPLOAD: string;
|
|
91
|
+
};
|
|
92
|
+
export declare const APP_INSTALLATION_STATES: {
|
|
93
|
+
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
94
|
+
readonly INSTALLED: "INSTALLED";
|
|
95
|
+
readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
|
|
96
|
+
};
|
|
97
|
+
export declare const staticAuth = "static";
|
|
98
|
+
export declare const oAuth = "oauth";
|
|
99
|
+
export declare const privateDistribution = "private";
|
|
100
|
+
export declare const marketplaceDistribution = "marketplace";
|
|
101
|
+
export declare const appComponent = "app";
|
|
102
|
+
export declare const GET_STARTED_OPTIONS: {
|
|
103
|
+
readonly APP: "APP";
|
|
104
|
+
readonly CMS: "CMS";
|
|
105
|
+
};
|
|
106
|
+
export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
|
|
107
|
+
readonly INITIAL: "INITIAL";
|
|
108
|
+
readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
|
|
109
|
+
};
|
package/lib/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEATURES = exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
3
|
+
exports.LOCAL_DEV_SERVER_MESSAGE_TYPES = exports.GET_STARTED_OPTIONS = exports.appComponent = exports.marketplaceDistribution = exports.privateDistribution = exports.oAuth = exports.staticAuth = exports.APP_INSTALLATION_STATES = exports.LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = exports.LOCAL_DEV_UI_MESSAGE_SEND_TYPES = exports.FEATURES = exports.APP_AUTH_TYPES = exports.APP_DISTRIBUTION_TYPES = exports.IR_COMPONENT_TYPES = exports.PLATFORM_VERSION_ERROR_TYPES = exports.PROJECT_COMPONENT_TYPES = exports.PROJECT_TASK_TYPES = exports.PROJECT_ERROR_TYPES = exports.PROJECT_DEPLOY_TEXT = exports.PROJECT_BUILD_TEXT = exports.PROJECT_DEPLOY_STATES = exports.PROJECT_BUILD_STATES = exports.PROJECT_CONFIG_FILE = exports.DEFAULT_POLLING_DELAY = exports.MARKETPLACE_FOLDER = exports.HUBSPOT_FOLDER = exports.FEEDBACK_INTERVAL = exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = void 0;
|
|
4
4
|
exports.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components';
|
|
5
5
|
exports.DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main';
|
|
6
6
|
exports.FEEDBACK_INTERVAL = 10;
|
|
@@ -41,6 +41,7 @@ exports.PROJECT_ERROR_TYPES = {
|
|
|
41
41
|
BUILD_NOT_IN_PROGRESS: 'BuildPipelineErrorType.BUILD_NOT_IN_PROGRESS',
|
|
42
42
|
SUBBUILD_FAILED: 'BuildPipelineErrorType.DEPENDENT_SUBBUILD_FAILED',
|
|
43
43
|
SUBDEPLOY_FAILED: 'DeployPipelineErrorType.DEPENDENT_SUBDEPLOY_FAILED',
|
|
44
|
+
DEPLOY_CONTAINS_REMOVALS: 'DeployPipelineErrorType.WARNING_DEPLOY_CONTAINS_REMOVALS',
|
|
44
45
|
};
|
|
45
46
|
exports.PROJECT_TASK_TYPES = {
|
|
46
47
|
PRIVATE_APP: 'private app',
|
|
@@ -73,3 +74,31 @@ exports.FEATURES = {
|
|
|
73
74
|
UNIFIED_THEME_PREVIEW: 'cms:react:unifiedThemePreview',
|
|
74
75
|
UNIFIED_APPS: 'Developers:UnifiedApps:PrivateBeta',
|
|
75
76
|
};
|
|
77
|
+
exports.LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
78
|
+
UPLOAD_SUCCESS: 'server:uploadSuccess',
|
|
79
|
+
UPLOAD_FAILURE: 'server:uploadFailure',
|
|
80
|
+
UPDATE_PROJECT_NODES: 'server:updateProjectNodes',
|
|
81
|
+
UPDATE_APP_DATA: 'server:updateAppData',
|
|
82
|
+
UPDATE_PROJECT_DATA: 'server:updateProjectData',
|
|
83
|
+
};
|
|
84
|
+
exports.LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
85
|
+
UPLOAD: 'client:upload',
|
|
86
|
+
};
|
|
87
|
+
exports.APP_INSTALLATION_STATES = {
|
|
88
|
+
NOT_INSTALLED: 'NOT_INSTALLED',
|
|
89
|
+
INSTALLED: 'INSTALLED',
|
|
90
|
+
INSTALLED_WITH_OUTDATED_SCOPES: 'INSTALLED_WITH_OUTDATED_SCOPES',
|
|
91
|
+
};
|
|
92
|
+
exports.staticAuth = 'static';
|
|
93
|
+
exports.oAuth = 'oauth';
|
|
94
|
+
exports.privateDistribution = 'private';
|
|
95
|
+
exports.marketplaceDistribution = 'marketplace';
|
|
96
|
+
exports.appComponent = 'app';
|
|
97
|
+
exports.GET_STARTED_OPTIONS = {
|
|
98
|
+
APP: 'APP',
|
|
99
|
+
CMS: 'CMS',
|
|
100
|
+
};
|
|
101
|
+
exports.LOCAL_DEV_SERVER_MESSAGE_TYPES = {
|
|
102
|
+
INITIAL: 'INITIAL',
|
|
103
|
+
WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
|
|
104
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
export declare function isGloballyInstalled(command: string): Promise<boolean>;
|
|
2
|
-
export declare function getLatestCliVersion(): Promise<{
|
|
3
|
-
latest: string;
|
|
4
|
-
next: string;
|
|
5
|
-
}>;
|
|
6
1
|
export declare function installPackages({ packages, installLocations, }: {
|
|
7
2
|
packages?: string[];
|
|
8
3
|
installLocations?: string[];
|
|
@@ -3,23 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isGloballyInstalled = isGloballyInstalled;
|
|
7
|
-
exports.getLatestCliVersion = getLatestCliVersion;
|
|
8
6
|
exports.installPackages = installPackages;
|
|
9
7
|
exports.getProjectPackageJsonLocations = getProjectPackageJsonLocations;
|
|
10
8
|
exports.hasMissingPackages = hasMissingPackages;
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const child_process_1 = require("child_process");
|
|
14
|
-
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const util_1 = __importDefault(require("util"));
|
|
15
11
|
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const child_process_1 = require("child_process");
|
|
13
|
+
const fs_2 = require("@hubspot/local-dev-lib/fs");
|
|
14
|
+
const config_1 = require("./projects/config");
|
|
16
15
|
const ui_1 = require("./ui");
|
|
17
|
-
const util_1 = __importDefault(require("util"));
|
|
18
16
|
const lang_1 = require("./lang");
|
|
19
17
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
20
|
-
const
|
|
21
|
-
const package_json_1 = __importDefault(require("../package.json"));
|
|
22
|
-
const DEFAULT_PACKAGE_MANAGER = 'npm';
|
|
18
|
+
const npm_1 = require("./npm");
|
|
23
19
|
class NoPackageJsonFilesError extends Error {
|
|
24
20
|
constructor(projectName) {
|
|
25
21
|
super((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noPackageJsonInProject`, {
|
|
@@ -28,22 +24,6 @@ class NoPackageJsonFilesError extends Error {
|
|
|
28
24
|
}));
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
|
-
async function isGloballyInstalled(command) {
|
|
32
|
-
const exec = util_1.default.promisify(child_process_1.exec);
|
|
33
|
-
try {
|
|
34
|
-
await exec(`${command} --version`);
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
async function getLatestCliVersion() {
|
|
42
|
-
const exec = util_1.default.promisify(child_process_1.exec);
|
|
43
|
-
const { stdout } = await exec(`npm info ${package_json_1.default.name} dist-tags --json`);
|
|
44
|
-
const { latest, next } = JSON.parse(stdout);
|
|
45
|
-
return { latest, next };
|
|
46
|
-
}
|
|
47
27
|
async function installPackages({ packages, installLocations, }) {
|
|
48
28
|
const installDirs = installLocations || (await getProjectPackageJsonLocations());
|
|
49
29
|
await Promise.all(installDirs.map(async (dir) => {
|
|
@@ -64,14 +44,8 @@ async function installPackagesInDirectory(directory, packages) {
|
|
|
64
44
|
directory: relativeDir,
|
|
65
45
|
}),
|
|
66
46
|
});
|
|
67
|
-
let installCommand = `${DEFAULT_PACKAGE_MANAGER} install`;
|
|
68
|
-
if (packages) {
|
|
69
|
-
installCommand = `${installCommand} ${packages.join(' ')}`;
|
|
70
|
-
}
|
|
71
|
-
logger_1.logger.debug(`Running ${installCommand}`);
|
|
72
47
|
try {
|
|
73
|
-
|
|
74
|
-
await exec(installCommand, { cwd: directory });
|
|
48
|
+
await (0, npm_1.executeInstall)(packages, null, { cwd: directory });
|
|
75
49
|
SpinniesManager_1.default.succeed(spinner, {
|
|
76
50
|
text: (0, lang_1.i18n)(`commands.project.subcommands.installDeps.installationSuccessful`, {
|
|
77
51
|
directory: relativeDir,
|
|
@@ -99,17 +73,17 @@ async function getProjectPackageJsonLocations() {
|
|
|
99
73
|
throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.noProjectConfig`));
|
|
100
74
|
}
|
|
101
75
|
const { projectDir, projectConfig: { srcDir, name }, } = projectConfig;
|
|
102
|
-
if (!(await isGloballyInstalled(DEFAULT_PACKAGE_MANAGER))) {
|
|
76
|
+
if (!(await (0, npm_1.isGloballyInstalled)(npm_1.DEFAULT_PACKAGE_MANAGER))) {
|
|
103
77
|
throw new Error((0, lang_1.i18n)(`commands.project.subcommands.installDeps.packageManagerNotInstalled`, {
|
|
104
|
-
packageManager: DEFAULT_PACKAGE_MANAGER,
|
|
105
|
-
link: (0, ui_1.uiLink)(DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
|
|
78
|
+
packageManager: npm_1.DEFAULT_PACKAGE_MANAGER,
|
|
79
|
+
link: (0, ui_1.uiLink)(npm_1.DEFAULT_PACKAGE_MANAGER, 'https://docs.npmjs.com/downloading-and-installing-node-js-and-npm'),
|
|
106
80
|
}));
|
|
107
81
|
}
|
|
108
|
-
if (!
|
|
109
|
-
!
|
|
82
|
+
if (!fs_1.default.existsSync(projectConfig.projectDir) ||
|
|
83
|
+
!fs_1.default.existsSync(path_1.default.join(projectDir, srcDir))) {
|
|
110
84
|
throw new NoPackageJsonFilesError(name);
|
|
111
85
|
}
|
|
112
|
-
const packageJsonFiles = (await (0,
|
|
86
|
+
const packageJsonFiles = (await (0, fs_2.walk)(path_1.default.join(projectDir, srcDir))).filter(file => file.includes('package.json') &&
|
|
113
87
|
!file.includes('node_modules') &&
|
|
114
88
|
!file.includes('.vite'));
|
|
115
89
|
if (packageJsonFiles.length === 0) {
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -8,6 +8,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
|
8
8
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
9
9
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
10
10
|
const dependencyManagement_1 = require("../dependencyManagement");
|
|
11
|
+
const npm_1 = require("../npm");
|
|
11
12
|
const util_1 = __importDefault(require("util"));
|
|
12
13
|
const fs_1 = __importDefault(require("fs"));
|
|
13
14
|
const path_1 = __importDefault(require("path"));
|
|
@@ -230,7 +231,7 @@ class Doctor {
|
|
|
230
231
|
let latestCLIVersion;
|
|
231
232
|
let nextCliVersion;
|
|
232
233
|
try {
|
|
233
|
-
const { latest, next } = await (0,
|
|
234
|
+
const { latest, next } = await (0, npm_1.getLatestCliVersion)();
|
|
234
235
|
latestCLIVersion = latest;
|
|
235
236
|
nextCliVersion = next;
|
|
236
237
|
}
|
|
@@ -261,7 +262,7 @@ class Doctor {
|
|
|
261
262
|
this.diagnosis?.addCliSection({
|
|
262
263
|
type: 'success',
|
|
263
264
|
message: i18n(`lib.doctor.hsChecks.latest`, {
|
|
264
|
-
hsVersion:
|
|
265
|
+
hsVersion: package_json_1.default.version,
|
|
265
266
|
}),
|
|
266
267
|
});
|
|
267
268
|
}
|
|
@@ -15,6 +15,10 @@ const util_1 = __importDefault(require("util"));
|
|
|
15
15
|
const ui_1 = require("../ui");
|
|
16
16
|
function logError(error, context) {
|
|
17
17
|
debugError(error, context);
|
|
18
|
+
if (isProjectValidationError(error)) {
|
|
19
|
+
logger_1.logger.error(error.message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
18
22
|
if ((0, suppressError_1.shouldSuppressError)(error, context)) {
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
@@ -89,6 +93,9 @@ class ApiErrorContext {
|
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
exports.ApiErrorContext = ApiErrorContext;
|
|
96
|
+
function isProjectValidationError(error) {
|
|
97
|
+
return error instanceof Error && error.name === 'ProjectValidationError';
|
|
98
|
+
}
|
|
92
99
|
function isErrorWithMessageOrReason(error) {
|
|
93
100
|
return (typeof error === 'object' &&
|
|
94
101
|
error !== null &&
|
package/lib/filesystem.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function resolveLocalPath(filepath
|
|
1
|
+
export declare function resolveLocalPath(filepath?: string): string;
|
|
2
2
|
export declare function isPathFolder(path: string): boolean;
|
package/lib/generateSelectors.js
CHANGED
|
@@ -10,9 +10,9 @@ exports.setPreviewSelectors = setPreviewSelectors;
|
|
|
10
10
|
exports.generateInheritedSelectors = generateInheritedSelectors;
|
|
11
11
|
exports.generateSelectorsMap = generateSelectorsMap;
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
14
13
|
const exitCodes_1 = require("./enums/exitCodes");
|
|
15
|
-
const
|
|
14
|
+
const en_1 = require("../lang/en");
|
|
15
|
+
const logger_1 = require("./ui/logger");
|
|
16
16
|
const CSS_COMMENTS_REGEX = new RegExp(/\/\*.*\*\//, 'g');
|
|
17
17
|
const CSS_PSEUDO_CLASS_REGEX = new RegExp(/:active|:checked|:disabled|:empty|:enabled|:first-of-type|:focus|:hover|:in-range|:invalid|:link|:optional|:out-of-range|:read-only|:read-write|:required|:target|:valid|:visited/, 'g');
|
|
18
18
|
let maxFieldsDepth = 0;
|
|
@@ -22,9 +22,7 @@ function getMaxFieldsDepth() {
|
|
|
22
22
|
function findFieldsJsonPath(basePath) {
|
|
23
23
|
const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
24
24
|
if (!fs_1.default.existsSync(_path)) {
|
|
25
|
-
logger_1.
|
|
26
|
-
themePath: basePath,
|
|
27
|
-
}));
|
|
25
|
+
logger_1.uiLogger.error(en_1.commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
28
26
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
29
27
|
}
|
|
30
28
|
const files = fs_1.default.readdirSync(_path);
|
package/lib/interpolation.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export declare const helpers: {
|
|
2
2
|
[key: string]: (stringValue: string) => string;
|
|
3
3
|
};
|
|
4
|
-
type InterpolationData = {
|
|
5
|
-
[identifier: string]: string | number;
|
|
4
|
+
export type InterpolationData = {
|
|
5
|
+
[identifier: string]: string | undefined | null | number | boolean;
|
|
6
6
|
};
|
|
7
7
|
export declare function interpolate(stringValue: string, interpolationData: InterpolationData): string;
|
|
8
|
-
export {};
|
package/lib/lang.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { InterpolationData } from './interpolation';
|
|
1
2
|
export declare const MISSING_LANGUAGE_DATA_PREFIX = "[Missing language data]";
|
|
2
3
|
type LanguageObject = {
|
|
3
4
|
[key: string]: string | LanguageObject;
|
|
4
5
|
};
|
|
5
|
-
export declare function i18n(lookupDotNotation: string, options?:
|
|
6
|
-
[identifier: string]: string | number;
|
|
7
|
-
}): string;
|
|
6
|
+
export declare function i18n(lookupDotNotation: string, options?: InterpolationData): string;
|
|
8
7
|
export declare function setLangData(newLocale: string, newLangObj: LanguageObject): void;
|
|
9
8
|
export {};
|
|
@@ -2,5 +2,15 @@ import { GetValidationResultsResponse } from '@hubspot/local-dev-lib/types/Marke
|
|
|
2
2
|
export declare function kickOffValidation(accountId: number, assetType: string, src: string): Promise<number>;
|
|
3
3
|
export declare function pollForValidationFinish(accountId: number, validationId: number): Promise<void>;
|
|
4
4
|
export declare function fetchValidationResults(accountId: number, validationId: number): Promise<GetValidationResultsResponse>;
|
|
5
|
-
export declare function processValidationErrors(
|
|
6
|
-
|
|
5
|
+
export declare function processValidationErrors(invalidPathError: (path: string) => string, validationResults: GetValidationResultsResponse): void;
|
|
6
|
+
type ResultsCopy = {
|
|
7
|
+
noErrors: string;
|
|
8
|
+
required: string;
|
|
9
|
+
recommended: string;
|
|
10
|
+
warnings: {
|
|
11
|
+
file: (file: string) => string;
|
|
12
|
+
lineNumber: (line: string) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function displayValidationResults(resultsCopy: ResultsCopy, validationResults: GetValidationResultsResponse): void;
|
|
16
|
+
export {};
|