@hubspot/cli 7.5.11-experimental.0 → 7.6.0-beta.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 +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
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
6
|
+
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const table_1 = require("../../lib/ui/table");
|
|
9
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
10
|
+
const lang_1 = require("../../lib/lang");
|
|
11
|
+
const designManager_1 = require("@hubspot/local-dev-lib/api/designManager");
|
|
12
|
+
const lighthouseScore_1 = require("@hubspot/local-dev-lib/api/lighthouseScore");
|
|
13
|
+
const constants_1 = require("../../lib/constants");
|
|
14
|
+
const ui_1 = require("../../lib/ui");
|
|
15
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
15
17
|
const DEFAULT_TABLE_HEADER = [
|
|
16
18
|
'Accessibility',
|
|
17
19
|
'Best practices',
|
|
@@ -19,96 +21,107 @@ const DEFAULT_TABLE_HEADER = [
|
|
|
19
21
|
'PWA',
|
|
20
22
|
'SEO',
|
|
21
23
|
];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const EMPTY_SCORE = {
|
|
25
|
+
accessibilityScore: 0,
|
|
26
|
+
bestPracticesScore: 0,
|
|
27
|
+
performanceScore: 0,
|
|
28
|
+
pwaScore: 0,
|
|
29
|
+
seoScore: 0,
|
|
30
|
+
runWarnings: [],
|
|
31
|
+
auditDetails: null,
|
|
32
|
+
emulatedFormFactor: '',
|
|
33
|
+
templatePath: null,
|
|
34
|
+
link: null,
|
|
35
|
+
};
|
|
36
|
+
const command = 'lighthouse-score [--theme]';
|
|
37
|
+
const describe = undefined;
|
|
38
|
+
async function selectTheme(accountId) {
|
|
39
|
+
let themes = [];
|
|
40
|
+
try {
|
|
41
|
+
const { data: result } = await (0, designManager_1.fetchThemes)(accountId, {
|
|
42
|
+
limit: 500,
|
|
43
|
+
sorting: 'MOST_USED',
|
|
44
|
+
});
|
|
45
|
+
if (result && result.objects) {
|
|
46
|
+
themes = result.objects
|
|
47
|
+
.map(({ theme }) => theme.path)
|
|
48
|
+
.filter(themePath => !themePath.startsWith(constants_1.HUBSPOT_FOLDER) &&
|
|
49
|
+
!themePath.startsWith(constants_1.MARKETPLACE_FOLDER));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.errors.failedToFetchThemes`));
|
|
54
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
|
+
}
|
|
56
|
+
const { theme: selectedTheme } = await (0, promptUtils_1.promptUser)([
|
|
26
57
|
{
|
|
27
58
|
type: 'list',
|
|
28
|
-
look: false,
|
|
29
59
|
name: 'theme',
|
|
30
|
-
message: i18n(`commands.cms.subcommands.lighthouseScore.info.promptMessage`),
|
|
31
|
-
choices:
|
|
32
|
-
try {
|
|
33
|
-
const { data: result } = await fetchThemes(accountId, {
|
|
34
|
-
limit: 500,
|
|
35
|
-
sorting: 'MOST_USED',
|
|
36
|
-
});
|
|
37
|
-
if (result && result.objects) {
|
|
38
|
-
return result.objects
|
|
39
|
-
.map(({ theme }) => theme.path)
|
|
40
|
-
.filter(themePath => !themePath.startsWith(HUBSPOT_FOLDER) &&
|
|
41
|
-
!themePath.startsWith(MARKETPLACE_FOLDER));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToFetchThemes`));
|
|
46
|
-
process.exit(EXIT_CODES.ERROR);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
60
|
+
message: (0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.promptMessage`),
|
|
61
|
+
choices: themes,
|
|
49
62
|
},
|
|
50
63
|
]);
|
|
51
64
|
return selectedTheme;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const { target, verbose, theme, derivedAccountId } =
|
|
65
|
+
}
|
|
66
|
+
async function handler(args) {
|
|
67
|
+
const { target, verbose, theme, derivedAccountId } = args;
|
|
55
68
|
const includeDesktopScore = target === 'desktop' || !verbose;
|
|
56
69
|
const includeMobileScore = target === 'mobile' || !verbose;
|
|
57
70
|
let themeToCheck = theme;
|
|
58
71
|
if (themeToCheck) {
|
|
59
72
|
let isValidTheme = true;
|
|
60
73
|
try {
|
|
61
|
-
const { data: result } = await fetchThemes(derivedAccountId, {
|
|
74
|
+
const { data: result } = await (0, designManager_1.fetchThemes)(derivedAccountId, {
|
|
62
75
|
name: encodeURIComponent(themeToCheck),
|
|
63
76
|
});
|
|
64
|
-
isValidTheme = result && result.total;
|
|
77
|
+
isValidTheme = result && !!result.total;
|
|
65
78
|
}
|
|
66
79
|
catch (err) {
|
|
67
80
|
isValidTheme = false;
|
|
68
81
|
}
|
|
69
82
|
if (!isValidTheme) {
|
|
70
|
-
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, {
|
|
83
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, {
|
|
71
84
|
theme: themeToCheck,
|
|
72
85
|
}));
|
|
73
|
-
process.exit(EXIT_CODES.ERROR);
|
|
86
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
87
|
}
|
|
75
88
|
}
|
|
76
89
|
else {
|
|
77
90
|
themeToCheck = await selectTheme(derivedAccountId);
|
|
78
|
-
logger.log();
|
|
91
|
+
logger_1.logger.log();
|
|
79
92
|
}
|
|
80
93
|
// Kick off the scoring
|
|
81
94
|
let requestResult;
|
|
82
95
|
try {
|
|
83
|
-
const { data } = await requestLighthouseScore(derivedAccountId, {
|
|
96
|
+
const { data } = await (0, lighthouseScore_1.requestLighthouseScore)(derivedAccountId, {
|
|
84
97
|
themePath: themeToCheck,
|
|
85
98
|
});
|
|
86
99
|
requestResult = data;
|
|
87
100
|
}
|
|
88
101
|
catch (err) {
|
|
89
|
-
logger.debug(err);
|
|
102
|
+
logger_1.logger.debug(err);
|
|
90
103
|
}
|
|
91
104
|
if (!requestResult || !requestResult.mobileId || !requestResult.desktopId) {
|
|
92
|
-
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
93
|
-
process.exit(EXIT_CODES.ERROR);
|
|
105
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
106
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
94
107
|
}
|
|
95
108
|
// Poll till scoring is finished
|
|
96
109
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
text: i18n(`commands.cms.subcommands.lighthouseScore.info.generatingScore`, { theme: themeToCheck }),
|
|
110
|
+
SpinniesManager_1.default.init();
|
|
111
|
+
SpinniesManager_1.default.add('lighthouseScore', {
|
|
112
|
+
text: (0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.generatingScore`, { theme: themeToCheck }),
|
|
100
113
|
});
|
|
101
|
-
|
|
114
|
+
async function checkScoreStatus() {
|
|
102
115
|
let desktopScoreStatus = 'COMPLETED';
|
|
103
116
|
if (includeDesktopScore) {
|
|
104
|
-
const { data } = await getLighthouseScoreStatus(derivedAccountId, {
|
|
117
|
+
const { data } = await (0, lighthouseScore_1.getLighthouseScoreStatus)(derivedAccountId, {
|
|
105
118
|
themeId: requestResult.desktopId,
|
|
106
119
|
});
|
|
107
120
|
desktopScoreStatus = data;
|
|
108
121
|
}
|
|
109
122
|
let mobileScoreStatus = 'COMPLETED';
|
|
110
123
|
if (includeDesktopScore) {
|
|
111
|
-
const { data } = await getLighthouseScoreStatus(derivedAccountId, {
|
|
124
|
+
const { data } = await (0, lighthouseScore_1.getLighthouseScoreStatus)(derivedAccountId, {
|
|
112
125
|
themeId: requestResult.mobileId,
|
|
113
126
|
});
|
|
114
127
|
mobileScoreStatus = data;
|
|
@@ -118,29 +131,29 @@ exports.handler = async (options) => {
|
|
|
118
131
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
119
132
|
await checkScoreStatus();
|
|
120
133
|
}
|
|
121
|
-
}
|
|
134
|
+
}
|
|
122
135
|
await checkScoreStatus();
|
|
123
|
-
|
|
136
|
+
SpinniesManager_1.default.remove('lighthouseScore');
|
|
124
137
|
}
|
|
125
138
|
catch (err) {
|
|
126
|
-
logger.debug(err);
|
|
127
|
-
process.exit(EXIT_CODES.ERROR);
|
|
139
|
+
logger_1.logger.debug(err);
|
|
140
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
128
141
|
}
|
|
129
142
|
// Fetch the scoring results
|
|
130
|
-
let desktopScoreResult
|
|
131
|
-
let mobileScoreResult
|
|
132
|
-
let verboseViewAverageScoreResult
|
|
143
|
+
let desktopScoreResult;
|
|
144
|
+
let mobileScoreResult;
|
|
145
|
+
let verboseViewAverageScoreResult;
|
|
133
146
|
try {
|
|
134
147
|
const params = { isAverage: !verbose };
|
|
135
148
|
if (includeDesktopScore) {
|
|
136
|
-
const { data } = await getLighthouseScore(derivedAccountId, {
|
|
149
|
+
const { data } = await (0, lighthouseScore_1.getLighthouseScore)(derivedAccountId, {
|
|
137
150
|
...params,
|
|
138
151
|
desktopId: requestResult.desktopId,
|
|
139
152
|
});
|
|
140
153
|
desktopScoreResult = data;
|
|
141
154
|
}
|
|
142
155
|
if (includeMobileScore) {
|
|
143
|
-
const { data } = await getLighthouseScore(derivedAccountId, {
|
|
156
|
+
const { data } = await (0, lighthouseScore_1.getLighthouseScore)(derivedAccountId, {
|
|
144
157
|
...params,
|
|
145
158
|
mobileId: requestResult.mobileId,
|
|
146
159
|
});
|
|
@@ -148,25 +161,30 @@ exports.handler = async (options) => {
|
|
|
148
161
|
}
|
|
149
162
|
// This is needed to show the average scores above the verbose output
|
|
150
163
|
if (verbose) {
|
|
151
|
-
const { data } = await getLighthouseScore(derivedAccountId, {
|
|
164
|
+
const { data } = await (0, lighthouseScore_1.getLighthouseScore)(derivedAccountId, {
|
|
152
165
|
...params,
|
|
153
166
|
isAverage: true,
|
|
154
|
-
desktopId: includeDesktopScore ? requestResult.desktopId :
|
|
155
|
-
mobileId: includeMobileScore ? requestResult.mobileId :
|
|
167
|
+
desktopId: includeDesktopScore ? requestResult.desktopId : undefined,
|
|
168
|
+
mobileId: includeMobileScore ? requestResult.mobileId : undefined,
|
|
156
169
|
});
|
|
157
170
|
verboseViewAverageScoreResult = data;
|
|
158
171
|
}
|
|
159
172
|
}
|
|
160
173
|
catch (err) {
|
|
161
|
-
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
162
|
-
process.exit(EXIT_CODES.ERROR);
|
|
174
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
175
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
163
176
|
}
|
|
164
177
|
if (verbose) {
|
|
165
|
-
|
|
166
|
-
|
|
178
|
+
const scoreResult = target === 'desktop' ? desktopScoreResult : mobileScoreResult;
|
|
179
|
+
if (!verboseViewAverageScoreResult || !scoreResult) {
|
|
180
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
181
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
182
|
+
}
|
|
183
|
+
logger_1.logger.log(`${themeToCheck} ${target} scores`);
|
|
184
|
+
const tableHeader = (0, table_1.getTableHeader)(DEFAULT_TABLE_HEADER);
|
|
167
185
|
const scores = verboseViewAverageScoreResult.scores
|
|
168
186
|
? verboseViewAverageScoreResult.scores[0]
|
|
169
|
-
:
|
|
187
|
+
: EMPTY_SCORE;
|
|
170
188
|
const averageTableData = [
|
|
171
189
|
scores.accessibilityScore,
|
|
172
190
|
scores.bestPracticesScore,
|
|
@@ -174,15 +192,14 @@ exports.handler = async (options) => {
|
|
|
174
192
|
scores.pwaScore,
|
|
175
193
|
scores.seoScore,
|
|
176
194
|
];
|
|
177
|
-
logger.log(getTableContents([tableHeader, averageTableData], {
|
|
195
|
+
logger_1.logger.log((0, table_1.getTableContents)([tableHeader, averageTableData], {
|
|
178
196
|
border: { bodyLeft: ' ' },
|
|
179
197
|
}));
|
|
180
|
-
logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.pageTemplateScoreTitle`));
|
|
181
|
-
const table2Header = getTableHeader([
|
|
198
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.pageTemplateScoreTitle`));
|
|
199
|
+
const table2Header = (0, table_1.getTableHeader)([
|
|
182
200
|
'Template path',
|
|
183
201
|
...DEFAULT_TABLE_HEADER,
|
|
184
202
|
]);
|
|
185
|
-
const scoreResult = target === 'desktop' ? desktopScoreResult : mobileScoreResult;
|
|
186
203
|
const templateTableData = scoreResult.scores.map(score => {
|
|
187
204
|
return [
|
|
188
205
|
score.templatePath,
|
|
@@ -193,30 +210,32 @@ exports.handler = async (options) => {
|
|
|
193
210
|
score.seoScore,
|
|
194
211
|
];
|
|
195
212
|
});
|
|
196
|
-
logger.log(getTableContents([table2Header, ...templateTableData], {
|
|
213
|
+
logger_1.logger.log((0, table_1.getTableContents)([table2Header, ...templateTableData], {
|
|
197
214
|
border: { bodyLeft: ' ' },
|
|
198
215
|
}));
|
|
199
|
-
logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.lighthouseLinksTitle`));
|
|
216
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.lighthouseLinksTitle`));
|
|
200
217
|
scoreResult.scores.forEach(score => {
|
|
201
|
-
|
|
218
|
+
if (score.templatePath && score.link) {
|
|
219
|
+
logger_1.logger.log(' ', (0, ui_1.uiLink)(score.templatePath, score.link));
|
|
220
|
+
}
|
|
202
221
|
});
|
|
203
222
|
if (scoreResult.failedTemplatePaths.length) {
|
|
204
|
-
logger.log();
|
|
205
|
-
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.info.failedTemplatePathsTitle`));
|
|
223
|
+
logger_1.logger.log();
|
|
224
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.failedTemplatePathsTitle`));
|
|
206
225
|
scoreResult.failedTemplatePaths.forEach(failedTemplatePath => {
|
|
207
|
-
logger.log(' ', failedTemplatePath);
|
|
226
|
+
logger_1.logger.log(' ', failedTemplatePath);
|
|
208
227
|
});
|
|
209
228
|
}
|
|
210
|
-
logger.log();
|
|
211
|
-
logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, {
|
|
229
|
+
logger_1.logger.log();
|
|
230
|
+
logger_1.logger.info((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, {
|
|
212
231
|
target,
|
|
213
232
|
}));
|
|
214
233
|
}
|
|
215
234
|
else {
|
|
216
|
-
logger.log(`Theme: ${themeToCheck}`);
|
|
217
|
-
const tableHeader = getTableHeader(['Target', ...DEFAULT_TABLE_HEADER]);
|
|
235
|
+
logger_1.logger.log(`Theme: ${themeToCheck}`);
|
|
236
|
+
const tableHeader = (0, table_1.getTableHeader)(['Target', ...DEFAULT_TABLE_HEADER]);
|
|
218
237
|
const getTableData = (target, scoreResult) => {
|
|
219
|
-
const scores = scoreResult
|
|
238
|
+
const scores = scoreResult?.scores ? scoreResult.scores[0] : EMPTY_SCORE;
|
|
220
239
|
return [
|
|
221
240
|
target,
|
|
222
241
|
scores.accessibilityScore,
|
|
@@ -230,39 +249,49 @@ exports.handler = async (options) => {
|
|
|
230
249
|
getTableData('desktop', desktopScoreResult),
|
|
231
250
|
getTableData('mobile', mobileScoreResult),
|
|
232
251
|
];
|
|
233
|
-
logger.log(getTableContents([tableHeader, ...tableData], {
|
|
252
|
+
logger_1.logger.log((0, table_1.getTableContents)([tableHeader, ...tableData], {
|
|
234
253
|
border: { bodyLeft: ' ' },
|
|
235
254
|
}));
|
|
236
|
-
logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.verboseOptionNote`));
|
|
255
|
+
logger_1.logger.info((0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.info.verboseOptionNote`));
|
|
237
256
|
}
|
|
238
|
-
logger.log();
|
|
239
|
-
logger.log(`Powered by ${uiLink('Google Lighthouse', 'https://developer.chrome.com/docs/lighthouse/overview/')}.`);
|
|
240
|
-
process.exit();
|
|
241
|
-
}
|
|
242
|
-
|
|
257
|
+
logger_1.logger.log();
|
|
258
|
+
logger_1.logger.log(`Powered by ${(0, ui_1.uiLink)('Google Lighthouse', 'https://developer.chrome.com/docs/lighthouse/overview/')}.`);
|
|
259
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
260
|
+
}
|
|
261
|
+
function cmslighthouseScoreBuilder(yargs) {
|
|
243
262
|
yargs.option('theme', {
|
|
244
|
-
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.theme.describe`),
|
|
263
|
+
describe: (0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.options.theme.describe`),
|
|
245
264
|
type: 'string',
|
|
246
265
|
});
|
|
247
266
|
yargs.option('target', {
|
|
248
|
-
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.target.describe`),
|
|
267
|
+
describe: (0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.options.target.describe`),
|
|
249
268
|
type: 'string',
|
|
250
269
|
choices: ['desktop', 'mobile'],
|
|
251
270
|
default: 'desktop',
|
|
252
271
|
});
|
|
253
272
|
yargs.option('verbose', {
|
|
254
|
-
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.verbose.describe`),
|
|
273
|
+
describe: (0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.options.verbose.describe`),
|
|
255
274
|
boolean: true,
|
|
256
275
|
default: false,
|
|
257
276
|
});
|
|
258
277
|
yargs.example([
|
|
259
278
|
[
|
|
260
279
|
'$0 cms lighthouse-score --theme=my-theme',
|
|
261
|
-
i18n(`commands.cms.subcommands.lighthouseScore.examples.default`),
|
|
280
|
+
(0, lang_1.i18n)(`commands.cms.subcommands.lighthouseScore.examples.default`),
|
|
262
281
|
],
|
|
263
282
|
]);
|
|
264
|
-
addConfigOptions(yargs);
|
|
265
|
-
addAccountOptions(yargs);
|
|
266
|
-
addUseEnvironmentOptions(yargs);
|
|
267
283
|
return yargs;
|
|
284
|
+
}
|
|
285
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(cmslighthouseScoreBuilder, command, describe, {
|
|
286
|
+
useGlobalOptions: true,
|
|
287
|
+
useConfigOptions: true,
|
|
288
|
+
useAccountOptions: true,
|
|
289
|
+
useEnvironmentOptions: true,
|
|
290
|
+
});
|
|
291
|
+
const cmslighthouseScoreCommand = {
|
|
292
|
+
command,
|
|
293
|
+
describe,
|
|
294
|
+
handler,
|
|
295
|
+
builder,
|
|
268
296
|
};
|
|
297
|
+
exports.default = cmslighthouseScoreCommand;
|
package/commands/cms.d.ts
CHANGED
package/commands/cms.js
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.builder = yargs => {
|
|
12
|
-
addConfigOptions(yargs);
|
|
13
|
-
addAccountOptions(yargs);
|
|
14
|
-
addGlobalOptions(yargs);
|
|
6
|
+
const lang_1 = require("../lib/lang");
|
|
7
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
8
|
+
const lighthouseScore_1 = __importDefault(require("./cms/lighthouseScore"));
|
|
9
|
+
const convertFields_1 = __importDefault(require("./cms/convertFields"));
|
|
10
|
+
const getReactModule_1 = __importDefault(require("./cms/getReactModule"));
|
|
11
|
+
const command = 'cms';
|
|
12
|
+
const describe = (0, lang_1.i18n)(`commands.cms.describe`);
|
|
13
|
+
function cmsBuilder(yargs) {
|
|
15
14
|
yargs
|
|
16
|
-
.command(
|
|
17
|
-
.command(
|
|
18
|
-
.command(
|
|
15
|
+
.command(lighthouseScore_1.default)
|
|
16
|
+
.command(convertFields_1.default)
|
|
17
|
+
.command(getReactModule_1.default)
|
|
19
18
|
.demandCommand(1, '');
|
|
20
19
|
return yargs;
|
|
20
|
+
}
|
|
21
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(cmsBuilder, command, describe);
|
|
22
|
+
const cmsCommand = {
|
|
23
|
+
command,
|
|
24
|
+
describe,
|
|
25
|
+
builder,
|
|
26
|
+
handler: () => { },
|
|
21
27
|
};
|
|
28
|
+
exports.default = cmsCommand;
|
package/commands/completion.d.ts
CHANGED
package/commands/completion.js
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const yargsParser = require('yargs-parser');
|
|
5
|
-
const { i18n } = require('../lib/lang');
|
|
6
|
-
const { trackCommandUsage } = require('../lib/usageTracking');
|
|
7
|
-
exports.command = 'completion';
|
|
8
|
-
exports.describe = i18n('commands.completion.describe');
|
|
9
|
-
exports.handler = async () => {
|
|
10
|
-
await trackCommandUsage('completion');
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
4
|
};
|
|
12
|
-
exports
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
7
|
+
const lang_1 = require("../lib/lang");
|
|
8
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
9
|
+
const yargsUtils_1 = require("../lib/yargsUtils");
|
|
10
|
+
const command = 'completion';
|
|
11
|
+
const describe = (0, lang_1.i18n)('commands.completion.describe');
|
|
12
|
+
async function handler() {
|
|
13
|
+
await (0, usageTracking_1.trackCommandUsage)('completion');
|
|
14
|
+
}
|
|
15
|
+
function completionBuilder(yargs) {
|
|
16
|
+
const { help } = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
14
17
|
if (!help) {
|
|
15
18
|
yargs.completion();
|
|
16
19
|
}
|
|
17
20
|
yargs.example([
|
|
18
|
-
['$0 completion >> ~/.zshrc', i18n('commands.completion.examples.default')],
|
|
21
|
+
['$0 completion >> ~/.zshrc', (0, lang_1.i18n)('commands.completion.examples.default')],
|
|
19
22
|
]);
|
|
20
23
|
return yargs;
|
|
24
|
+
}
|
|
25
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(completionBuilder, command, describe);
|
|
26
|
+
const completionCommand = {
|
|
27
|
+
command,
|
|
28
|
+
describe,
|
|
29
|
+
handler,
|
|
30
|
+
builder,
|
|
21
31
|
};
|
|
32
|
+
exports.default = completionCommand;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const describe: string;
|
|
4
|
-
export declare const command = "migrate";
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type ConfigMigrateArgs = CommonArgs & ConfigArgs & {
|
|
6
3
|
force?: boolean;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const configMigrateCommand: YargsCommandModule<unknown, ConfigMigrateArgs>;
|
|
6
|
+
export default configMigrateCommand;
|
|
@@ -3,82 +3,73 @@ 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.command = exports.describe = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
|
-
exports.builder = builder;
|
|
9
6
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
11
7
|
const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
|
|
12
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
8
|
const configMigrate_1 = require("../../lib/configMigrate");
|
|
14
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
15
|
-
const lang_1 = require("../../lib/lang");
|
|
16
|
-
const usageTracking_1 = require("../../lib/usageTracking");
|
|
17
9
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
18
10
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
12
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
14
|
+
const en_1 = require("../../lang/en");
|
|
15
|
+
const describe = en_1.commands.config.subcommands.migrate.describe;
|
|
16
|
+
const command = 'migrate';
|
|
24
17
|
async function handler(args) {
|
|
25
|
-
const { config: configPath, force
|
|
18
|
+
const { derivedAccountId, config: configPath, force } = args;
|
|
19
|
+
(0, usageTracking_1.trackCommandUsage)('config-migrate', {}, derivedAccountId);
|
|
26
20
|
if (configPath && !fs_1.default.existsSync(configPath)) {
|
|
27
|
-
logger_1.
|
|
28
|
-
configPath,
|
|
29
|
-
}));
|
|
21
|
+
logger_1.uiLogger.error(en_1.commands.config.subcommands.migrate.errors.configNotFound(configPath));
|
|
30
22
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
31
23
|
}
|
|
32
24
|
const deprecatedConfigExists = (0, migrate_1.configFileExists)(false, configPath);
|
|
33
25
|
const globalConfigExists = (0, migrate_1.configFileExists)(true);
|
|
34
26
|
if (!deprecatedConfigExists) {
|
|
35
|
-
logger_1.
|
|
36
|
-
|
|
37
|
-
}));
|
|
38
|
-
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
27
|
+
logger_1.uiLogger.error(en_1.commands.config.subcommands.migrate.errors.noConfigToMigrate);
|
|
28
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
29
|
}
|
|
30
|
+
let success = false;
|
|
40
31
|
try {
|
|
41
32
|
if (!globalConfigExists) {
|
|
42
|
-
await (0, configMigrate_1.handleMigration)(
|
|
33
|
+
success = await (0, configMigrate_1.handleMigration)(configPath, true);
|
|
43
34
|
}
|
|
44
35
|
else {
|
|
45
|
-
await (0, configMigrate_1.handleMerge)(
|
|
36
|
+
success = await (0, configMigrate_1.handleMerge)(configPath, force, true);
|
|
46
37
|
}
|
|
47
|
-
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
48
38
|
}
|
|
49
39
|
catch (error) {
|
|
50
|
-
(0, usageTracking_1.trackCommandMetadataUsage)('config-migrate', {
|
|
51
|
-
command: 'hs config migrate',
|
|
52
|
-
type: 'Migration/merge',
|
|
53
|
-
successful: false,
|
|
54
|
-
}, derivedAccountId);
|
|
55
40
|
(0, index_1.logError)(error);
|
|
56
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
57
41
|
}
|
|
42
|
+
process.exit(success ? exitCodes_1.EXIT_CODES.SUCCESS : exitCodes_1.EXIT_CODES.ERROR);
|
|
58
43
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
44
|
+
function configMigrateBuilder(yargs) {
|
|
45
|
+
return yargs
|
|
46
|
+
.option({
|
|
47
|
+
force: {
|
|
48
|
+
alias: 'f',
|
|
49
|
+
type: 'boolean',
|
|
50
|
+
default: false,
|
|
51
|
+
description: en_1.commands.config.subcommands.migrate.options.force,
|
|
52
|
+
},
|
|
67
53
|
})
|
|
68
54
|
.example([
|
|
69
55
|
[
|
|
70
56
|
'$0 config migrate',
|
|
71
|
-
|
|
72
|
-
deprecatedConfigPath: config_1.DEFAULT_HUBSPOT_CONFIG_YAML_FILE_NAME,
|
|
73
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
74
|
-
}),
|
|
57
|
+
en_1.commands.config.subcommands.migrate.examples.default,
|
|
75
58
|
],
|
|
76
59
|
[
|
|
77
60
|
'$0 config migrate --config=/path/to/config.yml',
|
|
78
|
-
|
|
79
|
-
globalConfigPath: config_1.GLOBAL_CONFIG_PATH,
|
|
80
|
-
}),
|
|
61
|
+
en_1.commands.config.subcommands.migrate.examples.configFlag,
|
|
81
62
|
],
|
|
82
63
|
]);
|
|
83
|
-
return yargs;
|
|
84
64
|
}
|
|
65
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(configMigrateBuilder, command, en_1.commands.config.subcommands.migrate.verboseDescribe, {
|
|
66
|
+
useGlobalOptions: true,
|
|
67
|
+
useConfigOptions: true,
|
|
68
|
+
});
|
|
69
|
+
const configMigrateCommand = {
|
|
70
|
+
command,
|
|
71
|
+
describe,
|
|
72
|
+
handler,
|
|
73
|
+
builder,
|
|
74
|
+
};
|
|
75
|
+
exports.default = configMigrateCommand;
|
package/commands/config/set.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ArgumentsCamelCase, Argv } from 'yargs';
|
|
2
|
-
import { CommonArgs } from '../../types/Yargs';
|
|
3
1
|
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
4
|
-
|
|
2
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
3
|
+
type ConfigSetArgs = CommonArgs & ConfigArgs & {
|
|
5
4
|
defaultCmsPublishMode: CmsPublishMode;
|
|
6
5
|
allowUsageTracking?: boolean;
|
|
7
6
|
httpTimeout?: string;
|
|
7
|
+
allowAutoUpdates?: boolean;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
9
|
+
declare const configSetCommand: YargsCommandModule<unknown, ConfigSetArgs>;
|
|
10
|
+
export default configSetCommand;
|