@hubspot/cli 7.4.1 → 7.4.2-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/api/migrate.d.ts +3 -2
- package/api/migrate.js +20 -3
- package/commands/app/migrate.d.ts +4 -4
- package/commands/app/migrate.js +5 -0
- package/commands/project/cloneApp.d.ts +5 -1
- package/commands/project/cloneApp.js +1 -1
- package/commands/project/migrate.d.ts +11 -0
- package/commands/project/migrate.js +54 -0
- package/commands/project/migrateApp.d.ts +4 -4
- package/commands/project/upload.js +1 -1
- package/commands/project.js +2 -0
- package/lang/en.d.ts +2840 -0
- package/lang/en.js +2647 -3304
- package/lang/en.lyaml +8 -27
- package/lib/app/migrate.d.ts +10 -4
- package/lib/app/migrate.js +129 -81
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +6 -4
- package/lib/projects/index.d.ts +3 -2
- package/package.json +1 -1
- package/types/Yargs.d.ts +0 -10
package/api/migrate.d.ts
CHANGED
|
@@ -50,11 +50,12 @@ export interface MigrationSuccess extends MigrationBaseStatus {
|
|
|
50
50
|
}
|
|
51
51
|
export interface MigrationFailed extends MigrationBaseStatus {
|
|
52
52
|
status: typeof MIGRATION_STATUS.FAILURE;
|
|
53
|
-
|
|
53
|
+
projectErrorDetail: string;
|
|
54
54
|
componentErrorDetails: Record<string, string>;
|
|
55
55
|
}
|
|
56
56
|
export type MigrationStatus = MigrationInProgress | MigrationInputRequired | MigrationSuccess | MigrationFailed;
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function isMigrationStatus(error: unknown): error is MigrationStatus;
|
|
58
|
+
export declare function listAppsForMigration(accountId: number, platformVersion: string): HubSpotPromise<ListAppsResponse>;
|
|
58
59
|
export declare function initializeMigration(accountId: number, applicationId: number, platformVersion: string): HubSpotPromise<InitializeMigrationResponse>;
|
|
59
60
|
export declare function continueMigration(portalId: number, migrationId: number, componentUids: Record<string, string>, projectName: string): HubSpotPromise<ContinueMigrationResponse>;
|
|
60
61
|
export declare function checkMigrationStatusV2(accountId: number, id: number): HubSpotPromise<MigrationStatus>;
|
package/api/migrate.js
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
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 });
|
|
6
|
+
exports.isMigrationStatus = isMigrationStatus;
|
|
3
7
|
exports.listAppsForMigration = listAppsForMigration;
|
|
4
8
|
exports.initializeMigration = initializeMigration;
|
|
5
9
|
exports.continueMigration = continueMigration;
|
|
6
10
|
exports.checkMigrationStatusV2 = checkMigrationStatusV2;
|
|
7
11
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
8
12
|
const http_1 = require("@hubspot/local-dev-lib/http");
|
|
13
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
14
|
+
const util_1 = __importDefault(require("util"));
|
|
9
15
|
const MIGRATIONS_API_PATH_V2 = 'dfs/migrations/v2';
|
|
10
|
-
|
|
16
|
+
function isMigrationStatus(error) {
|
|
17
|
+
return (typeof error === 'object' &&
|
|
18
|
+
error !== null &&
|
|
19
|
+
'id' in error &&
|
|
20
|
+
'status' in error);
|
|
21
|
+
}
|
|
22
|
+
async function listAppsForMigration(accountId, platformVersion) {
|
|
11
23
|
return http_1.http.get(accountId, {
|
|
12
24
|
url: `${MIGRATIONS_API_PATH_V2}/list-apps`,
|
|
25
|
+
params: {
|
|
26
|
+
platformVersion: mapPlatformVersionToEnum(platformVersion),
|
|
27
|
+
},
|
|
13
28
|
});
|
|
14
29
|
}
|
|
15
30
|
function mapPlatformVersionToEnum(platformVersion) {
|
|
@@ -37,8 +52,10 @@ async function continueMigration(portalId, migrationId, componentUids, projectNa
|
|
|
37
52
|
},
|
|
38
53
|
});
|
|
39
54
|
}
|
|
40
|
-
function checkMigrationStatusV2(accountId, id) {
|
|
41
|
-
|
|
55
|
+
async function checkMigrationStatusV2(accountId, id) {
|
|
56
|
+
const response = await http_1.http.get(accountId, {
|
|
42
57
|
url: `${MIGRATIONS_API_PATH_V2}/migrations/${id}/status`,
|
|
43
58
|
});
|
|
59
|
+
logger_1.logger.debug(util_1.default.inspect(response.data, { depth: null }));
|
|
60
|
+
return response;
|
|
44
61
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
3
3
|
export declare const validMigrationTargets: string[];
|
|
4
|
-
export declare function handler(options: ArgumentsCamelCase<
|
|
5
|
-
export declare function builder(yargs: Argv): Argv<
|
|
6
|
-
declare const migrateCommand: CommandModule<unknown,
|
|
4
|
+
export declare function handler(options: ArgumentsCamelCase<MigrateAppArgs>): Promise<never>;
|
|
5
|
+
export declare function builder(yargs: Argv): Argv<MigrateAppArgs>;
|
|
6
|
+
declare const migrateCommand: CommandModule<unknown, MigrateAppArgs>;
|
|
7
7
|
export default migrateCommand;
|
package/commands/app/migrate.js
CHANGED
|
@@ -14,6 +14,7 @@ const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
|
14
14
|
const migrate_1 = require("../../lib/app/migrate");
|
|
15
15
|
const ui_1 = require("../../lib/ui");
|
|
16
16
|
const migrate_legacy_1 = require("../../lib/app/migrate_legacy");
|
|
17
|
+
const projects_2 = require("../../lib/projects");
|
|
17
18
|
const { v2023_2, v2025_2, unstable } = projects_1.PLATFORM_VERSIONS;
|
|
18
19
|
exports.validMigrationTargets = [v2023_2, v2025_2, unstable];
|
|
19
20
|
const command = 'migrate';
|
|
@@ -32,6 +33,10 @@ async function handler(options) {
|
|
|
32
33
|
logger_1.logger.log('');
|
|
33
34
|
try {
|
|
34
35
|
if (platformVersion === v2025_2 || platformVersion === unstable) {
|
|
36
|
+
if ((0, projects_2.getIsInProject)()) {
|
|
37
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.errors.notAllowedWithinProject`, { command: (0, ui_1.uiCommandReference)('hs project migrate') }));
|
|
38
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
+
}
|
|
35
40
|
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, options);
|
|
36
41
|
}
|
|
37
42
|
else {
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
3
|
export declare const command = "clone-app";
|
|
4
4
|
export declare const describe: string | undefined;
|
|
5
5
|
export declare const deprecated = true;
|
|
6
|
+
export type CloneAppArgs = ConfigArgs & EnvironmentArgs & AccountArgs & CommonArgs & {
|
|
7
|
+
dest: string;
|
|
8
|
+
appId: number;
|
|
9
|
+
};
|
|
6
10
|
export declare const handler: (options: ArgumentsCamelCase<CloneAppArgs>) => Promise<never>;
|
|
7
11
|
export declare const builder: (yargs: Argv) => Argv<CloneAppArgs>;
|
|
8
12
|
declare const cloneAppCommand: CommandModule<unknown, CloneAppArgs>;
|
|
@@ -39,7 +39,7 @@ const handler = async (options) => {
|
|
|
39
39
|
throw new Error((0, lang_1.i18n)(`commands.projects.subcommands.cloneApp.errors.noAccountConfig`));
|
|
40
40
|
}
|
|
41
41
|
if (!(0, accountTypes_1.isAppDeveloperAccount)(accountConfig)) {
|
|
42
|
-
(0, migrate_1.logInvalidAccountError)(
|
|
42
|
+
(0, migrate_1.logInvalidAccountError)();
|
|
43
43
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
44
44
|
}
|
|
45
45
|
let appId;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
|
+
export type ProjectMigrateArgs = CommonArgs & AccountArgs & EnvironmentArgs & ConfigArgs & {
|
|
4
|
+
platformVersion: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const command = "migrate";
|
|
7
|
+
export declare const describe: undefined;
|
|
8
|
+
export declare function handler(options: ArgumentsCamelCase<ProjectMigrateArgs>): Promise<void>;
|
|
9
|
+
export declare function builder(yargs: Argv): Argv<ProjectMigrateArgs>;
|
|
10
|
+
declare const migrateAppCommand: CommandModule<unknown, ProjectMigrateArgs>;
|
|
11
|
+
export default migrateAppCommand;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describe = exports.command = void 0;
|
|
4
|
+
exports.handler = handler;
|
|
5
|
+
exports.builder = builder;
|
|
6
|
+
const lang_1 = require("../../lib/lang");
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const commonOpts_1 = require("../../lib/commonOpts");
|
|
9
|
+
const migrate_1 = require("../../lib/app/migrate");
|
|
10
|
+
const projects_1 = require("../../lib/projects");
|
|
11
|
+
const projects_2 = require("@hubspot/local-dev-lib/constants/projects");
|
|
12
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
13
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
14
|
+
exports.command = 'migrate';
|
|
15
|
+
exports.describe = undefined; // i18n('commands.project.subcommands.migrate.noProjectConfig')
|
|
16
|
+
async function handler(options) {
|
|
17
|
+
const projectConfig = await (0, projects_1.getProjectConfig)();
|
|
18
|
+
if (!projectConfig.projectConfig) {
|
|
19
|
+
logger_1.logger.error((0, lang_1.i18n)('commands.project.subcommands.migrate.errors.noProjectConfig'));
|
|
20
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
21
|
+
}
|
|
22
|
+
const { derivedAccountId } = options;
|
|
23
|
+
try {
|
|
24
|
+
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, {
|
|
25
|
+
...options,
|
|
26
|
+
name: projectConfig?.projectConfig?.name,
|
|
27
|
+
platformVersion: options.platformVersion,
|
|
28
|
+
}, projectConfig);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
(0, errorHandlers_1.logError)(error);
|
|
32
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
33
|
+
}
|
|
34
|
+
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
35
|
+
}
|
|
36
|
+
function builder(yargs) {
|
|
37
|
+
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
38
|
+
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
39
|
+
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
40
|
+
yargs.option('platform-version', {
|
|
41
|
+
type: 'string',
|
|
42
|
+
choices: Object.values(projects_2.PLATFORM_VERSIONS),
|
|
43
|
+
default: projects_2.PLATFORM_VERSIONS.v2025_2,
|
|
44
|
+
hidden: true,
|
|
45
|
+
});
|
|
46
|
+
return yargs;
|
|
47
|
+
}
|
|
48
|
+
const migrateAppCommand = {
|
|
49
|
+
command: exports.command,
|
|
50
|
+
describe: exports.describe,
|
|
51
|
+
handler,
|
|
52
|
+
builder,
|
|
53
|
+
};
|
|
54
|
+
exports.default = migrateAppCommand;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
3
3
|
export declare const command = "migrate-app";
|
|
4
4
|
export declare const describe: string | undefined;
|
|
5
5
|
export declare const deprecated = true;
|
|
6
|
-
export declare function handler(yargs: ArgumentsCamelCase<
|
|
7
|
-
export declare function builder(yargs: Argv): Argv<
|
|
8
|
-
declare const migrateAppCommand: CommandModule<unknown,
|
|
6
|
+
export declare function handler(yargs: ArgumentsCamelCase<MigrateAppArgs>): Promise<void>;
|
|
7
|
+
export declare function builder(yargs: Argv): Argv<MigrateAppArgs>;
|
|
8
|
+
declare const migrateAppCommand: CommandModule<unknown, MigrateAppArgs>;
|
|
9
9
|
export default migrateAppCommand;
|
package/commands/project.js
CHANGED
|
@@ -15,6 +15,7 @@ const open = require('./project/open');
|
|
|
15
15
|
const dev = require('./project/dev');
|
|
16
16
|
const add = require('./project/add');
|
|
17
17
|
const migrateApp = require('./project/migrateApp');
|
|
18
|
+
const migrate = require('./project/migrate');
|
|
18
19
|
const cloneApp = require('./project/cloneApp');
|
|
19
20
|
const installDeps = require('./project/installDeps');
|
|
20
21
|
const i18nKey = 'commands.project';
|
|
@@ -34,6 +35,7 @@ exports.builder = yargs => {
|
|
|
34
35
|
.command(download)
|
|
35
36
|
.command(open)
|
|
36
37
|
.command(migrateApp)
|
|
38
|
+
.command(migrate)
|
|
37
39
|
.command(cloneApp)
|
|
38
40
|
.command(installDeps)
|
|
39
41
|
.demandCommand(1, '');
|