@hubspot/cli 7.5.4-experimental.0 → 7.5.6-experimental.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/project/cloneApp.d.ts +5 -1
- package/commands/project/cloneApp.js +1 -1
- package/commands/project/dev/index.js +1 -1
- package/commands/project/installDeps.d.ts +9 -1
- package/commands/project/installDeps.js +43 -30
- package/commands/project/logs.d.ts +13 -1
- package/commands/project/logs.js +69 -62
- 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.d.ts +12 -0
- package/commands/project/upload.js +62 -49
- package/commands/project/watch.js +12 -0
- package/commands/project.js +2 -0
- package/lang/en.d.ts +2838 -0
- package/lang/en.js +2645 -3304
- package/lang/en.lyaml +8 -27
- package/lib/app/migrate.d.ts +10 -4
- package/lib/app/migrate.js +124 -81
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +6 -4
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +1 -1
- package/lib/projects/index.d.ts +4 -3
- package/lib/projects/upload.d.ts +1 -1
- package/package.json +2 -2
- 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,
|
|
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;
|
|
@@ -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;
|
|
@@ -36,7 +36,7 @@ async function handler(args) {
|
|
|
36
36
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
37
37
|
}
|
|
38
38
|
(0, projects_1.validateProjectConfig)(projectConfig, projectDir);
|
|
39
|
-
if ((0, buildAndDeploy_1.useV3Api)(projectConfig
|
|
39
|
+
if ((0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion)) {
|
|
40
40
|
await (0, unifiedFlow_1.unifiedProjectDevFlow)(args, accountConfig, projectConfig, projectDir);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { CommonArgs } from '../../types/Yargs';
|
|
3
|
+
export declare const command = "install-deps [packages..]";
|
|
4
|
+
export declare const describe: string;
|
|
5
|
+
export type ProjectInstallDepsArgs = CommonArgs & {
|
|
6
|
+
packages?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function handler(args: ArgumentsCamelCase<ProjectInstallDepsArgs>): Promise<void>;
|
|
9
|
+
export declare const builder: (yargs: Argv) => Promise<Argv<ProjectInstallDepsArgs>>;
|
|
@@ -1,43 +1,49 @@
|
|
|
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
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
6
|
+
exports.builder = exports.describe = exports.command = void 0;
|
|
7
|
+
exports.handler = handler;
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const dependencyManagement_1 = require("../../lib/dependencyManagement");
|
|
10
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
11
|
+
const projects_1 = require("../../lib/projects");
|
|
12
|
+
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const lang_1 = require("../../lib/lang");
|
|
15
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
16
|
+
const ui_1 = require("../../lib/ui");
|
|
17
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
18
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
13
19
|
const i18nKey = `commands.project.subcommands.installDeps`;
|
|
14
20
|
exports.command = 'install-deps [packages..]';
|
|
15
|
-
exports.describe = uiBetaTag(i18n(`${i18nKey}.help.describe`), false);
|
|
16
|
-
|
|
17
|
-
const { derivedAccountId, packages } =
|
|
21
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`${i18nKey}.help.describe`), false);
|
|
22
|
+
async function handler(args) {
|
|
23
|
+
const { derivedAccountId, packages } = args;
|
|
18
24
|
try {
|
|
19
|
-
trackCommandUsage('project-install-deps',
|
|
20
|
-
const projectConfig = await getProjectConfig();
|
|
25
|
+
(0, usageTracking_1.trackCommandUsage)('project-install-deps', undefined, derivedAccountId);
|
|
26
|
+
const projectConfig = await (0, projects_1.getProjectConfig)();
|
|
21
27
|
if (!projectConfig || !projectConfig.projectDir) {
|
|
22
|
-
logger.error(i18n(`${i18nKey}.noProjectConfig`));
|
|
23
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
28
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.noProjectConfig`));
|
|
29
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
24
30
|
}
|
|
25
31
|
const { projectDir } = projectConfig;
|
|
26
|
-
let installLocations = await getProjectPackageJsonLocations();
|
|
32
|
+
let installLocations = await (0, dependencyManagement_1.getProjectPackageJsonLocations)();
|
|
27
33
|
if (packages) {
|
|
28
|
-
const { selectedInstallLocations } = await promptUser([
|
|
34
|
+
const { selectedInstallLocations } = await (0, promptUtils_1.promptUser)([
|
|
29
35
|
{
|
|
30
36
|
name: 'selectedInstallLocations',
|
|
31
37
|
type: 'checkbox',
|
|
32
38
|
when: () => packages && packages.length > 0,
|
|
33
|
-
message: i18n(`${i18nKey}.installLocationPrompt`),
|
|
39
|
+
message: (0, lang_1.i18n)(`${i18nKey}.installLocationPrompt`),
|
|
34
40
|
choices: installLocations.map(dir => ({
|
|
35
|
-
name:
|
|
41
|
+
name: path_1.default.relative(projectDir, dir),
|
|
36
42
|
value: dir,
|
|
37
43
|
})),
|
|
38
44
|
validate: choices => {
|
|
39
45
|
if (choices === undefined || choices.length === 0) {
|
|
40
|
-
return i18n(`${i18nKey}.installLocationPromptRequired`);
|
|
46
|
+
return (0, lang_1.i18n)(`${i18nKey}.installLocationPromptRequired`);
|
|
41
47
|
}
|
|
42
48
|
return true;
|
|
43
49
|
},
|
|
@@ -47,23 +53,30 @@ exports.handler = async (options) => {
|
|
|
47
53
|
installLocations = selectedInstallLocations;
|
|
48
54
|
}
|
|
49
55
|
}
|
|
50
|
-
await installPackages({
|
|
56
|
+
await (0, dependencyManagement_1.installPackages)({
|
|
51
57
|
packages,
|
|
52
58
|
installLocations,
|
|
53
59
|
});
|
|
54
60
|
}
|
|
55
61
|
catch (e) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
62
|
+
(0, errorHandlers_1.logError)(e);
|
|
63
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
59
64
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
65
|
+
}
|
|
66
|
+
function projectInstallDepsBuilder(yargs) {
|
|
62
67
|
yargs.example([
|
|
63
|
-
['$0 project install-deps', i18n(`${i18nKey}.help.installAppDepsExample`)],
|
|
68
|
+
['$0 project install-deps', (0, lang_1.i18n)(`${i18nKey}.help.installAppDepsExample`)],
|
|
64
69
|
[
|
|
65
70
|
'$0 project install-deps dependency1 dependency2',
|
|
66
|
-
i18n(`${i18nKey}.help.addDepToSubComponentExample`),
|
|
71
|
+
(0, lang_1.i18n)(`${i18nKey}.help.addDepToSubComponentExample`),
|
|
67
72
|
],
|
|
68
73
|
]);
|
|
74
|
+
return yargs;
|
|
75
|
+
}
|
|
76
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectInstallDepsBuilder, exports.command, exports.describe);
|
|
77
|
+
module.exports = {
|
|
78
|
+
command: exports.command,
|
|
79
|
+
describe: exports.describe,
|
|
80
|
+
builder: exports.builder,
|
|
81
|
+
handler,
|
|
69
82
|
};
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { CommonArgs } from '../../types/Yargs';
|
|
3
|
+
export declare const command = "logs";
|
|
4
|
+
export declare const describe: string;
|
|
5
|
+
export type ProjectLogsArgs = CommonArgs & {
|
|
6
|
+
function?: string;
|
|
7
|
+
latest?: boolean;
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
tail?: boolean;
|
|
10
|
+
limit?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const handler: (args: ArgumentsCamelCase<ProjectLogsArgs>) => Promise<never>;
|
|
13
|
+
export declare const builder: (yargs: Argv) => Promise<Argv<ProjectLogsArgs>>;
|
package/commands/project/logs.js
CHANGED
|
@@ -1,110 +1,117 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
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
|
|
15
|
-
const
|
|
16
|
-
const
|
|
3
|
+
exports.builder = exports.handler = exports.describe = exports.command = void 0;
|
|
4
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
6
|
+
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
7
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
9
|
+
const table_1 = require("../../lib/ui/table");
|
|
10
|
+
const errorHandlers_1 = require("../../lib/errorHandlers/");
|
|
11
|
+
const ui_1 = require("../../lib/ui");
|
|
12
|
+
const projectsLogsPrompt_1 = require("../../lib/prompts/projectsLogsPrompt");
|
|
13
|
+
const lang_1 = require("../../lib/lang");
|
|
14
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
|
+
const ProjectLogsManager_1 = require("../../lib/projects/ProjectLogsManager");
|
|
16
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
17
|
const i18nKey = 'commands.project.subcommands.logs';
|
|
18
|
-
|
|
19
|
-
const baseUrl = getHubSpotWebsiteOrigin(getEnv(accountId) === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD);
|
|
18
|
+
function getPrivateAppsUrl(accountId) {
|
|
19
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)(accountId) === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD);
|
|
20
20
|
return `${baseUrl}/private-apps/${accountId}`;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
function logTable(tableHeader, logsInfo) {
|
|
23
|
-
logger.log(i18n(`${i18nKey}.logs.showingLogs`));
|
|
24
|
-
logger.log(getTableContents([tableHeader, logsInfo], { border: { bodyLeft: ' ' } }));
|
|
23
|
+
logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.logs.showingLogs`));
|
|
24
|
+
logger_1.logger.log((0, table_1.getTableContents)([tableHeader, logsInfo], { border: { bodyLeft: ' ' } }));
|
|
25
25
|
}
|
|
26
26
|
function logPreamble() {
|
|
27
|
-
if (ProjectLogsManager.isPublicFunction) {
|
|
28
|
-
logTable(getTableHeader([
|
|
29
|
-
i18n(`${i18nKey}.table.accountHeader`),
|
|
30
|
-
i18n(`${i18nKey}.table.functionHeader`),
|
|
31
|
-
i18n(`${i18nKey}.table.endpointHeader`),
|
|
27
|
+
if (ProjectLogsManager_1.ProjectLogsManager.isPublicFunction) {
|
|
28
|
+
logTable((0, table_1.getTableHeader)([
|
|
29
|
+
(0, lang_1.i18n)(`${i18nKey}.table.accountHeader`),
|
|
30
|
+
(0, lang_1.i18n)(`${i18nKey}.table.functionHeader`),
|
|
31
|
+
(0, lang_1.i18n)(`${i18nKey}.table.endpointHeader`),
|
|
32
32
|
]), [
|
|
33
|
-
ProjectLogsManager.accountId,
|
|
34
|
-
ProjectLogsManager.functionName,
|
|
35
|
-
ProjectLogsManager.endpointName,
|
|
33
|
+
ProjectLogsManager_1.ProjectLogsManager.accountId,
|
|
34
|
+
ProjectLogsManager_1.ProjectLogsManager.functionName,
|
|
35
|
+
ProjectLogsManager_1.ProjectLogsManager.endpointName,
|
|
36
36
|
]);
|
|
37
|
-
logger.log(uiLink(i18n(`${i18nKey}.logs.hubspotLogsDirectLink`), `${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/serverlessGatewayExecution?path=${ProjectLogsManager.endpointName}`));
|
|
37
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.logs.hubspotLogsDirectLink`), `${getPrivateAppsUrl(ProjectLogsManager_1.ProjectLogsManager.accountId)}/${ProjectLogsManager_1.ProjectLogsManager.appId}/logs/serverlessGatewayExecution?path=${ProjectLogsManager_1.ProjectLogsManager.endpointName}`));
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
logTable(getTableHeader([
|
|
41
|
-
i18n(`${i18nKey}.table.accountHeader`),
|
|
42
|
-
i18n(`${i18nKey}.table.functionHeader`),
|
|
43
|
-
]), [ProjectLogsManager.accountId, ProjectLogsManager.functionName]);
|
|
44
|
-
logger.log(uiLink(i18n(`${i18nKey}.logs.hubspotLogsDirectLink`), `${getPrivateAppsUrl(ProjectLogsManager.accountId)}/${ProjectLogsManager.appId}/logs/crm?serverlessFunction=${ProjectLogsManager.functionName}`));
|
|
40
|
+
logTable((0, table_1.getTableHeader)([
|
|
41
|
+
(0, lang_1.i18n)(`${i18nKey}.table.accountHeader`),
|
|
42
|
+
(0, lang_1.i18n)(`${i18nKey}.table.functionHeader`),
|
|
43
|
+
]), [ProjectLogsManager_1.ProjectLogsManager.accountId, ProjectLogsManager_1.ProjectLogsManager.functionName]);
|
|
44
|
+
logger_1.logger.log((0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.logs.hubspotLogsDirectLink`), `${getPrivateAppsUrl(ProjectLogsManager_1.ProjectLogsManager.accountId)}/${ProjectLogsManager_1.ProjectLogsManager.appId}/logs/crm?serverlessFunction=${ProjectLogsManager_1.ProjectLogsManager.functionName}`));
|
|
45
45
|
}
|
|
46
|
-
logger.log();
|
|
47
|
-
uiLine();
|
|
46
|
+
logger_1.logger.log();
|
|
47
|
+
(0, ui_1.uiLine)();
|
|
48
48
|
}
|
|
49
49
|
exports.command = 'logs';
|
|
50
|
-
exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
|
|
51
|
-
|
|
52
|
-
const { derivedAccountId } =
|
|
53
|
-
trackCommandUsage('project-logs',
|
|
50
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`${i18nKey}.describe`), false);
|
|
51
|
+
const handler = async (args) => {
|
|
52
|
+
const { derivedAccountId } = args;
|
|
53
|
+
(0, usageTracking_1.trackCommandUsage)('project-logs', undefined, derivedAccountId);
|
|
54
54
|
try {
|
|
55
|
-
await ProjectLogsManager.init(derivedAccountId);
|
|
56
|
-
const { functionName } = await projectLogsPrompt({
|
|
57
|
-
functionChoices: ProjectLogsManager.getFunctionNames(),
|
|
58
|
-
promptOptions:
|
|
59
|
-
projectName: ProjectLogsManager.projectName,
|
|
55
|
+
await ProjectLogsManager_1.ProjectLogsManager.init(derivedAccountId);
|
|
56
|
+
const { functionName } = await (0, projectsLogsPrompt_1.projectLogsPrompt)({
|
|
57
|
+
functionChoices: ProjectLogsManager_1.ProjectLogsManager.getFunctionNames(),
|
|
58
|
+
promptOptions: args,
|
|
59
|
+
projectName: ProjectLogsManager_1.ProjectLogsManager.projectName,
|
|
60
60
|
});
|
|
61
|
-
ProjectLogsManager.setFunction(functionName);
|
|
61
|
+
ProjectLogsManager_1.ProjectLogsManager.setFunction(functionName);
|
|
62
62
|
logPreamble();
|
|
63
63
|
}
|
|
64
64
|
catch (e) {
|
|
65
|
-
logError(e, {
|
|
65
|
+
(0, errorHandlers_1.logError)(e, {
|
|
66
66
|
accountId: derivedAccountId,
|
|
67
|
-
projectName: ProjectLogsManager.projectName,
|
|
67
|
+
projectName: ProjectLogsManager_1.ProjectLogsManager.projectName,
|
|
68
68
|
});
|
|
69
|
-
return process.exit(EXIT_CODES.ERROR);
|
|
69
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
70
70
|
}
|
|
71
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
71
72
|
};
|
|
72
|
-
exports.
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
exports.handler = handler;
|
|
74
|
+
function projectLogsBuilder(yargs) {
|
|
75
|
+
yargs.options({
|
|
75
76
|
function: {
|
|
76
77
|
alias: 'function',
|
|
77
|
-
describe: i18n(`${i18nKey}.options.function.describe`),
|
|
78
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.options.function.describe`),
|
|
78
79
|
requiresArg: true,
|
|
79
80
|
type: 'string',
|
|
80
81
|
},
|
|
81
82
|
latest: {
|
|
82
83
|
alias: 'l',
|
|
83
|
-
describe: i18n(`${i18nKey}.options.latest.describe`),
|
|
84
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.options.latest.describe`),
|
|
84
85
|
type: 'boolean',
|
|
85
86
|
},
|
|
86
87
|
compact: {
|
|
87
|
-
describe: i18n(`${i18nKey}.options.compact.describe`),
|
|
88
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.options.compact.describe`),
|
|
88
89
|
type: 'boolean',
|
|
89
90
|
},
|
|
90
91
|
tail: {
|
|
91
92
|
alias: ['t', 'follow'],
|
|
92
|
-
describe: i18n(`${i18nKey}.options.tail.describe`),
|
|
93
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.options.tail.describe`),
|
|
93
94
|
type: 'boolean',
|
|
94
95
|
},
|
|
95
96
|
limit: {
|
|
96
|
-
describe: i18n(`${i18nKey}.options.limit.describe`),
|
|
97
|
+
describe: (0, lang_1.i18n)(`${i18nKey}.options.limit.describe`),
|
|
97
98
|
type: 'number',
|
|
98
99
|
},
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
['$0 project logs', i18n(`${i18nKey}.examples.default`)],
|
|
100
|
+
});
|
|
101
|
+
yargs.conflicts('tail', 'limit');
|
|
102
|
+
yargs.example([
|
|
103
|
+
['$0 project logs', (0, lang_1.i18n)(`${i18nKey}.examples.default`)],
|
|
103
104
|
[
|
|
104
105
|
'$0 project logs --function=my-function',
|
|
105
|
-
i18n(`${i18nKey}.examples.withOptions`),
|
|
106
|
+
(0, lang_1.i18n)(`${i18nKey}.examples.withOptions`),
|
|
106
107
|
],
|
|
107
108
|
]);
|
|
108
|
-
addUseEnvironmentOptions(yargs);
|
|
109
109
|
return yargs;
|
|
110
|
+
}
|
|
111
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectLogsBuilder, exports.command, exports.describe, { useEnvironmentOptions: true });
|
|
112
|
+
module.exports = {
|
|
113
|
+
command: exports.command,
|
|
114
|
+
describe: exports.describe,
|
|
115
|
+
builder: exports.builder,
|
|
116
|
+
handler: exports.handler,
|
|
110
117
|
};
|
|
@@ -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;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { CommonArgs } from '../../types/Yargs';
|
|
3
|
+
export declare const command = "upload";
|
|
4
|
+
export declare const describe: string;
|
|
5
|
+
type ProjectUploadArgs = CommonArgs & {
|
|
6
|
+
forceCreate: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
m: string;
|
|
9
|
+
skipValidation: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function handler(args: ArgumentsCamelCase<ProjectUploadArgs>): Promise<void>;
|
|
12
|
+
export declare const builder: (yargs: Argv) => Promise<Argv<ProjectUploadArgs>>;
|
|
1
13
|
export {};
|