@hubspot/cli 7.4.6-beta.0 → 7.4.7-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/commands/app/migrate.d.ts +2 -1
- package/commands/app/migrate.js +45 -41
- package/commands/cms/lighthouseScore.js +1 -1
- package/commands/project/migrate.js +9 -4
- package/commands/project/migrateApp.js +2 -1
- package/commands/project/upload.js +11 -6
- package/commands/project/watch.js +8 -3
- package/lang/en.d.ts +16 -11
- package/lang/en.js +16 -13
- package/lang/en.lyaml +0 -3
- package/lib/app/migrate.js +15 -16
- package/lib/buildAccount.js +4 -5
- package/lib/commonOpts.js +7 -8
- package/lib/configOptions.js +11 -10
- package/lib/doctor/Diagnosis.js +10 -11
- package/lib/doctor/Doctor.js +42 -47
- package/lib/errorHandlers/index.js +6 -7
- package/lib/errorHandlers/suppressError.js +6 -7
- package/lib/generateSelectors.js +1 -2
- package/lib/middleware/fireAlarmMiddleware.js +7 -21
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projects/ProjectLogsManager.js +2 -2
- package/lib/projects/buildAndDeploy.js +17 -17
- package/lib/projects/config.js +8 -8
- package/lib/projects/create.js +4 -4
- package/lib/projects/ensureProjectExists.js +3 -3
- package/lib/projects/localDev/DevServerManager.js +2 -1
- package/lib/projects/localDev/LocalDevManager.js +26 -25
- package/lib/projects/localDev/LocalDevManagerV2.js +24 -23
- package/lib/projects/localDev/helpers.d.ts +1 -1
- package/lib/projects/localDev/helpers.js +46 -36
- package/lib/projects/ui.js +3 -3
- package/lib/projects/upload.d.ts +12 -1
- package/lib/projects/upload.js +14 -9
- package/lib/projects/watch.js +16 -16
- 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.js +9 -10
- 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 +3 -4
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- 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/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.js +10 -16
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArgumentsCamelCase } from 'yargs';
|
|
2
2
|
import { YargsCommandModule } from '../../types/Yargs';
|
|
3
3
|
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function handlerGenerator(commandTrackingName: string): (options: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
5
|
+
export declare const handler: (options: ArgumentsCamelCase<MigrateAppArgs>) => Promise<void>;
|
|
5
6
|
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
6
7
|
export default migrateCommand;
|
package/commands/app/migrate.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handler =
|
|
3
|
+
exports.handler = void 0;
|
|
4
|
+
exports.handlerGenerator = handlerGenerator;
|
|
4
5
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
6
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
6
7
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
@@ -16,49 +17,52 @@ const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
|
16
17
|
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
17
18
|
const command = 'migrate';
|
|
18
19
|
const describe = undefined; // uiBetaTag(i18n(`commands.project.subcommands.migrateApp.header.text.describe`), false);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
logger_1.logger.log('');
|
|
28
|
-
logger_1.logger.log((0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.text`), false));
|
|
29
|
-
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.link`), 'https://developers.hubspot.com/docs/platform/migrate-a-public-app-to-projects'));
|
|
30
|
-
logger_1.logger.log('');
|
|
31
|
-
try {
|
|
32
|
-
if (platformVersion === v2025_2 || unstable) {
|
|
33
|
-
if ((0, config_2.getIsInProject)()) {
|
|
34
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
35
|
-
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
36
|
-
}
|
|
37
|
-
options.platformVersion = unstable
|
|
38
|
-
? projects_1.PLATFORM_VERSIONS.unstable
|
|
39
|
-
: platformVersion;
|
|
40
|
-
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId, options, accountConfig);
|
|
20
|
+
function handlerGenerator(commandTrackingName) {
|
|
21
|
+
return async function handler(options) {
|
|
22
|
+
const { derivedAccountId, platformVersion, unstable } = options;
|
|
23
|
+
await (0, usageTracking_1.trackCommandUsage)(commandTrackingName, {}, derivedAccountId);
|
|
24
|
+
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
25
|
+
if (!accountConfig) {
|
|
26
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.noAccountConfig`));
|
|
27
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
44
28
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
logger_1.logger.log('');
|
|
30
|
+
logger_1.logger.log((0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.text`), false));
|
|
31
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.header.link`), 'https://developers.hubspot.com/docs/platform/migrate-a-public-app-to-projects'));
|
|
32
|
+
logger_1.logger.log('');
|
|
33
|
+
try {
|
|
34
|
+
if (platformVersion === v2025_2 || unstable) {
|
|
35
|
+
if ((0, config_2.getIsInProject)()) {
|
|
36
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
37
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
|
+
}
|
|
39
|
+
options.platformVersion = unstable
|
|
40
|
+
? projects_1.PLATFORM_VERSIONS.unstable
|
|
41
|
+
: platformVersion;
|
|
42
|
+
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
await (0, migrate_legacy_1.migrateApp2023_2)(derivedAccountId, options, accountConfig);
|
|
46
|
+
}
|
|
52
47
|
}
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error &&
|
|
50
|
+
typeof error === 'object' &&
|
|
51
|
+
'errors' in error &&
|
|
52
|
+
Array.isArray(error.errors)) {
|
|
53
|
+
error.errors.forEach(err => (0, errorHandlers_1.logError)(err));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
(0, errorHandlers_1.logError)(error, new errorHandlers_1.ApiErrorContext({ accountId: derivedAccountId }));
|
|
57
|
+
}
|
|
58
|
+
await (0, usageTracking_1.trackCommandMetadataUsage)(commandTrackingName, { successful: false }, derivedAccountId);
|
|
59
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
55
60
|
}
|
|
56
|
-
await (0, usageTracking_1.trackCommandMetadataUsage)(
|
|
57
|
-
return process.exit(exitCodes_1.EXIT_CODES.
|
|
58
|
-
}
|
|
59
|
-
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: true }, derivedAccountId);
|
|
60
|
-
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
61
|
+
await (0, usageTracking_1.trackCommandMetadataUsage)(commandTrackingName, { successful: true }, derivedAccountId);
|
|
62
|
+
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
63
|
+
};
|
|
61
64
|
}
|
|
65
|
+
exports.handler = handlerGenerator('app-migrate');
|
|
62
66
|
function appMigrateBuilder(yargs) {
|
|
63
67
|
yargs.options({
|
|
64
68
|
name: {
|
|
@@ -102,7 +106,7 @@ const builder = (0, yargsUtils_1.makeYargsBuilder)(appMigrateBuilder, command, (
|
|
|
102
106
|
const migrateCommand = {
|
|
103
107
|
command,
|
|
104
108
|
describe,
|
|
105
|
-
handler,
|
|
109
|
+
handler: exports.handler,
|
|
106
110
|
builder,
|
|
107
111
|
};
|
|
108
112
|
exports.default = migrateCommand;
|
|
@@ -20,7 +20,7 @@ const DEFAULT_TABLE_HEADER = [
|
|
|
20
20
|
'SEO',
|
|
21
21
|
];
|
|
22
22
|
exports.command = 'lighthouse-score [--theme]';
|
|
23
|
-
exports.describe = false;
|
|
23
|
+
exports.describe = false;
|
|
24
24
|
const selectTheme = async (accountId) => {
|
|
25
25
|
const { theme: selectedTheme } = await promptUser([
|
|
26
26
|
{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
4
3
|
const migrate_1 = require("../../lib/app/migrate");
|
|
5
4
|
const config_1 = require("../../lib/projects/config");
|
|
6
5
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
@@ -9,6 +8,8 @@ const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
|
9
8
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
10
9
|
const ui_1 = require("../../lib/ui");
|
|
11
10
|
const en_1 = require("../../lang/en");
|
|
11
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
12
|
+
const boxen_1 = require("../../lib/ui/boxen");
|
|
12
13
|
const { v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
13
14
|
const command = 'migrate';
|
|
14
15
|
const describe = undefined; // commands.project.migrate.describe
|
|
@@ -16,11 +17,15 @@ async function handler(args) {
|
|
|
16
17
|
const { platformVersion, unstable } = args;
|
|
17
18
|
const projectConfig = await (0, config_1.getProjectConfig)();
|
|
18
19
|
if (!projectConfig.projectConfig) {
|
|
19
|
-
logger_1.
|
|
20
|
+
logger_1.uiLogger.error(en_1.commands.project.migrate.errors.noProjectConfig((0, ui_1.uiCommandReference)('hs app migrate')));
|
|
20
21
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
if (projectConfig?.projectConfig) {
|
|
24
|
+
await (0, boxen_1.logInBox)({
|
|
25
|
+
contents: en_1.lib.migrate.projectMigrationWarning,
|
|
26
|
+
options: { title: en_1.lib.migrate.projectMigrationWarningTitle },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
24
29
|
const { derivedAccountId } = args;
|
|
25
30
|
try {
|
|
26
31
|
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, {
|
|
@@ -16,7 +16,8 @@ async function handler(args) {
|
|
|
16
16
|
oldCommand: (0, ui_1.uiCommandReference)('hs project migrate-app'),
|
|
17
17
|
newCommand: (0, ui_1.uiCommandReference)(`hs app migrate --platform-version=${args.platformVersion}`),
|
|
18
18
|
}));
|
|
19
|
-
|
|
19
|
+
const localHandler = (0, migrate_1.handlerGenerator)('migrate-app');
|
|
20
|
+
await localHandler(args);
|
|
20
21
|
}
|
|
21
22
|
function projectMigrateAppBuilder(yargs) {
|
|
22
23
|
yargs.options({
|
|
@@ -11,7 +11,6 @@ const buildAndDeploy_1 = require("../../lib/projects/buildAndDeploy");
|
|
|
11
11
|
const ui_1 = require("../../lib/ui");
|
|
12
12
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
13
|
const config_2 = require("../../lib/projects/config");
|
|
14
|
-
const ensureProjectExists_1 = require("../../lib/projects/ensureProjectExists");
|
|
15
14
|
const ui_2 = require("../../lib/projects/ui");
|
|
16
15
|
const upload_1 = require("../../lib/projects/upload");
|
|
17
16
|
const buildAndDeploy_2 = require("../../lib/projects/buildAndDeploy");
|
|
@@ -29,12 +28,18 @@ async function handler(args) {
|
|
|
29
28
|
const { projectConfig, projectDir } = await (0, config_2.getProjectConfig)();
|
|
30
29
|
(0, usageTracking_1.trackCommandUsage)('project-upload', { type: accountType }, derivedAccountId);
|
|
31
30
|
(0, config_2.validateProjectConfig)(projectConfig, projectDir);
|
|
32
|
-
await (0, ensureProjectExists_1.ensureProjectExists)(derivedAccountId, projectConfig.name, {
|
|
33
|
-
forceCreate,
|
|
34
|
-
uploadCommand: true,
|
|
35
|
-
});
|
|
36
31
|
try {
|
|
37
|
-
const { result, uploadError } = await (0, upload_1.handleProjectUpload)(
|
|
32
|
+
const { result, uploadError } = await (0, upload_1.handleProjectUpload)({
|
|
33
|
+
accountId: derivedAccountId,
|
|
34
|
+
projectConfig,
|
|
35
|
+
projectDir: projectDir,
|
|
36
|
+
callbackFunc: buildAndDeploy_2.pollProjectBuildAndDeploy,
|
|
37
|
+
uploadMessage: message,
|
|
38
|
+
forceCreate,
|
|
39
|
+
isUploadCommand: true,
|
|
40
|
+
sendIR: (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion),
|
|
41
|
+
skipValidation,
|
|
42
|
+
});
|
|
38
43
|
if (uploadError) {
|
|
39
44
|
if ((0, index_1.isSpecifiedError)(uploadError, {
|
|
40
45
|
subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
@@ -12,7 +12,6 @@ const constants_1 = require("../../lib/constants");
|
|
|
12
12
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
13
|
const config_1 = require("../../lib/projects/config");
|
|
14
14
|
const ui_2 = require("../../lib/projects/ui");
|
|
15
|
-
const ensureProjectExists_1 = require("../../lib/projects/ensureProjectExists");
|
|
16
15
|
const upload_1 = require("../../lib/projects/upload");
|
|
17
16
|
const buildAndDeploy_2 = require("../../lib/projects/buildAndDeploy");
|
|
18
17
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
@@ -76,7 +75,7 @@ async function handler(args) {
|
|
|
76
75
|
}));
|
|
77
76
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
(0, config_1.validateProjectConfig)(projectConfig, projectDir);
|
|
80
79
|
try {
|
|
81
80
|
const { data: { results: builds }, } = await (0, projects_1.fetchProjectBuilds)(derivedAccountId, projectConfig.name);
|
|
82
81
|
const hasNoBuilds = !builds || !builds.length;
|
|
@@ -85,7 +84,13 @@ async function handler(args) {
|
|
|
85
84
|
};
|
|
86
85
|
// Upload all files if no build exists for this project yet
|
|
87
86
|
if (initialUpload || hasNoBuilds) {
|
|
88
|
-
const { uploadError } = await (0, upload_1.handleProjectUpload)(
|
|
87
|
+
const { uploadError } = await (0, upload_1.handleProjectUpload)({
|
|
88
|
+
accountId: derivedAccountId,
|
|
89
|
+
projectConfig,
|
|
90
|
+
projectDir,
|
|
91
|
+
callbackFunc: startWatching,
|
|
92
|
+
isUploadCommand: false,
|
|
93
|
+
});
|
|
89
94
|
if (uploadError) {
|
|
90
95
|
if ((0, index_1.isSpecifiedError)(uploadError, {
|
|
91
96
|
subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
package/lang/en.d.ts
CHANGED
|
@@ -1021,7 +1021,7 @@ export declare const commands: {
|
|
|
1021
1021
|
};
|
|
1022
1022
|
readonly logs: {
|
|
1023
1023
|
readonly processExited: "Stopping watcher...";
|
|
1024
|
-
readonly watchCancelledFromUi:
|
|
1024
|
+
readonly watchCancelledFromUi: `The watch process has been cancelled from the UI. Any changes made since cancelling have not been uploaded. To resume watching, rerun ${string}.`;
|
|
1025
1025
|
readonly resuming: "Resuming watcher...";
|
|
1026
1026
|
readonly uploadSucceeded: (remotePath: string | number, filePath: string | number) => string;
|
|
1027
1027
|
readonly deleteFileSucceeded: (remotePath: string | number) => string;
|
|
@@ -2158,8 +2158,8 @@ export declare const lib: {
|
|
|
2158
2158
|
readonly validateAccountOption: {
|
|
2159
2159
|
readonly invalidPublicAppAccount: `This project contains a public app. The "--account" flag must point to a developer test account to develop this project locally. Alternatively, change your default account to an App Developer Account using ${string} and run ${string} to set up a new Developer Test Account.`;
|
|
2160
2160
|
readonly invalidPrivateAppAccount: `This project contains a private app. The account specified with the "--account" flag points to a developer account, which do not support the local development of private apps. Update the "--account" flag to point to a standard, sandbox, or developer test account, or change your default account by running ${string}.`;
|
|
2161
|
-
readonly nonSandboxWarning:
|
|
2162
|
-
readonly publicAppNonDeveloperTestAccountWarning:
|
|
2161
|
+
readonly nonSandboxWarning: `Testing in a sandbox is strongly recommended. To switch the target account, select an option below or run ${string} before running the command again.`;
|
|
2162
|
+
readonly publicAppNonDeveloperTestAccountWarning: `Local development of public apps is only supported in ${string}.`;
|
|
2163
2163
|
};
|
|
2164
2164
|
readonly createNewProjectForLocalDev: {
|
|
2165
2165
|
readonly projectMustExistExplanation: (projectName: string | number, accountIdentifier: string | number) => string;
|
|
@@ -2193,6 +2193,9 @@ export declare const lib: {
|
|
|
2193
2193
|
readonly srcDirNotFound: (srcDir: string | number, projectDir: string | number) => string;
|
|
2194
2194
|
readonly srcOutsideProjectDir: (projectConfig: string | number, srcDir: string | number) => string;
|
|
2195
2195
|
};
|
|
2196
|
+
readonly getProjectConfig: {
|
|
2197
|
+
readonly error: "Could not read from project config";
|
|
2198
|
+
};
|
|
2196
2199
|
readonly ensureProjectExists: {
|
|
2197
2200
|
readonly createPrompt: (projectName: string | number, accountIdentifier: string | number) => string;
|
|
2198
2201
|
readonly createPromptUpload: (projectName: string | number, accountIdentifier: string | number) => string;
|
|
@@ -2204,11 +2207,14 @@ export declare const lib: {
|
|
|
2204
2207
|
};
|
|
2205
2208
|
readonly logFeedbackMessage: {
|
|
2206
2209
|
readonly feedbackHeader: "We'd love to hear your feedback!";
|
|
2207
|
-
readonly feedbackMessage:
|
|
2210
|
+
readonly feedbackMessage: `How are you liking the new projects and developer tools?
|
|
2211
|
+
> Run ${string} to let us know what you think!
|
|
2212
|
+
`;
|
|
2208
2213
|
};
|
|
2209
2214
|
};
|
|
2210
2215
|
readonly projectBuildAndDeploy: {
|
|
2211
2216
|
readonly makePollTaskStatusFunc: {
|
|
2217
|
+
readonly errorSummary: "See below for a summary of errors.";
|
|
2212
2218
|
readonly componentCountSingular: "Found 1 component in this project\n";
|
|
2213
2219
|
readonly componentCount: (numComponents: string | number) => string;
|
|
2214
2220
|
readonly successStatusText: "DONE";
|
|
@@ -2237,10 +2243,8 @@ export declare const lib: {
|
|
|
2237
2243
|
readonly fileFiltered: (filename: string | number) => string;
|
|
2238
2244
|
};
|
|
2239
2245
|
};
|
|
2240
|
-
readonly
|
|
2241
|
-
readonly
|
|
2242
|
-
readonly failedToLoadBoxen: "Failed to load boxen util.";
|
|
2243
|
-
};
|
|
2246
|
+
readonly boxen: {
|
|
2247
|
+
readonly failedToLoad: "Failed to load boxen util.";
|
|
2244
2248
|
};
|
|
2245
2249
|
readonly ui: {
|
|
2246
2250
|
readonly betaTag: string;
|
|
@@ -2605,7 +2609,7 @@ export declare const lib: {
|
|
|
2605
2609
|
readonly message: "The personal access key you provided doesn't include developer sandbox permissions.";
|
|
2606
2610
|
readonly instructions: (accountName: string | number, url: string | number) => string;
|
|
2607
2611
|
};
|
|
2608
|
-
readonly generic: "An error
|
|
2612
|
+
readonly generic: "An error occurred while creating a developer sandbox";
|
|
2609
2613
|
};
|
|
2610
2614
|
};
|
|
2611
2615
|
readonly standard: {
|
|
@@ -2753,7 +2757,8 @@ export declare const lib: {
|
|
|
2753
2757
|
readonly componentsToBeMigrated: (components: string | number) => string;
|
|
2754
2758
|
readonly componentsThatWillNotBeMigrated: (components: string | number) => string;
|
|
2755
2759
|
readonly sourceContentsMoved: (newLocation: string) => string;
|
|
2756
|
-
readonly
|
|
2760
|
+
readonly projectMigrationWarningTitle: "⚠️ Important: Migrating to platformVersion 2025.2 is irreversible ⚠️";
|
|
2761
|
+
readonly projectMigrationWarning: string;
|
|
2757
2762
|
readonly errors: {
|
|
2758
2763
|
readonly project: {
|
|
2759
2764
|
readonly invalidConfig: "The project configuration file is invalid. Please check the config file and try again.";
|
|
@@ -2770,7 +2775,7 @@ export declare const lib: {
|
|
|
2770
2775
|
readonly generic: (reasonCode: string | number) => string;
|
|
2771
2776
|
};
|
|
2772
2777
|
readonly noAppsEligible: (accountId: string | number, reasons: string[]) => string;
|
|
2773
|
-
readonly invalidAccountTypeTitle:
|
|
2778
|
+
readonly invalidAccountTypeTitle: string;
|
|
2774
2779
|
readonly invalidAccountTypeDescription: (useCommand: string | number, authCommand: string | number) => string;
|
|
2775
2780
|
readonly appWithAppIdNotFound: (appId: string | number) => string;
|
|
2776
2781
|
readonly noAppsForProject: (projectName: string) => string;
|
package/lang/en.js
CHANGED
|
@@ -236,7 +236,7 @@ exports.commands = {
|
|
|
236
236
|
},
|
|
237
237
|
},
|
|
238
238
|
success: {
|
|
239
|
-
moduleDownloaded: (moduleName, path) => `"${moduleName}"
|
|
239
|
+
moduleDownloaded: (moduleName, path) => `"${moduleName}" successfully downloaded to "${path}"`,
|
|
240
240
|
},
|
|
241
241
|
errors: {
|
|
242
242
|
pathExists: path => `Folder already exists at "${path}"`,
|
|
@@ -1029,7 +1029,7 @@ exports.commands = {
|
|
|
1029
1029
|
},
|
|
1030
1030
|
logs: {
|
|
1031
1031
|
processExited: 'Stopping watcher...',
|
|
1032
|
-
watchCancelledFromUi:
|
|
1032
|
+
watchCancelledFromUi: `The watch process has been cancelled from the UI. Any changes made since cancelling have not been uploaded. To resume watching, rerun ${(0, ui_1.uiCommandReference)('hs project watch')}.`,
|
|
1033
1033
|
resuming: 'Resuming watcher...',
|
|
1034
1034
|
uploadSucceeded: (remotePath, filePath) => `Uploaded file "${filePath}" to "${remotePath}"`,
|
|
1035
1035
|
deleteFileSucceeded: remotePath => `Deleted file "${remotePath}"`,
|
|
@@ -2166,8 +2166,8 @@ exports.lib = {
|
|
|
2166
2166
|
validateAccountOption: {
|
|
2167
2167
|
invalidPublicAppAccount: `This project contains a public app. The "--account" flag must point to a developer test account to develop this project locally. Alternatively, change your default account to an App Developer Account using ${(0, ui_1.uiCommandReference)('hs accounts use')} and run ${(0, ui_1.uiCommandReference)('hs project dev')} to set up a new Developer Test Account.`,
|
|
2168
2168
|
invalidPrivateAppAccount: `This project contains a private app. The account specified with the "--account" flag points to a developer account, which do not support the local development of private apps. Update the "--account" flag to point to a standard, sandbox, or developer test account, or change your default account by running ${(0, ui_1.uiCommandReference)('hs accounts use')}.`,
|
|
2169
|
-
nonSandboxWarning:
|
|
2170
|
-
publicAppNonDeveloperTestAccountWarning:
|
|
2169
|
+
nonSandboxWarning: `Testing in a sandbox is strongly recommended. To switch the target account, select an option below or run ${(0, ui_1.uiCommandReference)('hs accounts use')} before running the command again.`,
|
|
2170
|
+
publicAppNonDeveloperTestAccountWarning: `Local development of public apps is only supported in ${chalk_1.default.bold('developer test accounts')}.`,
|
|
2171
2171
|
},
|
|
2172
2172
|
createNewProjectForLocalDev: {
|
|
2173
2173
|
projectMustExistExplanation: (projectName, accountIdentifier) => `The project ${projectName} does not exist in the target account ${accountIdentifier}. This command requires the project to exist in the target account.`,
|
|
@@ -2201,6 +2201,9 @@ exports.lib = {
|
|
|
2201
2201
|
srcDirNotFound: (srcDir, projectDir) => `Project source directory ${chalk_1.default.bold(srcDir)} could not be found in ${chalk_1.default.bold(projectDir)}.`,
|
|
2202
2202
|
srcOutsideProjectDir: (projectConfig, srcDir) => `Invalid value for 'srcDir' in ${projectConfig}: ${chalk_1.default.bold(`srcDir: "${srcDir}"`)}\n\t'srcDir' must be a relative path to a folder under the project root, such as "." or "./src"`,
|
|
2203
2203
|
},
|
|
2204
|
+
getProjectConfig: {
|
|
2205
|
+
error: 'Could not read from project config',
|
|
2206
|
+
},
|
|
2204
2207
|
ensureProjectExists: {
|
|
2205
2208
|
createPrompt: (projectName, accountIdentifier) => `The project ${projectName} does not exist in ${accountIdentifier}. Would you like to create it?`,
|
|
2206
2209
|
createPromptUpload: (projectName, accountIdentifier) => `[--forceCreate] The project ${projectName} does not exist in ${accountIdentifier}. Would you like to create it?`,
|
|
@@ -2212,11 +2215,12 @@ exports.lib = {
|
|
|
2212
2215
|
},
|
|
2213
2216
|
logFeedbackMessage: {
|
|
2214
2217
|
feedbackHeader: "We'd love to hear your feedback!",
|
|
2215
|
-
feedbackMessage:
|
|
2218
|
+
feedbackMessage: `How are you liking the new projects and developer tools? \n > Run ${(0, ui_1.uiCommandReference)('hs feedback')} to let us know what you think!\n`,
|
|
2216
2219
|
},
|
|
2217
2220
|
},
|
|
2218
2221
|
projectBuildAndDeploy: {
|
|
2219
2222
|
makePollTaskStatusFunc: {
|
|
2223
|
+
errorSummary: 'See below for a summary of errors.',
|
|
2220
2224
|
componentCountSingular: 'Found 1 component in this project\n',
|
|
2221
2225
|
componentCount: numComponents => `Found ${numComponents} components in this project\n`,
|
|
2222
2226
|
successStatusText: 'DONE',
|
|
@@ -2245,10 +2249,8 @@ exports.lib = {
|
|
|
2245
2249
|
fileFiltered: filename => `Ignore rule triggered for "${filename}"`,
|
|
2246
2250
|
},
|
|
2247
2251
|
},
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
failedToLoadBoxen: 'Failed to load boxen util.',
|
|
2251
|
-
},
|
|
2252
|
+
boxen: {
|
|
2253
|
+
failedToLoad: 'Failed to load boxen util.',
|
|
2252
2254
|
},
|
|
2253
2255
|
ui: {
|
|
2254
2256
|
betaTag: chalk_1.default.bold('[BETA]'),
|
|
@@ -2613,7 +2615,7 @@ exports.lib = {
|
|
|
2613
2615
|
message: "The personal access key you provided doesn't include developer sandbox permissions.",
|
|
2614
2616
|
instructions: (accountName, url) => `To update CLI permissions for "${accountName}": \n- Go to ${url}, deactivate the existing personal access key, and create a new one that includes developer sandbox permissions. \n- Update the CLI config for this account by running ${chalk_1.default.bold('hs auth')} and entering the new key.\n`,
|
|
2615
2617
|
},
|
|
2616
|
-
generic: 'An error
|
|
2618
|
+
generic: 'An error occurred while creating a developer sandbox',
|
|
2617
2619
|
},
|
|
2618
2620
|
},
|
|
2619
2621
|
standard: {
|
|
@@ -2729,7 +2731,7 @@ exports.lib = {
|
|
|
2729
2731
|
},
|
|
2730
2732
|
port: {
|
|
2731
2733
|
inUse: port => `Port ${port} is in use`,
|
|
2732
|
-
inUseSecondary: command => `Make sure it is available
|
|
2734
|
+
inUseSecondary: command => `Make sure it is available before running ${command}`,
|
|
2733
2735
|
available: port => `Port ${port} available for local development`,
|
|
2734
2736
|
},
|
|
2735
2737
|
diagnosis: {
|
|
@@ -2761,7 +2763,8 @@ exports.lib = {
|
|
|
2761
2763
|
componentsToBeMigrated: components => `The following features will be migrated: ${components}`,
|
|
2762
2764
|
componentsThatWillNotBeMigrated: components => `[NOTE] These features are not yet supported for migration but will be available later: ${components}`,
|
|
2763
2765
|
sourceContentsMoved: (newLocation) => `The contents of your old source directory have been moved to ${newLocation}, move any required files to the new source directory.`,
|
|
2764
|
-
|
|
2766
|
+
projectMigrationWarningTitle: '⚠️ Important: Migrating to platformVersion 2025.2 is irreversible ⚠️',
|
|
2767
|
+
projectMigrationWarning: (0, ui_1.uiBetaTag)(`Running the ${(0, ui_1.uiCommandReference)('hs project migrate')} command will permanently upgrade your project to platformVersion 2025.2. This action cannot be undone. To ensure you have access to your original files, they will be copied to a new directory (archive) for safekeeping.\n\nThis command will guide you through the process, prompting you to enter the required fields and will download the new project source code into your project source directory.`, false),
|
|
2765
2768
|
errors: {
|
|
2766
2769
|
project: {
|
|
2767
2770
|
invalidConfig: 'The project configuration file is invalid. Please check the config file and try again.',
|
|
@@ -2778,7 +2781,7 @@ exports.lib = {
|
|
|
2778
2781
|
generic: reasonCode => `Unable to migrate app: ${reasonCode}`,
|
|
2779
2782
|
},
|
|
2780
2783
|
noAppsEligible: (accountId, reasons) => `No apps in account ${accountId} are currently migratable${reasons.length ? `\n - ${reasons.join('\n - ')}` : ''}`,
|
|
2781
|
-
invalidAccountTypeTitle:
|
|
2784
|
+
invalidAccountTypeTitle: `${chalk_1.default.bold('Developer account not targeted')}`,
|
|
2782
2785
|
invalidAccountTypeDescription: (useCommand, authCommand) => `Only public apps created in a developer account can be converted to a project component. Select a connected developer account with ${useCommand} or ${authCommand} and try again.`,
|
|
2783
2786
|
appWithAppIdNotFound: appId => `Could not find an app with the id ${appId} `,
|
|
2784
2787
|
noAppsForProject: (projectName) => `No apps associated with project ${projectName}`,
|
package/lang/en.lyaml
CHANGED
|
@@ -1236,9 +1236,6 @@ en:
|
|
|
1236
1236
|
compressed: "Project files compressed: {{ byteCount }} bytes"
|
|
1237
1237
|
compressing: "Compressing build files to \"{{ path }}\""
|
|
1238
1238
|
fileFiltered: "Ignore rule triggered for \"{{ filename }}\""
|
|
1239
|
-
middleware:
|
|
1240
|
-
fireAlarm:
|
|
1241
|
-
failedToLoadBoxen: "Failed to load boxen util."
|
|
1242
1239
|
ui:
|
|
1243
1240
|
betaTag: "{{#bold}}[BETA]{{/bold}}"
|
|
1244
1241
|
betaWarning:
|
package/lib/app/migrate.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.migrateApp2025_2 = migrateApp2025_2;
|
|
7
7
|
exports.logInvalidAccountError = logInvalidAccountError;
|
|
8
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
8
|
const path_1 = __importDefault(require("path"));
|
|
10
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
11
10
|
const archive_1 = require("@hubspot/local-dev-lib/archive");
|
|
@@ -27,6 +26,7 @@ const en_1 = require("../../lang/en");
|
|
|
27
26
|
const hasFeature_1 = require("../hasFeature");
|
|
28
27
|
const constants_1 = require("../constants");
|
|
29
28
|
const urls_1 = require("../projects/urls");
|
|
29
|
+
const logger_1 = require("../ui/logger");
|
|
30
30
|
function getUnmigratableReason(reasonCode, projectName, accountId) {
|
|
31
31
|
switch (reasonCode) {
|
|
32
32
|
case projects_1.UNMIGRATABLE_REASONS.UP_TO_DATE:
|
|
@@ -116,7 +116,7 @@ async function promptForAppToMigrate(allApps, derivedAccountId) {
|
|
|
116
116
|
});
|
|
117
117
|
return selectedAppId;
|
|
118
118
|
}
|
|
119
|
-
async function selectAppToMigrate(allApps, derivedAccountId, appId
|
|
119
|
+
async function selectAppToMigrate(allApps, derivedAccountId, appId) {
|
|
120
120
|
if (appId &&
|
|
121
121
|
!allApps.some(app => {
|
|
122
122
|
return app.appId === appId;
|
|
@@ -139,16 +139,15 @@ async function selectAppToMigrate(allApps, derivedAccountId, appId, projectConfi
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
if (migratableComponents.size !== 0) {
|
|
142
|
-
logger_1.
|
|
142
|
+
logger_1.uiLogger.log(en_1.lib.migrate.componentsToBeMigrated(`\n - ${[...migratableComponents].join('\n - ')}`));
|
|
143
143
|
}
|
|
144
144
|
if (unmigratableComponents.size !== 0) {
|
|
145
|
-
logger_1.
|
|
145
|
+
logger_1.uiLogger.log(en_1.lib.migrate.componentsThatWillNotBeMigrated(`\n - ${[...unmigratableComponents].join('\n - ')}`));
|
|
146
146
|
}
|
|
147
|
-
logger_1.
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const proceed = await (0, promptUtils_1.confirmPrompt)(promptMessage, { defaultAnswer: false });
|
|
147
|
+
logger_1.uiLogger.log('');
|
|
148
|
+
const proceed = await (0, promptUtils_1.confirmPrompt)(en_1.lib.migrate.prompt.proceed, {
|
|
149
|
+
defaultAnswer: false,
|
|
150
|
+
});
|
|
152
151
|
return {
|
|
153
152
|
proceed,
|
|
154
153
|
appIdToMigrate,
|
|
@@ -157,7 +156,7 @@ async function selectAppToMigrate(allApps, derivedAccountId, appId, projectConfi
|
|
|
157
156
|
async function handleMigrationSetup(derivedAccountId, options, projectConfig) {
|
|
158
157
|
const { name, dest, appId } = options;
|
|
159
158
|
const allApps = await fetchMigrationApps(appId, derivedAccountId, options.platformVersion, projectConfig);
|
|
160
|
-
const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, derivedAccountId, appId
|
|
159
|
+
const { proceed, appIdToMigrate } = await selectAppToMigrate(allApps, derivedAccountId, appId);
|
|
161
160
|
if (!proceed) {
|
|
162
161
|
return {};
|
|
163
162
|
}
|
|
@@ -293,7 +292,7 @@ async function downloadProjectFiles(derivedAccountId, projectName, buildId, proj
|
|
|
293
292
|
const archiveDest = path_1.default.join(projectDir, 'archive');
|
|
294
293
|
// Move the existing source directory to archive
|
|
295
294
|
fs_1.default.renameSync(path_1.default.join(projectDir, srcDir), archiveDest);
|
|
296
|
-
logger_1.
|
|
295
|
+
logger_1.uiLogger.info(en_1.lib.migrate.sourceContentsMoved(archiveDest));
|
|
297
296
|
}
|
|
298
297
|
else {
|
|
299
298
|
absoluteDestPath = projectDest
|
|
@@ -307,7 +306,7 @@ async function downloadProjectFiles(derivedAccountId, projectName, buildId, proj
|
|
|
307
306
|
SpinniesManager_1.default.succeed('fetchingMigratedProject', {
|
|
308
307
|
text: en_1.lib.migrate.spinners.downloadingProjectContentsComplete,
|
|
309
308
|
});
|
|
310
|
-
logger_1.
|
|
309
|
+
logger_1.uiLogger.success(`Saved ${projectName} to ${projectDest}`);
|
|
311
310
|
}
|
|
312
311
|
catch (error) {
|
|
313
312
|
SpinniesManager_1.default.fail('fetchingMigratedProject', {
|
|
@@ -342,12 +341,12 @@ async function migrateApp2025_2(derivedAccountId, options, projectConfig) {
|
|
|
342
341
|
const { migrationId, uidMap } = migrationInProgress;
|
|
343
342
|
const buildId = await finalizeMigration(derivedAccountId, migrationId, uidMap, projectConfig?.projectConfig?.name || projectName);
|
|
344
343
|
await downloadProjectFiles(derivedAccountId, projectName, buildId, projectDest, projectConfig);
|
|
345
|
-
logger_1.
|
|
346
|
-
logger_1.
|
|
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)));
|
|
347
346
|
}
|
|
348
347
|
function logInvalidAccountError() {
|
|
349
348
|
(0, ui_1.uiLine)();
|
|
350
|
-
logger_1.
|
|
351
|
-
logger_1.
|
|
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')));
|
|
352
351
|
(0, ui_1.uiLine)();
|
|
353
352
|
}
|
package/lib/buildAccount.js
CHANGED
|
@@ -61,18 +61,17 @@ 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
|
});
|
|
@@ -83,7 +82,7 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
83
82
|
developerTestAccountId = data.id;
|
|
84
83
|
developerTestAccountPersonalAccessKey = data.personalAccessKey;
|
|
85
84
|
SpinniesManager_1.default.succeed('buildDeveloperTestAccount', {
|
|
86
|
-
text: (0, lang_1.i18n)(
|
|
85
|
+
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.succeed`, {
|
|
87
86
|
accountName: testAccountName,
|
|
88
87
|
accountId: developerTestAccountId,
|
|
89
88
|
}),
|
|
@@ -92,7 +91,7 @@ async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, e
|
|
|
92
91
|
catch (e) {
|
|
93
92
|
(0, index_1.debugError)(e);
|
|
94
93
|
SpinniesManager_1.default.fail('buildDeveloperTestAccount', {
|
|
95
|
-
text: (0, lang_1.i18n)(
|
|
94
|
+
text: (0, lang_1.i18n)(`lib.developerTestAccount.create.loading.fail`, {
|
|
96
95
|
accountName: testAccountName,
|
|
97
96
|
}),
|
|
98
97
|
});
|