@hubspot/cli 7.4.7-experimental.0 → 7.4.7
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/api/migrate.d.ts +14 -4
- package/api/migrate.js +16 -2
- package/bin/cli.js +8 -183
- package/commands/account/auth.d.ts +10 -0
- package/commands/account/auth.js +188 -0
- package/commands/account/clean.js +38 -5
- package/commands/account/createOverride.d.ts +10 -0
- package/commands/account/createOverride.js +104 -0
- package/commands/account/info.js +38 -4
- package/commands/account/list.js +23 -5
- package/commands/account/remove.js +36 -2
- package/commands/account/removeOverride.d.ts +10 -0
- package/commands/account/removeOverride.js +76 -0
- package/commands/account/use.js +25 -3
- package/commands/account.js +7 -2
- package/commands/app/migrate.d.ts +6 -6
- package/commands/app/migrate.js +62 -45
- package/commands/app.js +0 -2
- package/commands/auth.js +14 -11
- package/commands/cms/lighthouseScore.js +7 -3
- package/commands/cms.js +1 -2
- package/commands/completion.js +2 -3
- package/commands/config/migrate.d.ts +10 -0
- package/commands/config/migrate.js +84 -0
- package/commands/config/set.d.ts +10 -0
- package/commands/config/set.js +34 -29
- package/commands/config.d.ts +4 -1
- package/commands/config.js +45 -11
- package/commands/create/api-sample.js +3 -1
- package/commands/create/website-theme.js +1 -1
- package/commands/create.js +7 -8
- package/commands/customObject/schema/delete.js +4 -1
- package/commands/customObject/schema/fetch-all.js +2 -1
- package/commands/customObject/schema/fetch.js +2 -1
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +5 -6
- package/commands/feedback.js +7 -8
- package/commands/fetch.js +6 -7
- package/commands/filemanager.js +1 -2
- package/commands/function.js +1 -2
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +7 -8
- package/commands/hubdb/delete.js +8 -7
- package/commands/hubdb/fetch.js +4 -5
- package/commands/hubdb.js +1 -2
- package/commands/init.js +18 -20
- package/commands/lint.js +3 -4
- package/commands/list.js +5 -6
- package/commands/logs.js +12 -13
- package/commands/module/marketplace-validate.js +5 -6
- package/commands/module.js +1 -3
- package/commands/mv.js +4 -5
- package/commands/open.js +4 -5
- package/commands/project/add.d.ts +3 -7
- package/commands/project/add.js +28 -23
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +49 -45
- package/commands/project/create.d.ts +10 -1
- package/commands/project/create.js +85 -63
- package/commands/project/deploy.d.ts +3 -6
- package/commands/project/deploy.js +27 -25
- package/commands/project/dev/deprecatedFlow.js +32 -25
- package/commands/project/dev/index.d.ts +4 -2
- package/commands/project/dev/index.js +31 -18
- package/commands/project/dev/unifiedFlow.js +10 -11
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -27
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +6 -0
- package/commands/project/migrate.js +71 -0
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/upload.d.ts +9 -1
- package/commands/project/upload.js +78 -54
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +47 -35
- package/commands/remove.js +7 -5
- package/commands/sandbox/create.js +10 -11
- package/commands/sandbox/delete.js +18 -19
- package/commands/sandbox.js +1 -2
- package/commands/secret/addSecret.js +5 -6
- package/commands/secret/deleteSecret.js +12 -9
- package/commands/secret/listSecret.js +3 -4
- package/commands/secret/updateSecret.js +9 -8
- package/commands/secret.js +1 -2
- package/commands/theme/generate-selectors.js +5 -6
- package/commands/theme/marketplace-validate.js +5 -6
- package/commands/theme/preview.js +16 -16
- package/commands/theme.js +1 -2
- package/commands/upload.js +23 -24
- package/commands/watch.js +18 -19
- package/lang/en.d.ts +2806 -0
- package/lang/en.js +2659 -3300
- package/lang/en.lyaml +98 -41
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.d.ts +10 -4
- package/lib/app/migrate.js +208 -94
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +10 -7
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +3 -4
- package/lib/commonOpts.js +46 -18
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +104 -0
- package/lib/configOptions.js +11 -10
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/dependencyManagement.js +2 -2
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +57 -44
- package/lib/errorHandlers/index.js +6 -7
- package/lib/errorHandlers/suppressError.js +6 -7
- package/lib/generateSelectors.js +1 -2
- package/lib/hasFeature.d.ts +3 -1
- package/lib/middleware/__test__/configMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/configMiddleware.test.js +194 -0
- package/lib/middleware/__test__/gitMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/gitMiddleware.test.js +76 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/notificationsMiddleware.test.js +10 -0
- package/lib/middleware/__test__/requestMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/requestMiddleware.test.js +20 -0
- package/lib/middleware/__test__/utils.test.d.ts +1 -0
- package/lib/middleware/__test__/utils.test.js +53 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.d.ts +1 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +81 -0
- package/lib/middleware/configMiddleware.d.ts +13 -0
- package/lib/middleware/configMiddleware.js +116 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +123 -0
- package/lib/middleware/gitMiddleware.d.ts +2 -0
- package/lib/middleware/gitMiddleware.js +14 -0
- package/lib/middleware/notificationsMiddleware.d.ts +1 -0
- package/lib/middleware/notificationsMiddleware.js +38 -0
- package/lib/middleware/requestMiddleware.d.ts +1 -0
- package/lib/middleware/requestMiddleware.js +11 -0
- package/lib/middleware/utils.d.ts +8 -0
- package/lib/middleware/utils.js +17 -0
- package/lib/middleware/yargsChecksMiddleware.d.ts +4 -0
- package/lib/middleware/yargsChecksMiddleware.js +24 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/buildAndDeploy.js +28 -39
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create.js +5 -6
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/{DevServerManagerV2.d.ts → projects/localDev/DevServerManagerV2.d.ts} +1 -1
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +3 -4
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +49 -82
- package/lib/{LocalDevManagerV2.d.ts → projects/localDev/LocalDevManagerV2.d.ts} +2 -2
- package/lib/{LocalDevManagerV2.js → projects/localDev/LocalDevManagerV2.js} +43 -75
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +5 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +97 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +13 -2
- package/lib/projects/upload.js +18 -34
- package/lib/projects/urls.d.ts +1 -0
- package/lib/projects/urls.js +6 -0
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +11 -4
- package/lib/prompts/createProjectPrompt.js +14 -9
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installPublicAppPrompt.js +6 -5
- package/lib/prompts/personalAccessKeyPrompt.js +17 -18
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.js +4 -5
- package/lib/prompts/projectDevTargetAccountPrompt.js +11 -12
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +1 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/selectPublicAppPrompt.js +6 -7
- package/lib/prompts/setAsDefaultAccountPrompt.js +1 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/ui/SpinniesManager.d.ts +1 -1
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +16 -16
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/ui/spinniesUtils.d.ts +5 -5
- package/lib/yargsUtils.d.ts +1 -1
- package/package.json +7 -6
- package/types/Yargs.d.ts +5 -11
- package/lib/projects/index.d.ts +0 -20
- package/lib/projects/index.js +0 -195
package/lib/app/migrate.js
CHANGED
|
@@ -3,10 +3,8 @@ 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.downloadProjectFiles = downloadProjectFiles;
|
|
7
6
|
exports.migrateApp2025_2 = migrateApp2025_2;
|
|
8
7
|
exports.logInvalidAccountError = logInvalidAccountError;
|
|
9
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
8
|
const path_1 = __importDefault(require("path"));
|
|
11
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
10
|
const archive_1 = require("@hubspot/local-dev-lib/archive");
|
|
@@ -16,46 +14,88 @@ const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
|
16
14
|
const transform_1 = require("@hubspot/project-parsing-lib/src/lib/transform");
|
|
17
15
|
const Migration_1 = require("@hubspot/local-dev-lib/types/Migration");
|
|
18
16
|
const projects_2 = require("@hubspot/local-dev-lib/api/projects");
|
|
17
|
+
const inquirer = require('inquirer');
|
|
19
18
|
const promptUtils_1 = require("../prompts/promptUtils");
|
|
20
19
|
const ui_1 = require("../ui");
|
|
21
|
-
const
|
|
22
|
-
const projects_3 = require("../projects");
|
|
20
|
+
const ensureProjectExists_1 = require("../projects/ensureProjectExists");
|
|
23
21
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
24
22
|
const polling_1 = require("../polling");
|
|
25
23
|
const migrate_1 = require("../../api/migrate");
|
|
26
|
-
|
|
24
|
+
const fs_1 = __importDefault(require("fs"));
|
|
25
|
+
const en_1 = require("../../lang/en");
|
|
26
|
+
const hasFeature_1 = require("../hasFeature");
|
|
27
|
+
const constants_1 = require("../constants");
|
|
28
|
+
const urls_1 = require("../projects/urls");
|
|
29
|
+
const logger_1 = require("../ui/logger");
|
|
30
|
+
function getUnmigratableReason(reasonCode, projectName, accountId) {
|
|
27
31
|
switch (reasonCode) {
|
|
28
32
|
case projects_1.UNMIGRATABLE_REASONS.UP_TO_DATE:
|
|
29
|
-
return
|
|
33
|
+
return en_1.lib.migrate.errors.unmigratableReasons.upToDate;
|
|
30
34
|
case projects_1.UNMIGRATABLE_REASONS.IS_A_PRIVATE_APP:
|
|
31
|
-
return
|
|
35
|
+
return en_1.lib.migrate.errors.unmigratableReasons.isPrivateApp;
|
|
32
36
|
case projects_1.UNMIGRATABLE_REASONS.LISTED_IN_MARKETPLACE:
|
|
33
|
-
return
|
|
37
|
+
return en_1.lib.migrate.errors.unmigratableReasons.listedInMarketplace;
|
|
38
|
+
case projects_1.UNMIGRATABLE_REASONS.PROJECT_CONNECTED_TO_GITHUB:
|
|
39
|
+
return en_1.lib.migrate.errors.unmigratableReasons.projectConnectedToGitHub(projectName, accountId);
|
|
40
|
+
case migrate_1.CLI_UNMIGRATABLE_REASONS.PART_OF_PROJECT_ALREADY:
|
|
41
|
+
return en_1.lib.migrate.errors.unmigratableReasons.partOfProjectAlready;
|
|
34
42
|
default:
|
|
35
|
-
return
|
|
36
|
-
reasonCode,
|
|
37
|
-
});
|
|
43
|
+
return en_1.lib.migrate.errors.unmigratableReasons.generic(reasonCode);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
function filterAppsByProjectName(projectConfig) {
|
|
47
|
+
return (app) => {
|
|
48
|
+
if (projectConfig) {
|
|
49
|
+
return app.projectName === projectConfig?.projectConfig?.name;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function buildErrorMessageFromMigrationStatus(error) {
|
|
55
|
+
const { componentErrors, projectErrorDetail } = error;
|
|
56
|
+
if (!componentErrors || !componentErrors.length) {
|
|
57
|
+
return projectErrorDetail;
|
|
58
|
+
}
|
|
59
|
+
return `${projectErrorDetail}: \n\t- ${componentErrors
|
|
60
|
+
.map(componentError => {
|
|
61
|
+
const { componentType, errorMessage, developerSymbol: uid, } = componentError;
|
|
62
|
+
return `${componentType}${uid ? ` (${uid})` : ''}: ${errorMessage}`;
|
|
63
|
+
})
|
|
64
|
+
.join('\n\t- ')}`;
|
|
65
|
+
}
|
|
66
|
+
async function fetchMigrationApps(appId, derivedAccountId, platformVersion, projectConfig) {
|
|
67
|
+
const { data: { migratableApps, unmigratableApps }, } = await (0, migrate_1.listAppsForMigration)(derivedAccountId, platformVersion);
|
|
68
|
+
const filteredMigratableApps = migratableApps.filter(filterAppsByProjectName(projectConfig));
|
|
69
|
+
const filteredUnmigratableApps = unmigratableApps.filter(filterAppsByProjectName(projectConfig));
|
|
70
|
+
const allApps = [...filteredMigratableApps, ...filteredUnmigratableApps];
|
|
71
|
+
if (allApps.length > 1 && projectConfig) {
|
|
72
|
+
throw new Error(en_1.lib.migrate.errors.project.multipleApps);
|
|
73
|
+
}
|
|
74
|
+
if (!projectConfig?.projectConfig) {
|
|
75
|
+
allApps.forEach(app => {
|
|
76
|
+
if (app.projectName) {
|
|
77
|
+
app.isMigratable = false;
|
|
78
|
+
app.unmigratableReason =
|
|
79
|
+
migrate_1.CLI_UNMIGRATABLE_REASONS.PART_OF_PROJECT_ALREADY;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (allApps.length === 0 && projectConfig) {
|
|
84
|
+
throw new Error(en_1.lib.migrate.errors.noAppsForProject(projectConfig?.projectConfig?.name || ''));
|
|
85
|
+
}
|
|
86
|
+
if (allApps.length === 0 || !allApps.some(app => app.isMigratable)) {
|
|
87
|
+
const reasons = filteredUnmigratableApps.map(app => `${chalk_1.default.bold(app.appName)}: ${getUnmigratableReason(app.unmigratableReason, app.projectName, derivedAccountId)}`);
|
|
88
|
+
throw new Error(en_1.lib.migrate.errors.noAppsEligible((0, ui_1.uiAccountDescription)(derivedAccountId), reasons));
|
|
50
89
|
}
|
|
51
90
|
if (appId &&
|
|
52
91
|
!allApps.some(app => {
|
|
53
92
|
return app.appId === appId;
|
|
54
93
|
})) {
|
|
55
|
-
throw new Error(
|
|
56
|
-
appId,
|
|
57
|
-
}));
|
|
94
|
+
throw new Error(en_1.lib.migrate.errors.appWithAppIdNotFound(appId));
|
|
58
95
|
}
|
|
96
|
+
return allApps;
|
|
97
|
+
}
|
|
98
|
+
async function promptForAppToMigrate(allApps, derivedAccountId) {
|
|
59
99
|
const appChoices = allApps.map(app => ({
|
|
60
100
|
name: app.isMigratable
|
|
61
101
|
? app.appName
|
|
@@ -63,66 +103,120 @@ async function handleMigrationSetup(derivedAccountId, options) {
|
|
|
63
103
|
value: app,
|
|
64
104
|
disabled: app.isMigratable
|
|
65
105
|
? false
|
|
66
|
-
: getUnmigratableReason(app.unmigratableReason),
|
|
106
|
+
: getUnmigratableReason(app.unmigratableReason, app.projectName, derivedAccountId),
|
|
67
107
|
}));
|
|
108
|
+
const enabledChoices = appChoices.filter(app => !app.disabled);
|
|
109
|
+
const disabledChoices = appChoices.filter(app => app.disabled);
|
|
110
|
+
const { appId: selectedAppId } = await (0, promptUtils_1.listPrompt)(en_1.lib.migrate.prompt.chooseApp, {
|
|
111
|
+
choices: [
|
|
112
|
+
...enabledChoices,
|
|
113
|
+
new inquirer.Separator(),
|
|
114
|
+
...disabledChoices,
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
return selectedAppId;
|
|
118
|
+
}
|
|
119
|
+
async function selectAppToMigrate(allApps, derivedAccountId, appId) {
|
|
120
|
+
if (appId &&
|
|
121
|
+
!allApps.some(app => {
|
|
122
|
+
return app.appId === appId;
|
|
123
|
+
})) {
|
|
124
|
+
throw new Error(en_1.lib.migrate.errors.appWithAppIdNotFound(appId));
|
|
125
|
+
}
|
|
68
126
|
let appIdToMigrate = appId;
|
|
69
127
|
if (!appIdToMigrate) {
|
|
70
|
-
|
|
71
|
-
choices: appChoices,
|
|
72
|
-
});
|
|
73
|
-
appIdToMigrate = selectedAppId;
|
|
128
|
+
appIdToMigrate = await promptForAppToMigrate(allApps, derivedAccountId);
|
|
74
129
|
}
|
|
75
130
|
const selectedApp = allApps.find(app => app.appId === appIdToMigrate);
|
|
76
|
-
const migratableComponents =
|
|
77
|
-
const unmigratableComponents =
|
|
131
|
+
const migratableComponents = new Set();
|
|
132
|
+
const unmigratableComponents = new Set();
|
|
78
133
|
selectedApp?.migrationComponents.forEach(component => {
|
|
79
134
|
if (component.isSupported) {
|
|
80
|
-
migratableComponents.
|
|
135
|
+
migratableComponents.add((0, transform_1.mapToUserFacingType)(component.componentType));
|
|
81
136
|
}
|
|
82
137
|
else {
|
|
83
|
-
unmigratableComponents.
|
|
138
|
+
unmigratableComponents.add((0, transform_1.mapToUserFacingType)(component.componentType));
|
|
84
139
|
}
|
|
85
140
|
});
|
|
86
|
-
if (migratableComponents.
|
|
87
|
-
logger_1.
|
|
88
|
-
components: `\n - ${migratableComponents.join('\n - ')}`,
|
|
89
|
-
}));
|
|
141
|
+
if (migratableComponents.size !== 0) {
|
|
142
|
+
logger_1.uiLogger.log(en_1.lib.migrate.componentsToBeMigrated(`\n - ${[...migratableComponents].join('\n - ')}`));
|
|
90
143
|
}
|
|
91
|
-
if (unmigratableComponents.
|
|
92
|
-
logger_1.
|
|
93
|
-
components: `\n - ${unmigratableComponents.join('\n - ')}`,
|
|
94
|
-
}));
|
|
144
|
+
if (unmigratableComponents.size !== 0) {
|
|
145
|
+
logger_1.uiLogger.log(en_1.lib.migrate.componentsThatWillNotBeMigrated(`\n - ${[...unmigratableComponents].join('\n - ')}`));
|
|
95
146
|
}
|
|
96
|
-
logger_1.
|
|
97
|
-
const proceed = await (0, promptUtils_1.confirmPrompt)(
|
|
147
|
+
logger_1.uiLogger.log('');
|
|
148
|
+
const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.migrate.prompt.proceed, {
|
|
149
|
+
defaultAnswer: false,
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
proceed,
|
|
153
|
+
appIdToMigrate,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
async function handleMigrationSetup(derivedAccountId, options, projectConfig) {
|
|
157
|
+
const { name, dest, appId } = options;
|
|
158
|
+
const allApps = await fetchMigrationApps(appId, derivedAccountId, options.platformVersion, projectConfig);
|
|
159
|
+
const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, derivedAccountId, appId);
|
|
98
160
|
if (!proceed) {
|
|
99
161
|
return {};
|
|
100
162
|
}
|
|
163
|
+
// If it's a project we don't want to prompt for dest and name, so just return early
|
|
164
|
+
if (projectConfig &&
|
|
165
|
+
projectConfig?.projectConfig &&
|
|
166
|
+
projectConfig?.projectDir) {
|
|
167
|
+
return {
|
|
168
|
+
appIdToMigrate,
|
|
169
|
+
projectName: projectConfig.projectConfig.name,
|
|
170
|
+
projectDest: projectConfig.projectDir,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
101
173
|
const projectName = name ||
|
|
102
|
-
(await (0, promptUtils_1.inputPrompt)(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
174
|
+
(await (0, promptUtils_1.inputPrompt)(en_1.lib.migrate.prompt.inputName, {
|
|
175
|
+
validate: async (input) => {
|
|
176
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, input, { allowCreate: false, noLogs: true });
|
|
177
|
+
if (projectExists) {
|
|
178
|
+
return en_1.lib.migrate.errors.project.alreadyExists(input);
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
},
|
|
107
182
|
}));
|
|
183
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectName, { allowCreate: false, noLogs: true });
|
|
184
|
+
if (projectExists) {
|
|
185
|
+
throw new Error(en_1.lib.migrate.errors.project.alreadyExists(projectName));
|
|
108
186
|
}
|
|
109
187
|
const projectDest = dest ||
|
|
110
|
-
(await (0, promptUtils_1.inputPrompt)(
|
|
188
|
+
(await (0, promptUtils_1.inputPrompt)(en_1.lib.migrate.prompt.inputDest, {
|
|
111
189
|
defaultAnswer: path_1.default.resolve((0, path_2.getCwd)(), (0, path_2.sanitizeFileName)(projectName)),
|
|
112
190
|
}));
|
|
113
191
|
return { appIdToMigrate, projectName, projectDest };
|
|
114
192
|
}
|
|
115
193
|
async function beginMigration(derivedAccountId, appId, platformVersion) {
|
|
116
194
|
SpinniesManager_1.default.add('beginningMigration', {
|
|
117
|
-
text:
|
|
195
|
+
text: en_1.lib.migrate.spinners.beginningMigration,
|
|
118
196
|
});
|
|
119
197
|
const uidMap = {};
|
|
120
198
|
const { data } = await (0, migrate_1.initializeMigration)(derivedAccountId, appId, platformVersion);
|
|
121
199
|
const { migrationId } = data;
|
|
122
|
-
|
|
200
|
+
let pollResponse;
|
|
201
|
+
try {
|
|
202
|
+
pollResponse = await pollMigrationStatus(derivedAccountId, migrationId, [
|
|
203
|
+
Migration_1.MIGRATION_STATUS.INPUT_REQUIRED,
|
|
204
|
+
]);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
SpinniesManager_1.default.fail('beginningMigration', {
|
|
208
|
+
text: en_1.lib.migrate.spinners.unableToStartMigration,
|
|
209
|
+
});
|
|
210
|
+
if ((0, migrate_1.isMigrationStatus)(error) && error.status === Migration_1.MIGRATION_STATUS.FAILURE) {
|
|
211
|
+
throw new Error(buildErrorMessageFromMigrationStatus(error));
|
|
212
|
+
}
|
|
213
|
+
throw new Error(en_1.lib.migrate.errors.migrationFailed, {
|
|
214
|
+
cause: error,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
123
217
|
if (pollResponse.status !== Migration_1.MIGRATION_STATUS.INPUT_REQUIRED) {
|
|
124
218
|
SpinniesManager_1.default.fail('beginningMigration', {
|
|
125
|
-
text:
|
|
219
|
+
text: en_1.lib.migrate.spinners.unableToStartMigration,
|
|
126
220
|
});
|
|
127
221
|
return;
|
|
128
222
|
}
|
|
@@ -131,18 +225,16 @@ async function beginMigration(derivedAccountId, appId, platformVersion) {
|
|
|
131
225
|
if (Object.values(componentsRequiringUids).length !== 0) {
|
|
132
226
|
for (const [componentId, component] of Object.entries(componentsRequiringUids)) {
|
|
133
227
|
const { componentHint, componentType } = component;
|
|
134
|
-
uidMap[componentId] = await (0, promptUtils_1.inputPrompt)(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
: componentType,
|
|
138
|
-
}), {
|
|
228
|
+
uidMap[componentId] = await (0, promptUtils_1.inputPrompt)(en_1.lib.migrate.prompt.uidForComponent(componentHint
|
|
229
|
+
? `${(0, transform_1.mapToUserFacingType)(componentType)} '${componentHint}'`
|
|
230
|
+
: (0, transform_1.mapToUserFacingType)(componentType)), {
|
|
139
231
|
validate: (uid) => {
|
|
140
232
|
const result = (0, project_parsing_lib_1.validateUid)(uid);
|
|
141
233
|
return result === undefined ? true : result;
|
|
142
234
|
},
|
|
143
|
-
defaultAnswer:
|
|
144
|
-
.
|
|
145
|
-
|
|
235
|
+
defaultAnswer: componentHint
|
|
236
|
+
? componentHint.replace(/[^A-Za-z0-9_\-.]/g, '')
|
|
237
|
+
: undefined,
|
|
146
238
|
});
|
|
147
239
|
}
|
|
148
240
|
}
|
|
@@ -158,7 +250,7 @@ async function finalizeMigration(derivedAccountId, migrationId, uidMap, projectN
|
|
|
158
250
|
let pollResponse;
|
|
159
251
|
try {
|
|
160
252
|
SpinniesManager_1.default.add('finishingMigration', {
|
|
161
|
-
text:
|
|
253
|
+
text: en_1.lib.migrate.spinners.finishingMigration,
|
|
162
254
|
});
|
|
163
255
|
await (0, migrate_1.continueMigration)(derivedAccountId, migrationId, uidMap, projectName);
|
|
164
256
|
pollResponse = await pollMigrationStatus(derivedAccountId, migrationId, [
|
|
@@ -167,55 +259,78 @@ async function finalizeMigration(derivedAccountId, migrationId, uidMap, projectN
|
|
|
167
259
|
}
|
|
168
260
|
catch (error) {
|
|
169
261
|
SpinniesManager_1.default.fail('finishingMigration', {
|
|
170
|
-
text:
|
|
262
|
+
text: en_1.lib.migrate.spinners.migrationFailed,
|
|
263
|
+
});
|
|
264
|
+
if ((0, migrate_1.isMigrationStatus)(error) && error.status === Migration_1.MIGRATION_STATUS.FAILURE) {
|
|
265
|
+
throw new Error(buildErrorMessageFromMigrationStatus(error));
|
|
266
|
+
}
|
|
267
|
+
throw new Error(en_1.lib.migrate.errors.migrationFailed, {
|
|
268
|
+
cause: error,
|
|
171
269
|
});
|
|
172
|
-
|
|
270
|
+
}
|
|
271
|
+
if (pollResponse.status !== Migration_1.MIGRATION_STATUS.SUCCESS) {
|
|
272
|
+
throw new Error(en_1.lib.migrate.errors.migrationFailed);
|
|
173
273
|
}
|
|
174
274
|
if (pollResponse.status === Migration_1.MIGRATION_STATUS.SUCCESS) {
|
|
175
275
|
SpinniesManager_1.default.succeed('finishingMigration', {
|
|
176
|
-
text:
|
|
276
|
+
text: en_1.lib.migrate.spinners.migrationComplete,
|
|
177
277
|
});
|
|
178
|
-
return pollResponse.buildId;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
SpinniesManager_1.default.fail('finishingMigration', {
|
|
182
|
-
text: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.spinners.migrationFailed`),
|
|
183
|
-
});
|
|
184
|
-
if (pollResponse.status === Migration_1.MIGRATION_STATUS.FAILURE) {
|
|
185
|
-
logger_1.logger.error(pollResponse.componentErrorDetails);
|
|
186
|
-
throw new Error(pollResponse.projectErrorsDetail);
|
|
187
|
-
}
|
|
188
|
-
throw new Error((0, lang_1.i18n)('commands.project.subcommands.migrateApp.errors.migrationFailed'));
|
|
189
278
|
}
|
|
279
|
+
return pollResponse.buildId;
|
|
190
280
|
}
|
|
191
|
-
async function downloadProjectFiles(derivedAccountId, projectName, buildId, projectDest) {
|
|
281
|
+
async function downloadProjectFiles(derivedAccountId, projectName, buildId, projectDest, projectConfig) {
|
|
192
282
|
try {
|
|
193
283
|
SpinniesManager_1.default.add('fetchingMigratedProject', {
|
|
194
|
-
text:
|
|
284
|
+
text: en_1.lib.migrate.spinners.downloadingProjectContents,
|
|
195
285
|
});
|
|
196
286
|
const { data: zippedProject } = await (0, projects_2.downloadProject)(derivedAccountId, projectName, buildId);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
287
|
+
let absoluteDestPath;
|
|
288
|
+
if (projectConfig?.projectConfig && projectConfig?.projectDir) {
|
|
289
|
+
const { projectDir } = projectConfig;
|
|
290
|
+
absoluteDestPath = projectDir;
|
|
291
|
+
const { srcDir } = projectConfig.projectConfig;
|
|
292
|
+
const archiveDest = path_1.default.join(projectDir, 'archive');
|
|
293
|
+
// Move the existing source directory to archive
|
|
294
|
+
fs_1.default.renameSync(path_1.default.join(projectDir, srcDir), archiveDest);
|
|
295
|
+
logger_1.uiLogger.info(en_1.lib.migrate.sourceContentsMoved(archiveDest));
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
absoluteDestPath = projectDest
|
|
299
|
+
? path_1.default.resolve((0, path_2.getCwd)(), projectDest)
|
|
300
|
+
: (0, path_2.getCwd)();
|
|
301
|
+
}
|
|
200
302
|
await (0, archive_1.extractZipArchive)(zippedProject, (0, path_2.sanitizeFileName)(projectName), absoluteDestPath, {
|
|
201
303
|
includesRootDir: true,
|
|
202
|
-
hideLogs:
|
|
304
|
+
hideLogs: true,
|
|
203
305
|
});
|
|
204
306
|
SpinniesManager_1.default.succeed('fetchingMigratedProject', {
|
|
205
|
-
text:
|
|
307
|
+
text: en_1.lib.migrate.spinners.downloadingProjectContentsComplete,
|
|
206
308
|
});
|
|
207
|
-
logger_1.
|
|
309
|
+
logger_1.uiLogger.success(`Saved ${projectName} to ${projectDest}`);
|
|
208
310
|
}
|
|
209
311
|
catch (error) {
|
|
210
312
|
SpinniesManager_1.default.fail('fetchingMigratedProject', {
|
|
211
|
-
text:
|
|
313
|
+
text: en_1.lib.migrate.spinners.downloadingProjectContentsFailed,
|
|
212
314
|
});
|
|
213
315
|
throw error;
|
|
214
316
|
}
|
|
215
317
|
}
|
|
216
|
-
async function migrateApp2025_2(derivedAccountId, options) {
|
|
318
|
+
async function migrateApp2025_2(derivedAccountId, options, projectConfig) {
|
|
217
319
|
SpinniesManager_1.default.init();
|
|
218
|
-
const
|
|
320
|
+
const ungatedForUnifiedApps = await (0, hasFeature_1.hasFeature)(derivedAccountId, constants_1.FEATURES.UNIFIED_APPS);
|
|
321
|
+
if (!ungatedForUnifiedApps) {
|
|
322
|
+
throw new Error(en_1.lib.migrate.errors.notUngatedForUnifiedApps((0, ui_1.uiAccountDescription)(derivedAccountId)));
|
|
323
|
+
}
|
|
324
|
+
if (projectConfig) {
|
|
325
|
+
if (!projectConfig?.projectConfig || !projectConfig?.projectDir) {
|
|
326
|
+
throw new Error(en_1.lib.migrate.errors.project.invalidConfig);
|
|
327
|
+
}
|
|
328
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectConfig.projectConfig.name, { allowCreate: false, noLogs: true });
|
|
329
|
+
if (!projectExists) {
|
|
330
|
+
throw new Error(en_1.lib.migrate.errors.project.doesNotExist(derivedAccountId));
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const { appIdToMigrate, projectName, projectDest } = await handleMigrationSetup(derivedAccountId, options, projectConfig);
|
|
219
334
|
if (!appIdToMigrate || !projectName || !projectDest) {
|
|
220
335
|
return;
|
|
221
336
|
}
|
|
@@ -224,15 +339,14 @@ async function migrateApp2025_2(derivedAccountId, options) {
|
|
|
224
339
|
return;
|
|
225
340
|
}
|
|
226
341
|
const { migrationId, uidMap } = migrationInProgress;
|
|
227
|
-
const buildId = await finalizeMigration(derivedAccountId, migrationId, uidMap, projectName);
|
|
228
|
-
await downloadProjectFiles(derivedAccountId, projectName, buildId, projectDest);
|
|
342
|
+
const buildId = await finalizeMigration(derivedAccountId, migrationId, uidMap, projectConfig?.projectConfig?.name || projectName);
|
|
343
|
+
await downloadProjectFiles(derivedAccountId, projectName, buildId, projectDest, projectConfig);
|
|
344
|
+
logger_1.uiLogger.log((0, ui_1.uiLink)('Project Details', (0, urls_1.getProjectDetailUrl)(projectName, derivedAccountId)));
|
|
345
|
+
logger_1.uiLogger.log((0, ui_1.uiLink)('Build Details', (0, urls_1.getProjectBuildDetailUrl)(projectName, buildId, derivedAccountId)));
|
|
229
346
|
}
|
|
230
|
-
function logInvalidAccountError(
|
|
347
|
+
function logInvalidAccountError() {
|
|
231
348
|
(0, ui_1.uiLine)();
|
|
232
|
-
logger_1.
|
|
233
|
-
logger_1.
|
|
234
|
-
useCommand: (0, ui_1.uiCommandReference)('hs accounts use'),
|
|
235
|
-
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
236
|
-
}));
|
|
349
|
+
logger_1.uiLogger.error(en_1.lib.migrate.errors.invalidAccountTypeTitle);
|
|
350
|
+
logger_1.uiLogger.log(en_1.lib.migrate.errors.invalidAccountTypeDescription((0, ui_1.uiCommandReference)('hs account use'), (0, ui_1.uiCommandReference)('hs auth')));
|
|
237
351
|
(0, ui_1.uiLine)();
|
|
238
352
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
2
|
import { ArgumentsCamelCase } from 'yargs';
|
|
3
|
-
import {
|
|
4
|
-
export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<
|
|
3
|
+
import { MigrateAppArgs } from './migrate';
|
|
4
|
+
export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppArgs>, accountConfig: CLIAccount): Promise<void>;
|
|
@@ -19,7 +19,7 @@ const lang_1 = require("../lang");
|
|
|
19
19
|
const accountTypes_1 = require("../accountTypes");
|
|
20
20
|
const selectPublicAppPrompt_1 = require("../prompts/selectPublicAppPrompt");
|
|
21
21
|
const createProjectPrompt_1 = require("../prompts/createProjectPrompt");
|
|
22
|
-
const
|
|
22
|
+
const ensureProjectExists_1 = require("../projects/ensureProjectExists");
|
|
23
23
|
const usageTracking_1 = require("../usageTracking");
|
|
24
24
|
const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
25
25
|
const process_1 = require("../process");
|
|
@@ -27,17 +27,20 @@ const polling_1 = require("../polling");
|
|
|
27
27
|
const migrate_1 = require("./migrate");
|
|
28
28
|
async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
|
|
29
29
|
const accountName = (0, ui_1.uiAccountDescription)(derivedAccountId);
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const defaultAccountIsUnified = await (0, accountTypes_1.isUnifiedAccount)(accountConfig);
|
|
31
|
+
if (!(0, accountTypes_1.isAppDeveloperAccount)(accountConfig) && !defaultAccountIsUnified) {
|
|
32
|
+
(0, migrate_1.logInvalidAccountError)();
|
|
32
33
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
: await (0, selectPublicAppPrompt_1.selectPublicAppPrompt)({
|
|
35
|
+
let appId = options.appId;
|
|
36
|
+
if (!appId) {
|
|
37
|
+
const { appId: selectAppId } = await (0, selectPublicAppPrompt_1.selectPublicAppPrompt)({
|
|
37
38
|
accountId: derivedAccountId,
|
|
38
39
|
accountName,
|
|
39
40
|
isMigratingApp: true,
|
|
40
41
|
});
|
|
42
|
+
appId = selectAppId;
|
|
43
|
+
}
|
|
41
44
|
try {
|
|
42
45
|
const { data: selectedApp } = await (0, appsDev_1.fetchPublicAppMetadata)(appId, derivedAccountId);
|
|
43
46
|
// preventProjectMigrations returns true if we have not added app to allowlist config.
|
|
@@ -57,7 +60,7 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
|
|
|
57
60
|
}
|
|
58
61
|
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(options);
|
|
59
62
|
const { name: projectName, dest: projectDest } = createProjectPromptResponse;
|
|
60
|
-
const { projectExists } = await (0,
|
|
63
|
+
const { projectExists } = await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectName, {
|
|
61
64
|
allowCreate: false,
|
|
62
65
|
noLogs: true,
|
|
63
66
|
});
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
2
2
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
3
|
-
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
4
3
|
import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
4
|
import { SandboxAccountType } from '../types/Sandboxes';
|
|
6
5
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
|
-
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<
|
|
6
|
+
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number): Promise<number>;
|
|
8
7
|
type SandboxAccount = SandboxResponse & {
|
|
9
8
|
name: string;
|
|
10
9
|
};
|
package/lib/buildAccount.js
CHANGED
|
@@ -61,49 +61,50 @@ async function saveAccountToConfig(accountId, accountName, env, personalAccessKe
|
|
|
61
61
|
return validName;
|
|
62
62
|
}
|
|
63
63
|
async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit) {
|
|
64
|
-
const i18nKey = 'lib.developerTestAccount.create.loading';
|
|
65
64
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(parentAccountConfig);
|
|
66
65
|
const parentAccountId = (0, config_1.getAccountId)(id);
|
|
67
66
|
if (!parentAccountId) {
|
|
68
|
-
throw new Error((0, lang_1.i18n)(
|
|
67
|
+
throw new Error((0, lang_1.i18n)(`lib.developerTestAccount.create.loading.fail`));
|
|
69
68
|
}
|
|
70
69
|
SpinniesManager_1.default.init({
|
|
71
70
|
succeedColor: 'white',
|
|
72
71
|
});
|
|
73
72
|
logger_1.logger.log('');
|
|
74
73
|
SpinniesManager_1.default.add('buildDeveloperTestAccount', {
|
|
75
|
-
text: (0, lang_1.i18n)(
|
|
74
|
+
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.add`, {
|
|
76
75
|
accountName: testAccountName,
|
|
77
76
|
}),
|
|
78
77
|
});
|
|
79
|
-
let
|
|
78
|
+
let developerTestAccountId;
|
|
79
|
+
let developerTestAccountPersonalAccessKey;
|
|
80
80
|
try {
|
|
81
81
|
const { data } = await (0, developerTestAccounts_1.createDeveloperTestAccount)(parentAccountId, testAccountName);
|
|
82
|
-
|
|
82
|
+
developerTestAccountId = data.id;
|
|
83
|
+
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
83
84
|
SpinniesManager_1.default.succeed('buildDeveloperTestAccount', {
|
|
84
|
-
text: (0, lang_1.i18n)(
|
|
85
|
+
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.succeed`, {
|
|
85
86
|
accountName: testAccountName,
|
|
86
|
-
accountId:
|
|
87
|
+
accountId: developerTestAccountId,
|
|
87
88
|
}),
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
catch (e) {
|
|
91
92
|
(0, index_1.debugError)(e);
|
|
92
93
|
SpinniesManager_1.default.fail('buildDeveloperTestAccount', {
|
|
93
|
-
text: (0, lang_1.i18n)(
|
|
94
|
+
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.fail`, {
|
|
94
95
|
accountName: testAccountName,
|
|
95
96
|
}),
|
|
96
97
|
});
|
|
97
98
|
(0, developerTestAccounts_2.handleDeveloperTestAccountCreateError)(e, parentAccountId, env, portalLimit);
|
|
98
99
|
}
|
|
99
100
|
try {
|
|
100
|
-
await saveAccountToConfig(
|
|
101
|
+
await saveAccountToConfig(developerTestAccountId, testAccountName, env, developerTestAccountPersonalAccessKey);
|
|
101
102
|
}
|
|
102
103
|
catch (err) {
|
|
103
104
|
(0, index_1.logError)(err);
|
|
104
105
|
throw err;
|
|
105
106
|
}
|
|
106
|
-
return
|
|
107
|
+
return developerTestAccountId;
|
|
107
108
|
}
|
|
108
109
|
async function buildSandbox(sandboxName, parentAccountConfig, sandboxType, env, force = false) {
|
|
109
110
|
let i18nKey;
|
package/lib/commonOpts.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Argv, Arguments } from 'yargs';
|
|
2
2
|
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
|
|
3
3
|
import { ConfigArgs } from '../types/Yargs';
|
|
4
|
-
export declare function addGlobalOptions(yargs: Argv): Argv<{
|
|
5
|
-
debug: boolean;
|
|
6
|
-
}>;
|
|
4
|
+
export declare function addGlobalOptions(yargs: Argv): Argv<{}>;
|
|
7
5
|
export declare function addAccountOptions(yargs: Argv): Argv;
|
|
8
6
|
export declare function addConfigOptions(yargs: Argv): Argv<ConfigArgs>;
|
|
9
7
|
export declare function addOverwriteOptions(yargs: Argv): Argv;
|
|
@@ -13,9 +11,10 @@ export declare function addCmsPublishModeOptions(yargs: Argv, { read, write }: {
|
|
|
13
11
|
}): Argv;
|
|
14
12
|
export declare function addTestingOptions(yargs: Argv): Argv;
|
|
15
13
|
export declare function addUseEnvironmentOptions(yargs: Argv): Argv;
|
|
16
|
-
export declare function addCustomHelpOutput(yargs: Argv, command: string, describe
|
|
14
|
+
export declare function addCustomHelpOutput(yargs: Argv, command: string | string[], describe?: string): Promise<void>;
|
|
17
15
|
export declare function setLogLevel(options: Arguments<{
|
|
18
16
|
debug?: boolean;
|
|
17
|
+
networkDebug?: boolean;
|
|
19
18
|
}>): void;
|
|
20
19
|
export declare function getCommandName(argv: Arguments<{
|
|
21
20
|
_?: string[];
|