@hubspot/cli 7.4.5-beta.0 → 7.4.6-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 +3 -3
- package/commands/app/migrate.js +8 -6
- package/commands/app.js +0 -2
- package/commands/project/add.d.ts +3 -7
- package/commands/project/add.js +10 -9
- package/commands/project/cloneApp.d.ts +2 -8
- package/commands/project/cloneApp.js +25 -26
- package/commands/project/create.d.ts +10 -1
- package/commands/project/create.js +80 -62
- package/commands/project/deploy.d.ts +3 -6
- package/commands/project/deploy.js +9 -9
- package/commands/project/dev/index.d.ts +4 -2
- package/commands/project/dev/index.js +16 -7
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +9 -9
- package/commands/project/installDeps.d.ts +3 -6
- package/commands/project/installDeps.js +10 -9
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +15 -14
- package/commands/project/logs.d.ts +3 -6
- package/commands/project/logs.js +11 -12
- package/commands/project/migrate.d.ts +3 -8
- package/commands/project/migrate.js +17 -18
- package/commands/project/migrateApp.d.ts +2 -7
- package/commands/project/migrateApp.js +18 -18
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +15 -14
- package/commands/project/upload.d.ts +3 -7
- package/commands/project/upload.js +9 -9
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +82 -71
- package/commands/project.d.ts +3 -1
- package/commands/project.js +47 -36
- package/lang/en.d.ts +4 -0
- package/lang/en.js +4 -0
- package/lang/en.lyaml +4 -0
- package/lib/app/migrate.js +30 -12
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +27 -8
- package/lib/middleware/configMiddleware.js +2 -2
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +1 -1
- package/lib/projects/watch.d.ts +1 -1
- package/lib/prompts/createProjectPrompt.d.ts +11 -4
- package/lib/prompts/createProjectPrompt.js +6 -0
- package/lib/ui/index.d.ts +3 -2
- package/lib/ui/index.js +1 -0
- package/lib/yargsUtils.d.ts +1 -1
- package/package.json +1 -1
- package/types/Yargs.d.ts +5 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ArgumentsCamelCase
|
|
1
|
+
import { ArgumentsCamelCase } from 'yargs';
|
|
2
|
+
import { YargsCommandModule } from '../../types/Yargs';
|
|
2
3
|
import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
3
4
|
export declare function handler(options: ArgumentsCamelCase<MigrateAppArgs>): Promise<never>;
|
|
4
|
-
|
|
5
|
-
declare const migrateCommand: CommandModule<unknown, MigrateAppArgs>;
|
|
5
|
+
declare const migrateCommand: YargsCommandModule<unknown, MigrateAppArgs>;
|
|
6
6
|
export default migrateCommand;
|
package/commands/app/migrate.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handler = handler;
|
|
4
|
-
exports.builder = builder;
|
|
5
4
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
6
5
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
7
6
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
8
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
9
7
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
10
8
|
const lang_1 = require("../../lib/lang");
|
|
11
9
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
@@ -14,6 +12,7 @@ const migrate_1 = require("../../lib/app/migrate");
|
|
|
14
12
|
const ui_1 = require("../../lib/ui");
|
|
15
13
|
const migrate_legacy_1 = require("../../lib/app/migrate_legacy");
|
|
16
14
|
const config_2 = require("../../lib/projects/config");
|
|
15
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
17
16
|
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
18
17
|
const command = 'migrate';
|
|
19
18
|
const describe = undefined; // uiBetaTag(i18n(`commands.project.subcommands.migrateApp.header.text.describe`), false);
|
|
@@ -60,10 +59,7 @@ async function handler(options) {
|
|
|
60
59
|
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { successful: true }, derivedAccountId);
|
|
61
60
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
62
61
|
}
|
|
63
|
-
function
|
|
64
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
65
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
66
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
62
|
+
function appMigrateBuilder(yargs) {
|
|
67
63
|
yargs.options({
|
|
68
64
|
name: {
|
|
69
65
|
describe: (0, lang_1.i18n)(`commands.project.subcommands.migrateApp.options.name.describe`),
|
|
@@ -97,6 +93,12 @@ function builder(yargs) {
|
|
|
97
93
|
]);
|
|
98
94
|
return yargs;
|
|
99
95
|
}
|
|
96
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(appMigrateBuilder, command, (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false), {
|
|
97
|
+
useGlobalOptions: true,
|
|
98
|
+
useConfigOptions: true,
|
|
99
|
+
useAccountOptions: true,
|
|
100
|
+
useEnvironmentOptions: true,
|
|
101
|
+
});
|
|
100
102
|
const migrateCommand = {
|
|
101
103
|
command,
|
|
102
104
|
describe,
|
package/commands/app.js
CHANGED
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.describe = exports.command = void 0;
|
|
7
7
|
exports.builder = builder;
|
|
8
8
|
const migrate_1 = __importDefault(require("./app/migrate"));
|
|
9
|
-
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
9
|
exports.command = ['app', 'apps'];
|
|
11
10
|
// Keep the command hidden for now
|
|
12
11
|
exports.describe = undefined;
|
|
13
12
|
function builder(yargs) {
|
|
14
|
-
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
15
13
|
return yargs.command(migrate_1.default).demandCommand(1, '');
|
|
16
14
|
}
|
|
17
15
|
const appCommand = {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "add";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { YargsCommandModule, CommonArgs } from '../../types/Yargs';
|
|
5
2
|
type ProjectAddArgs = CommonArgs & {
|
|
6
3
|
type: string;
|
|
7
4
|
name: string;
|
|
8
5
|
};
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export {};
|
|
6
|
+
declare const projectAddCommand: YargsCommandModule<unknown, ProjectAddArgs>;
|
|
7
|
+
export default projectAddCommand;
|
package/commands/project/add.js
CHANGED
|
@@ -3,8 +3,6 @@ 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.builder = exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
6
|
const path_1 = __importDefault(require("path"));
|
|
9
7
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
8
|
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
@@ -20,8 +18,8 @@ const ui_1 = require("../../lib/ui");
|
|
|
20
18
|
const constants_1 = require("../../lib/constants");
|
|
21
19
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
22
20
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const command = 'add';
|
|
22
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.add.describe`), false);
|
|
25
23
|
async function handler(args) {
|
|
26
24
|
const { derivedAccountId } = args;
|
|
27
25
|
(0, usageTracking_1.trackCommandUsage)('project-add', undefined, derivedAccountId);
|
|
@@ -113,10 +111,13 @@ function projectAddBuilder(yargs) {
|
|
|
113
111
|
]);
|
|
114
112
|
return yargs;
|
|
115
113
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectAddBuilder, command, describe, {
|
|
115
|
+
useGlobalOptions: true,
|
|
116
|
+
});
|
|
117
|
+
const projectAddCommand = {
|
|
118
|
+
command,
|
|
119
|
+
describe,
|
|
121
120
|
handler,
|
|
121
|
+
builder,
|
|
122
122
|
};
|
|
123
|
+
exports.default = projectAddCommand;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "clone-app";
|
|
4
|
-
export declare const describe: string | undefined;
|
|
5
|
-
export declare const deprecated = true;
|
|
1
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
6
2
|
export type CloneAppArgs = ConfigArgs & EnvironmentArgs & AccountArgs & CommonArgs & {
|
|
7
3
|
dest: string;
|
|
8
4
|
appId: number;
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
export declare const builder: (yargs: Argv) => Argv<CloneAppArgs>;
|
|
12
|
-
declare const cloneAppCommand: CommandModule<unknown, CloneAppArgs>;
|
|
6
|
+
declare const cloneAppCommand: YargsCommandModule<unknown, CloneAppArgs>;
|
|
13
7
|
export default cloneAppCommand;
|
|
@@ -3,17 +3,13 @@ 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.builder = exports.handler = exports.deprecated = exports.describe = exports.command = void 0;
|
|
7
|
-
const ui_1 = require("../../lib/ui");
|
|
8
6
|
const path_1 = __importDefault(require("path"));
|
|
9
7
|
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
11
8
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
12
9
|
const lang_1 = require("../../lib/lang");
|
|
13
10
|
const selectPublicAppPrompt_1 = require("../../lib/prompts/selectPublicAppPrompt");
|
|
14
11
|
const createProjectPrompt_1 = require("../../lib/prompts/createProjectPrompt");
|
|
15
12
|
const polling_1 = require("../../lib/polling");
|
|
16
|
-
const ui_2 = require("../../lib/ui");
|
|
17
13
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
18
14
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
19
15
|
const accountTypes_1 = require("../../lib/accountTypes");
|
|
@@ -26,14 +22,16 @@ const archive_1 = require("@hubspot/local-dev-lib/archive");
|
|
|
26
22
|
const config_2 = require("@hubspot/local-dev-lib/config");
|
|
27
23
|
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
28
24
|
const migrate_1 = require("../../lib/app/migrate");
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
25
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
26
|
+
const ui_1 = require("../../lib/ui");
|
|
27
|
+
const command = 'clone-app';
|
|
28
|
+
const describe = (0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.project.subcommands.cloneApp.describe`), false);
|
|
29
|
+
const deprecated = true;
|
|
30
|
+
async function handler(args) {
|
|
31
|
+
const { derivedAccountId } = args;
|
|
34
32
|
await (0, usageTracking_1.trackCommandUsage)('clone-app', {}, derivedAccountId);
|
|
35
33
|
const accountConfig = (0, config_2.getAccountConfig)(derivedAccountId);
|
|
36
|
-
const accountName = (0,
|
|
34
|
+
const accountName = (0, ui_1.uiAccountDescription)(derivedAccountId);
|
|
37
35
|
if (!accountConfig) {
|
|
38
36
|
throw new Error((0, lang_1.i18n)(`commands.projects.subcommands.cloneApp.errors.noAccountConfig`));
|
|
39
37
|
}
|
|
@@ -46,7 +44,7 @@ const handler = async (options) => {
|
|
|
46
44
|
let projectName;
|
|
47
45
|
let projectDest;
|
|
48
46
|
try {
|
|
49
|
-
appId =
|
|
47
|
+
appId = args.appId;
|
|
50
48
|
if (!appId) {
|
|
51
49
|
const appIdResponse = await (0, selectPublicAppPrompt_1.selectPublicAppPrompt)({
|
|
52
50
|
accountId: derivedAccountId,
|
|
@@ -55,7 +53,7 @@ const handler = async (options) => {
|
|
|
55
53
|
});
|
|
56
54
|
appId = appIdResponse.appId;
|
|
57
55
|
}
|
|
58
|
-
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(
|
|
56
|
+
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(args);
|
|
59
57
|
projectName = createProjectPromptResponse.name;
|
|
60
58
|
projectDest = createProjectPromptResponse.dest;
|
|
61
59
|
}
|
|
@@ -98,7 +96,7 @@ const handler = async (options) => {
|
|
|
98
96
|
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.cloneApp.errors.couldNotWriteConfigPath`), configPath);
|
|
99
97
|
}
|
|
100
98
|
logger_1.logger.log('');
|
|
101
|
-
(0,
|
|
99
|
+
(0, ui_1.uiLine)();
|
|
102
100
|
logger_1.logger.success((0, lang_1.i18n)(`commands.project.subcommands.cloneApp.cloneStatus.success`, {
|
|
103
101
|
dest: projectDest,
|
|
104
102
|
}));
|
|
@@ -125,9 +123,8 @@ const handler = async (options) => {
|
|
|
125
123
|
}
|
|
126
124
|
await (0, usageTracking_1.trackCommandMetadataUsage)('clone-app', { successful: true }, derivedAccountId);
|
|
127
125
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const builder = (yargs) => {
|
|
126
|
+
}
|
|
127
|
+
function cloneAppBuilder(yargs) {
|
|
131
128
|
yargs.options({
|
|
132
129
|
dest: {
|
|
133
130
|
describe: (0, lang_1.i18n)(`commands.project.subcommands.cloneApp.options.dest.describe`),
|
|
@@ -144,17 +141,19 @@ const builder = (yargs) => {
|
|
|
144
141
|
(0, lang_1.i18n)(`commands.project.subcommands.cloneApp.examples.default`),
|
|
145
142
|
],
|
|
146
143
|
]);
|
|
147
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
148
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
149
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
150
144
|
return yargs;
|
|
151
|
-
}
|
|
152
|
-
|
|
145
|
+
}
|
|
146
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(cloneAppBuilder, command, describe, {
|
|
147
|
+
useGlobalOptions: true,
|
|
148
|
+
useAccountOptions: true,
|
|
149
|
+
useConfigOptions: true,
|
|
150
|
+
useEnvironmentOptions: true,
|
|
151
|
+
});
|
|
153
152
|
const cloneAppCommand = {
|
|
154
|
-
command
|
|
155
|
-
describe
|
|
156
|
-
handler
|
|
157
|
-
builder
|
|
158
|
-
deprecated
|
|
153
|
+
command,
|
|
154
|
+
describe,
|
|
155
|
+
handler,
|
|
156
|
+
builder,
|
|
157
|
+
deprecated,
|
|
159
158
|
};
|
|
160
159
|
exports.default = cloneAppCommand;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { RepoPath } from '@hubspot/local-dev-lib/types/Github';
|
|
2
|
+
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
3
|
+
type ProjectCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
4
|
+
name?: string;
|
|
5
|
+
dest?: string;
|
|
6
|
+
templateSource?: RepoPath;
|
|
7
|
+
template?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const projectCreateCommand: YargsCommandModule<unknown, ProjectCreateArgs>;
|
|
10
|
+
export default projectCreateCommand;
|
|
@@ -1,88 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const { derivedAccountId } = options;
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
11
|
+
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
|
+
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
|
+
const createProjectPrompt_1 = require("../../lib/prompts/createProjectPrompt");
|
|
14
|
+
const config_1 = require("../../lib/projects/config");
|
|
15
|
+
const create_1 = require("../../lib/projects/create");
|
|
16
|
+
const lang_1 = require("../../lib/lang");
|
|
17
|
+
const ui_1 = require("../../lib/ui");
|
|
18
|
+
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
19
|
+
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
|
+
const constants_1 = require("../../lib/constants");
|
|
21
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
22
|
+
const command = 'create';
|
|
23
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.create.describe`), false);
|
|
24
|
+
async function handler(args) {
|
|
25
|
+
const { derivedAccountId } = args;
|
|
24
26
|
let latestRepoReleaseTag;
|
|
25
|
-
let templateSource =
|
|
27
|
+
let templateSource = args.templateSource;
|
|
26
28
|
if (!templateSource) {
|
|
27
|
-
templateSource = HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
29
|
+
templateSource = constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
28
30
|
try {
|
|
29
|
-
const releaseData = await fetchReleaseData(HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH);
|
|
31
|
+
const releaseData = await (0, github_1.fetchReleaseData)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH);
|
|
30
32
|
if (releaseData) {
|
|
31
33
|
latestRepoReleaseTag = releaseData.tag_name;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
catch (err) {
|
|
35
|
-
logger.error(i18n(`commands.project.subcommands.create.error.failedToFetchProjectList`));
|
|
36
|
-
process.exit(EXIT_CODES.ERROR);
|
|
37
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.error.failedToFetchProjectList`));
|
|
38
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
if (!templateSource || !templateSource.includes('/')) {
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.error.invalidTemplateSource`));
|
|
43
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
44
|
+
}
|
|
45
|
+
const projectTemplates = await (0, create_1.getProjectTemplateListFromRepo)(templateSource, latestRepoReleaseTag || constants_1.DEFAULT_PROJECT_TEMPLATE_BRANCH);
|
|
40
46
|
if (!projectTemplates.length) {
|
|
41
|
-
logger.error(i18n(`commands.project.subcommands.create.error.failedToFetchProjectList`));
|
|
42
|
-
process.exit(EXIT_CODES.ERROR);
|
|
47
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.error.failedToFetchProjectList`));
|
|
48
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
43
49
|
}
|
|
44
|
-
const createProjectPromptResponse = await createProjectPrompt(
|
|
45
|
-
const projectDest =
|
|
46
|
-
trackCommandUsage('project-create', { type: createProjectPromptResponse.projectTemplate.name }, derivedAccountId);
|
|
47
|
-
const { projectConfig: existingProjectConfig, projectDir: existingProjectDir, } = await getProjectConfig(projectDest);
|
|
50
|
+
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(args, projectTemplates);
|
|
51
|
+
const projectDest = path_1.default.resolve((0, path_2.getCwd)(), createProjectPromptResponse.dest);
|
|
52
|
+
(0, usageTracking_1.trackCommandUsage)('project-create', { type: createProjectPromptResponse.projectTemplate.name }, derivedAccountId);
|
|
53
|
+
const { projectConfig: existingProjectConfig, projectDir: existingProjectDir, } = await (0, config_1.getProjectConfig)(projectDest);
|
|
48
54
|
// Exit if the target destination is within an existing project
|
|
49
|
-
if (existingProjectConfig &&
|
|
50
|
-
|
|
55
|
+
if (existingProjectConfig &&
|
|
56
|
+
existingProjectDir &&
|
|
57
|
+
projectDest.startsWith(existingProjectDir)) {
|
|
58
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.errors.cannotNestProjects`, {
|
|
51
59
|
projectDir: existingProjectDir,
|
|
52
60
|
}));
|
|
53
|
-
process.exit(EXIT_CODES.ERROR);
|
|
61
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
54
62
|
}
|
|
55
63
|
try {
|
|
56
|
-
await cloneGithubRepo(templateSource, projectDest, {
|
|
64
|
+
await (0, github_1.cloneGithubRepo)(templateSource, projectDest, {
|
|
57
65
|
sourceDir: createProjectPromptResponse.projectTemplate.path,
|
|
58
66
|
tag: latestRepoReleaseTag,
|
|
59
67
|
hideLogs: true,
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
70
|
catch (err) {
|
|
63
|
-
debugError(err);
|
|
64
|
-
logger.error(i18n(`commands.project.subcommands.create.errors.failedToDownloadProject`));
|
|
65
|
-
process.exit(EXIT_CODES.ERROR);
|
|
71
|
+
(0, errorHandlers_1.debugError)(err);
|
|
72
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.errors.failedToDownloadProject`));
|
|
73
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
66
74
|
}
|
|
67
|
-
const projectConfigPath =
|
|
68
|
-
const parsedConfigFile = JSON.parse(
|
|
69
|
-
writeProjectConfig(projectConfigPath, {
|
|
75
|
+
const projectConfigPath = path_1.default.join(projectDest, constants_1.PROJECT_CONFIG_FILE);
|
|
76
|
+
const parsedConfigFile = JSON.parse(fs_extra_1.default.readFileSync(projectConfigPath).toString());
|
|
77
|
+
(0, config_1.writeProjectConfig)(projectConfigPath, {
|
|
70
78
|
...parsedConfigFile,
|
|
71
79
|
name: createProjectPromptResponse.name,
|
|
72
80
|
});
|
|
73
81
|
// If the template is 'no-template', we need to manually create a src directory
|
|
74
82
|
if (createProjectPromptResponse.projectTemplate.name ===
|
|
75
|
-
EMPTY_PROJECT_TEMPLATE_NAME) {
|
|
76
|
-
|
|
83
|
+
create_1.EMPTY_PROJECT_TEMPLATE_NAME) {
|
|
84
|
+
fs_extra_1.default.ensureDirSync(path_1.default.join(projectDest, 'src'));
|
|
77
85
|
}
|
|
78
|
-
logger.log('');
|
|
79
|
-
logger.success(i18n(`commands.project.subcommands.create.logs.success`, {
|
|
86
|
+
logger_1.logger.log('');
|
|
87
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.project.subcommands.create.logs.success`, {
|
|
80
88
|
projectName: createProjectPromptResponse.name,
|
|
81
89
|
projectDest,
|
|
82
90
|
}));
|
|
83
|
-
logger.log('');
|
|
84
|
-
logger.log(
|
|
85
|
-
uiFeatureHighlight([
|
|
91
|
+
logger_1.logger.log('');
|
|
92
|
+
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`commands.project.subcommands.create.logs.welcomeMessage`)));
|
|
93
|
+
(0, ui_1.uiFeatureHighlight)([
|
|
86
94
|
'projectCommandTip',
|
|
87
95
|
'projectUploadCommand',
|
|
88
96
|
'projectDevCommand',
|
|
@@ -91,41 +99,51 @@ exports.handler = async (options) => {
|
|
|
91
99
|
'feedbackCommand',
|
|
92
100
|
'sampleProjects',
|
|
93
101
|
]);
|
|
94
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
95
|
-
}
|
|
96
|
-
|
|
102
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
103
|
+
}
|
|
104
|
+
function projectCreateBuilder(yargs) {
|
|
97
105
|
yargs.options({
|
|
98
106
|
name: {
|
|
99
|
-
describe: i18n(`commands.project.subcommands.create.options.name.describe`),
|
|
107
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.create.options.name.describe`),
|
|
100
108
|
type: 'string',
|
|
101
109
|
},
|
|
102
110
|
dest: {
|
|
103
|
-
describe: i18n(`commands.project.subcommands.create.options.dest.describe`),
|
|
111
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.create.options.dest.describe`),
|
|
104
112
|
type: 'string',
|
|
105
113
|
},
|
|
106
114
|
template: {
|
|
107
|
-
describe: i18n(`commands.project.subcommands.create.options.template.describe`),
|
|
115
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.create.options.template.describe`),
|
|
108
116
|
type: 'string',
|
|
109
117
|
},
|
|
110
118
|
'template-source': {
|
|
111
|
-
describe: i18n(`commands.project.subcommands.create.options.templateSource.describe`),
|
|
119
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.create.options.templateSource.describe`),
|
|
112
120
|
type: 'string',
|
|
113
121
|
},
|
|
114
122
|
});
|
|
115
123
|
yargs.example([
|
|
116
124
|
[
|
|
117
125
|
'$0 project create',
|
|
118
|
-
i18n(`commands.project.subcommands.create.examples.default`),
|
|
126
|
+
(0, lang_1.i18n)(`commands.project.subcommands.create.examples.default`),
|
|
119
127
|
],
|
|
120
128
|
]);
|
|
121
129
|
yargs.example([
|
|
122
130
|
[
|
|
123
131
|
'$0 project create --template-source HubSpot/ui-extensions-examples',
|
|
124
|
-
i18n(`commands.project.subcommands.create.examples.templateSource`),
|
|
132
|
+
(0, lang_1.i18n)(`commands.project.subcommands.create.examples.templateSource`),
|
|
125
133
|
],
|
|
126
134
|
]);
|
|
127
|
-
addConfigOptions(yargs);
|
|
128
|
-
addAccountOptions(yargs);
|
|
129
|
-
addUseEnvironmentOptions(yargs);
|
|
130
135
|
return yargs;
|
|
136
|
+
}
|
|
137
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectCreateBuilder, command, describe, {
|
|
138
|
+
useGlobalOptions: true,
|
|
139
|
+
useAccountOptions: true,
|
|
140
|
+
useConfigOptions: true,
|
|
141
|
+
useEnvironmentOptions: true,
|
|
142
|
+
});
|
|
143
|
+
const projectCreateCommand = {
|
|
144
|
+
command,
|
|
145
|
+
describe,
|
|
146
|
+
handler,
|
|
147
|
+
builder,
|
|
131
148
|
};
|
|
149
|
+
exports.default = projectCreateCommand;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "deploy";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
export type ProjectDeployArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
6
3
|
project?: string;
|
|
7
4
|
build?: number;
|
|
8
5
|
buildId?: number;
|
|
9
6
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
7
|
+
declare const projectDeployCommand: YargsCommandModule<unknown, ProjectDeployArgs>;
|
|
8
|
+
export default projectDeployCommand;
|
|
@@ -3,8 +3,6 @@ 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.builder = exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
6
|
const chalk_1 = __importDefault(require("chalk"));
|
|
9
7
|
const projects_1 = require("@hubspot/local-dev-lib/api/projects");
|
|
10
8
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
@@ -23,8 +21,8 @@ const ui_1 = require("../../lib/ui");
|
|
|
23
21
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
24
22
|
const ui_2 = require("../../lib/ui");
|
|
25
23
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const command = 'deploy';
|
|
25
|
+
const describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.deploy.describe`), false);
|
|
28
26
|
function validateBuildId(buildId, deployedBuildId, latestBuildId, projectName, accountId) {
|
|
29
27
|
if (Number(buildId) > latestBuildId) {
|
|
30
28
|
return (0, lang_1.i18n)(`commands.project.subcommands.deploy.errors.buildIdDoesNotExist`, {
|
|
@@ -136,14 +134,16 @@ function projectDeployBuilder(yargs) {
|
|
|
136
134
|
]);
|
|
137
135
|
return yargs;
|
|
138
136
|
}
|
|
139
|
-
|
|
137
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(projectDeployBuilder, command, describe, {
|
|
138
|
+
useGlobalOptions: true,
|
|
140
139
|
useConfigOptions: true,
|
|
141
140
|
useAccountOptions: true,
|
|
142
141
|
useEnvironmentOptions: true,
|
|
143
142
|
});
|
|
144
|
-
|
|
145
|
-
command
|
|
146
|
-
describe
|
|
147
|
-
builder
|
|
143
|
+
const projectDeployCommand = {
|
|
144
|
+
command,
|
|
145
|
+
describe,
|
|
146
|
+
builder,
|
|
148
147
|
handler,
|
|
149
148
|
};
|
|
149
|
+
exports.default = projectDeployCommand;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ArgumentsCamelCase, Argv } from 'yargs';
|
|
1
|
+
import { ArgumentsCamelCase, Argv, CommandModule } from 'yargs';
|
|
2
2
|
import { ProjectDevArgs } from '../../../types/Yargs';
|
|
3
3
|
export declare const command = "dev";
|
|
4
4
|
export declare const describe: string;
|
|
5
5
|
export declare function handler(args: ArgumentsCamelCase<ProjectDevArgs>): Promise<void>;
|
|
6
|
-
export declare
|
|
6
|
+
export declare const builder: (yargs: Argv) => Promise<Argv<ProjectDevArgs>>;
|
|
7
|
+
declare const projectDevCommand: CommandModule<unknown, ProjectDevArgs>;
|
|
8
|
+
export default projectDevCommand;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = exports.command = void 0;
|
|
3
|
+
exports.builder = exports.describe = exports.command = void 0;
|
|
4
4
|
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
|
-
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
7
5
|
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
8
6
|
const lang_1 = require("../../../lib/lang");
|
|
9
7
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
@@ -14,6 +12,7 @@ const ui_1 = require("../../../lib/ui");
|
|
|
14
12
|
const deprecatedFlow_1 = require("./deprecatedFlow");
|
|
15
13
|
const unifiedFlow_1 = require("./unifiedFlow");
|
|
16
14
|
const buildAndDeploy_1 = require("../../../lib/projects/buildAndDeploy");
|
|
15
|
+
const yargsUtils_1 = require("../../../lib/yargsUtils");
|
|
17
16
|
exports.command = 'dev';
|
|
18
17
|
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.dev.describe`), false);
|
|
19
18
|
async function handler(args) {
|
|
@@ -42,10 +41,7 @@ async function handler(args) {
|
|
|
42
41
|
await (0, deprecatedFlow_1.deprecatedProjectDevFlow)(args, accountConfig, projectConfig, projectDir);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
function
|
|
46
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
47
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
48
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
44
|
+
function projectDevBuilder(yargs) {
|
|
49
45
|
yargs.example([
|
|
50
46
|
[
|
|
51
47
|
'$0 project dev',
|
|
@@ -54,3 +50,16 @@ function builder(yargs) {
|
|
|
54
50
|
]);
|
|
55
51
|
return yargs;
|
|
56
52
|
}
|
|
53
|
+
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectDevBuilder, exports.command, exports.describe, {
|
|
54
|
+
useGlobalOptions: true,
|
|
55
|
+
useAccountOptions: true,
|
|
56
|
+
useConfigOptions: true,
|
|
57
|
+
useEnvironmentOptions: true,
|
|
58
|
+
});
|
|
59
|
+
const projectDevCommand = {
|
|
60
|
+
command: exports.command,
|
|
61
|
+
describe: exports.describe,
|
|
62
|
+
handler,
|
|
63
|
+
builder: exports.builder,
|
|
64
|
+
};
|
|
65
|
+
exports.default = projectDevCommand;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "download";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type ProjectDownloadArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
6
3
|
project?: string;
|
|
7
4
|
dest?: string;
|
|
8
5
|
build?: number;
|
|
9
6
|
};
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
export {};
|
|
7
|
+
declare const projectDownloadCommand: YargsCommandModule<unknown, ProjectDownloadArgs>;
|
|
8
|
+
export default projectDownloadCommand;
|