@hubspot/cli 7.5.1-beta.0 → 7.5.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/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/dev/unifiedFlow.js +1 -0
- package/lang/en.d.ts +49 -3
- package/lang/en.js +51 -5
- package/lang/en.lyaml +1 -1
- package/lib/constants.d.ts +12 -0
- package/lib/constants.js +13 -1
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -2
- package/lib/projects/localDev/AppDevModeInterface.js +30 -2
- package/lib/projects/localDev/LocalDevProcess.d.ts +4 -0
- package/lib/projects/localDev/LocalDevProcess.js +12 -0
- package/lib/projects/localDev/LocalDevState.d.ts +8 -2
- package/lib/projects/localDev/LocalDevState.js +18 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +1 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +18 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +36 -13
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/package.json +4 -3
- package/types/LocalDev.d.ts +9 -0
- package/types/Projects.d.ts +19 -2
- package/lib/projects/create.d.ts +0 -5
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { YargsCommandModule, CommonArgs } from '../../types/Yargs';
|
|
2
2
|
type ProjectAddArgs = CommonArgs & {
|
|
3
|
-
type
|
|
4
|
-
name
|
|
3
|
+
type?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
features?: string[];
|
|
6
|
+
distribution?: string;
|
|
7
|
+
auth?: string;
|
|
5
8
|
};
|
|
6
9
|
declare const projectAddCommand: YargsCommandModule<unknown, ProjectAddArgs>;
|
|
7
10
|
export default projectAddCommand;
|
package/commands/project/add.js
CHANGED
|
@@ -1,87 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
-
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
9
3
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
10
4
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
11
|
-
const lang_1 = require("../../lib/lang");
|
|
12
|
-
const projectAddPrompt_1 = require("../../lib/prompts/projectAddPrompt");
|
|
13
5
|
const config_1 = require("../../lib/projects/config");
|
|
14
|
-
const create_1 = require("../../lib/projects/create");
|
|
15
|
-
const structure_1 = require("../../lib/projects/structure");
|
|
16
|
-
const Projects_1 = require("../../types/Projects");
|
|
17
6
|
const ui_1 = require("../../lib/ui");
|
|
18
|
-
const constants_1 = require("../../lib/constants");
|
|
19
7
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
8
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
9
|
+
const en_1 = require("../../lang/en");
|
|
10
|
+
const buildAndDeploy_1 = require("../../lib/projects/buildAndDeploy");
|
|
11
|
+
const legacyAddComponent_1 = require("../../lib/projects/add/legacyAddComponent");
|
|
12
|
+
const v3AddComponent_1 = require("../../lib/projects/add/v3AddComponent");
|
|
13
|
+
const constants_1 = require("../../lib/constants");
|
|
14
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
21
15
|
const command = 'add';
|
|
22
|
-
const describe = (0, ui_1.uiBetaTag)(
|
|
16
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.add.describe, false);
|
|
23
17
|
async function handler(args) {
|
|
24
|
-
const { derivedAccountId } = args;
|
|
25
|
-
(0, usageTracking_1.trackCommandUsage)('project-add', undefined, derivedAccountId);
|
|
26
|
-
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
27
|
-
if (!projectDir || !projectConfig) {
|
|
28
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.add.error.locationInProject`));
|
|
29
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
|
-
}
|
|
31
|
-
// We currently only support adding private apps to projects
|
|
32
|
-
let projectContainsPublicApp = false;
|
|
33
|
-
try {
|
|
34
|
-
const components = await (0, structure_1.findProjectComponents)(projectDir);
|
|
35
|
-
projectContainsPublicApp = components.some(c => c.type === Projects_1.ComponentTypes.PublicApp);
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
(0, errorHandlers_1.debugError)(err);
|
|
39
|
-
}
|
|
40
|
-
if (projectContainsPublicApp) {
|
|
41
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.add.error.projectContainsPublicApp`));
|
|
42
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
43
|
-
}
|
|
44
|
-
logger_1.logger.log('');
|
|
45
|
-
logger_1.logger.log((0, lang_1.i18n)(`commands.project.subcommands.add.creatingComponent`, {
|
|
46
|
-
projectName: projectConfig.name,
|
|
47
|
-
}));
|
|
48
|
-
logger_1.logger.log('');
|
|
49
|
-
let latestRepoReleaseTag;
|
|
50
18
|
try {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
19
|
+
const { derivedAccountId } = args;
|
|
20
|
+
(0, usageTracking_1.trackCommandUsage)('project-add', undefined, derivedAccountId);
|
|
21
|
+
const { projectConfig, projectDir } = await (0, config_1.getProjectConfig)();
|
|
22
|
+
if (!projectDir || !projectConfig) {
|
|
23
|
+
logger_1.uiLogger.error(en_1.commands.project.add.error.locationInProject);
|
|
24
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
25
|
+
}
|
|
26
|
+
const isV3ProjectCreate = (0, buildAndDeploy_1.useV3Api)(projectConfig.platformVersion);
|
|
27
|
+
if (isV3ProjectCreate) {
|
|
28
|
+
await (0, v3AddComponent_1.v3AddComponent)(args, projectDir, projectConfig);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
await (0, legacyAddComponent_1.legacyAddComponent)(args, projectDir, projectConfig);
|
|
55
32
|
}
|
|
56
33
|
}
|
|
57
|
-
catch (
|
|
58
|
-
(0, errorHandlers_1.
|
|
59
|
-
}
|
|
60
|
-
if (!latestRepoReleaseTag) {
|
|
61
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.add.error.failedToFetchComponentList`));
|
|
62
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
63
|
-
}
|
|
64
|
-
const components = await (0, create_1.getProjectComponentListFromRepo)(latestRepoReleaseTag);
|
|
65
|
-
if (!components.length) {
|
|
66
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.add.error.failedToFetchComponentList`));
|
|
67
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
68
|
-
}
|
|
69
|
-
const projectAddPromptResponse = await (0, projectAddPrompt_1.projectAddPrompt)(components, args);
|
|
70
|
-
try {
|
|
71
|
-
const componentPath = path_1.default.join(projectDir, projectConfig.srcDir, projectAddPromptResponse.componentTemplate.insertPath, projectAddPromptResponse.name);
|
|
72
|
-
await (0, github_1.cloneGithubRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, componentPath, {
|
|
73
|
-
sourceDir: projectAddPromptResponse.componentTemplate.path,
|
|
74
|
-
tag: latestRepoReleaseTag,
|
|
75
|
-
hideLogs: true,
|
|
76
|
-
});
|
|
77
|
-
logger_1.logger.log('');
|
|
78
|
-
logger_1.logger.success((0, lang_1.i18n)(`commands.project.subcommands.add.success`, {
|
|
79
|
-
componentName: projectAddPromptResponse.name,
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
(0, errorHandlers_1.debugError)(error);
|
|
84
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.add.error.failedToDownloadComponent`));
|
|
34
|
+
catch (e) {
|
|
35
|
+
(0, errorHandlers_1.logError)(e);
|
|
85
36
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
86
37
|
}
|
|
87
38
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
@@ -89,24 +40,36 @@ async function handler(args) {
|
|
|
89
40
|
function projectAddBuilder(yargs) {
|
|
90
41
|
yargs.options({
|
|
91
42
|
type: {
|
|
92
|
-
describe:
|
|
43
|
+
describe: en_1.commands.project.add.options.type.describe,
|
|
93
44
|
type: 'string',
|
|
94
45
|
},
|
|
95
46
|
name: {
|
|
96
|
-
describe:
|
|
47
|
+
describe: en_1.commands.project.add.options.name.describe,
|
|
48
|
+
type: 'string',
|
|
49
|
+
},
|
|
50
|
+
distribution: {
|
|
51
|
+
describe: en_1.commands.project.add.options.distribution.describe,
|
|
52
|
+
hidden: true,
|
|
97
53
|
type: 'string',
|
|
54
|
+
choices: [constants_1.privateDistribution, constants_1.marketplaceDistribution],
|
|
55
|
+
},
|
|
56
|
+
auth: {
|
|
57
|
+
describe: en_1.commands.project.add.options.auth.describe,
|
|
58
|
+
hidden: true,
|
|
59
|
+
type: 'string',
|
|
60
|
+
choices: [constants_1.oAuth, constants_1.staticAuth],
|
|
61
|
+
},
|
|
62
|
+
features: {
|
|
63
|
+
describe: en_1.commands.project.add.options.features.describe,
|
|
64
|
+
hidden: true,
|
|
65
|
+
type: 'array',
|
|
98
66
|
},
|
|
99
67
|
});
|
|
100
|
-
yargs.example([
|
|
101
|
-
[
|
|
102
|
-
'$0 project add',
|
|
103
|
-
(0, lang_1.i18n)(`commands.project.subcommands.add.examples.default`),
|
|
104
|
-
],
|
|
105
|
-
]);
|
|
68
|
+
yargs.example([['$0 project add', en_1.commands.project.add.examples.default]]);
|
|
106
69
|
yargs.example([
|
|
107
70
|
[
|
|
108
71
|
'$0 project add --name="my-component" --type="components/example-app"',
|
|
109
|
-
|
|
72
|
+
en_1.commands.project.add.examples.withFlags,
|
|
110
73
|
],
|
|
111
74
|
]);
|
|
112
75
|
return yargs;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
type ProjectCreateArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & {
|
|
4
|
-
name?: string;
|
|
5
|
-
dest?: string;
|
|
6
|
-
templateSource?: RepoPath;
|
|
7
|
-
template?: string;
|
|
8
|
-
};
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs';
|
|
2
|
+
import { ProjectCreateArgs } from '../../lib/projects/create';
|
|
9
3
|
declare const projectCreateCommand: YargsCommandModule<unknown, ProjectCreateArgs>;
|
|
10
4
|
export default projectCreateCommand;
|
|
@@ -5,71 +5,75 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = __importDefault(require("path"));
|
|
7
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
8
|
const github_1 = require("@hubspot/local-dev-lib/github");
|
|
11
9
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
12
10
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
13
|
-
const createProjectPrompt_1 = require("../../lib/prompts/createProjectPrompt");
|
|
14
11
|
const config_1 = require("../../lib/projects/config");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
12
|
+
const legacy_1 = require("../../lib/projects/create/legacy");
|
|
13
|
+
const v3_1 = require("../../lib/projects/create/v3");
|
|
17
14
|
const ui_1 = require("../../lib/ui");
|
|
18
15
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
19
16
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
17
|
const constants_1 = require("../../lib/constants");
|
|
21
18
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
19
|
+
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
20
|
+
const en_1 = require("../../lang/en");
|
|
21
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
22
|
+
const v3_2 = require("../../lib/projects/create/v3");
|
|
23
|
+
const create_1 = require("../../lib/projects/create");
|
|
24
|
+
const command = ['create', 'init'];
|
|
25
|
+
const describe = (0, ui_1.uiBetaTag)(en_1.commands.project.create.describe, false);
|
|
26
|
+
const { v2023_2, v2025_1, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
24
27
|
async function handler(args) {
|
|
25
|
-
const { derivedAccountId } = args;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!templateSource) {
|
|
29
|
-
templateSource = constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
30
|
-
try {
|
|
31
|
-
const releaseData = await (0, github_1.fetchReleaseData)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH);
|
|
32
|
-
if (releaseData) {
|
|
33
|
-
latestRepoReleaseTag = releaseData.tag_name;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.errors.failedToFetchProjectList`));
|
|
38
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (!templateSource || !templateSource.includes('/')) {
|
|
42
|
-
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.create.errors.invalidTemplateSource`));
|
|
28
|
+
const { derivedAccountId, platformVersion, templateSource } = args;
|
|
29
|
+
if (templateSource && !templateSource.includes('/')) {
|
|
30
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.invalidTemplateSource);
|
|
43
31
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
44
32
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
const repo = templateSource || constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH;
|
|
34
|
+
let handleResult;
|
|
35
|
+
try {
|
|
36
|
+
handleResult = await (0, create_1.handleProjectCreationFlow)(args);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
(0, errorHandlers_1.logError)(error);
|
|
48
40
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
49
41
|
}
|
|
50
|
-
const
|
|
42
|
+
const { authType, distribution, repoConfig, projectContents, createProjectPromptResponse, } = handleResult;
|
|
43
|
+
(0, usageTracking_1.trackCommandUsage)('project-create', {
|
|
44
|
+
type: createProjectPromptResponse.projectTemplate?.name ||
|
|
45
|
+
(createProjectPromptResponse.componentTemplates || [])
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
.map((item) => item.label)
|
|
48
|
+
.join(','),
|
|
49
|
+
}, derivedAccountId);
|
|
51
50
|
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
51
|
const { projectConfig: existingProjectConfig, projectDir: existingProjectDir, } = await (0, config_1.getProjectConfig)(projectDest);
|
|
54
52
|
// Exit if the target destination is within an existing project
|
|
55
53
|
if (existingProjectConfig &&
|
|
56
54
|
existingProjectDir &&
|
|
57
55
|
projectDest.startsWith(existingProjectDir)) {
|
|
58
|
-
logger_1.
|
|
59
|
-
projectDir: existingProjectDir,
|
|
60
|
-
}));
|
|
56
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.cannotNestProjects(existingProjectDir));
|
|
61
57
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
62
58
|
}
|
|
59
|
+
const components = (0, v3_2.generateComponentPaths)({
|
|
60
|
+
createProjectPromptResponse,
|
|
61
|
+
platformVersion,
|
|
62
|
+
repoConfig,
|
|
63
|
+
projectContents,
|
|
64
|
+
authType,
|
|
65
|
+
distribution,
|
|
66
|
+
});
|
|
63
67
|
try {
|
|
64
|
-
await (0, github_1.cloneGithubRepo)(
|
|
65
|
-
sourceDir: createProjectPromptResponse.projectTemplate
|
|
66
|
-
tag: latestRepoReleaseTag,
|
|
68
|
+
await (0, github_1.cloneGithubRepo)(repo, projectDest, {
|
|
69
|
+
sourceDir: createProjectPromptResponse.projectTemplate?.path || components,
|
|
67
70
|
hideLogs: true,
|
|
71
|
+
branch: 'main',
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
74
|
catch (err) {
|
|
71
75
|
(0, errorHandlers_1.debugError)(err);
|
|
72
|
-
logger_1.
|
|
76
|
+
logger_1.uiLogger.error(en_1.commands.project.create.errors.failedToDownloadProject);
|
|
73
77
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
74
78
|
}
|
|
75
79
|
const projectConfigPath = path_1.default.join(projectDest, constants_1.PROJECT_CONFIG_FILE);
|
|
@@ -79,17 +83,13 @@ async function handler(args) {
|
|
|
79
83
|
name: createProjectPromptResponse.name,
|
|
80
84
|
});
|
|
81
85
|
// If the template is 'no-template', we need to manually create a src directory
|
|
82
|
-
if (createProjectPromptResponse.projectTemplate
|
|
83
|
-
|
|
86
|
+
if (createProjectPromptResponse.projectTemplate?.name ===
|
|
87
|
+
legacy_1.EMPTY_PROJECT_TEMPLATE_NAME ||
|
|
88
|
+
projectContents === v3_1.EMPTY_PROJECT) {
|
|
84
89
|
fs_extra_1.default.ensureDirSync(path_1.default.join(projectDest, 'src'));
|
|
85
90
|
}
|
|
86
|
-
logger_1.
|
|
87
|
-
logger_1.
|
|
88
|
-
projectName: createProjectPromptResponse.name,
|
|
89
|
-
projectDest,
|
|
90
|
-
}));
|
|
91
|
-
logger_1.logger.log('');
|
|
92
|
-
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`commands.project.subcommands.create.logs.welcomeMessage`)));
|
|
91
|
+
logger_1.uiLogger.success(en_1.commands.project.create.logs.success(createProjectPromptResponse.name, projectDest));
|
|
92
|
+
logger_1.uiLogger.log(en_1.commands.project.create.logs.welcomeMessage);
|
|
93
93
|
(0, ui_1.uiFeatureHighlight)([
|
|
94
94
|
'projectCommandTip',
|
|
95
95
|
'projectUploadCommand',
|
|
@@ -104,32 +104,61 @@ async function handler(args) {
|
|
|
104
104
|
function projectCreateBuilder(yargs) {
|
|
105
105
|
yargs.options({
|
|
106
106
|
name: {
|
|
107
|
-
describe:
|
|
107
|
+
describe: en_1.commands.project.create.options.name.describe,
|
|
108
108
|
type: 'string',
|
|
109
109
|
},
|
|
110
110
|
dest: {
|
|
111
|
-
describe:
|
|
111
|
+
describe: en_1.commands.project.create.options.dest.describe,
|
|
112
112
|
type: 'string',
|
|
113
113
|
},
|
|
114
114
|
template: {
|
|
115
|
-
|
|
115
|
+
// TODO: When we release 2025.2 scaffolding, we need to point out this is only valid for 2025.1 prior
|
|
116
|
+
describe: en_1.commands.project.create.options.template.describe,
|
|
116
117
|
type: 'string',
|
|
117
118
|
},
|
|
118
119
|
'template-source': {
|
|
119
|
-
describe:
|
|
120
|
+
describe: en_1.commands.project.create.options.templateSource.describe,
|
|
121
|
+
type: 'string',
|
|
122
|
+
},
|
|
123
|
+
'platform-version': {
|
|
124
|
+
describe: en_1.commands.project.create.options.platformVersion.describe,
|
|
125
|
+
hidden: true,
|
|
120
126
|
type: 'string',
|
|
127
|
+
choices: [v2023_2, v2025_1, v2025_2],
|
|
128
|
+
default: v2023_2,
|
|
129
|
+
},
|
|
130
|
+
'project-base': {
|
|
131
|
+
describe: en_1.commands.project.create.options.projectBase.describe,
|
|
132
|
+
hidden: true,
|
|
133
|
+
type: 'string',
|
|
134
|
+
choices: [v3_1.EMPTY_PROJECT, v3_1.PROJECT_WITH_APP],
|
|
135
|
+
},
|
|
136
|
+
distribution: {
|
|
137
|
+
describe: en_1.commands.project.create.options.distribution.describe,
|
|
138
|
+
hidden: true,
|
|
139
|
+
type: 'string',
|
|
140
|
+
choices: [constants_1.privateDistribution, constants_1.marketplaceDistribution],
|
|
141
|
+
},
|
|
142
|
+
auth: {
|
|
143
|
+
describe: en_1.commands.project.create.options.auth.describe,
|
|
144
|
+
hidden: true,
|
|
145
|
+
type: 'string',
|
|
146
|
+
choices: [constants_1.oAuth, constants_1.staticAuth],
|
|
147
|
+
},
|
|
148
|
+
features: {
|
|
149
|
+
describe: en_1.commands.project.create.options.features.describe,
|
|
150
|
+
hidden: true,
|
|
151
|
+
type: 'array',
|
|
121
152
|
},
|
|
122
153
|
});
|
|
154
|
+
yargs.conflicts('template', 'features');
|
|
123
155
|
yargs.example([
|
|
124
|
-
[
|
|
125
|
-
'$0 project create',
|
|
126
|
-
(0, lang_1.i18n)(`commands.project.subcommands.create.examples.default`),
|
|
127
|
-
],
|
|
156
|
+
['$0 project create', en_1.commands.project.create.examples.default],
|
|
128
157
|
]);
|
|
129
158
|
yargs.example([
|
|
130
159
|
[
|
|
131
160
|
'$0 project create --template-source HubSpot/ui-extensions-examples',
|
|
132
|
-
|
|
161
|
+
en_1.commands.project.create.examples.templateSource,
|
|
133
162
|
],
|
|
134
163
|
]);
|
|
135
164
|
return yargs;
|
package/lang/en.d.ts
CHANGED
|
@@ -878,7 +878,13 @@ Local development of unified apps is currently only compatible with accounts tha
|
|
|
878
878
|
};
|
|
879
879
|
readonly logs: {
|
|
880
880
|
readonly success: (projectName: string, projectDest: string) => string;
|
|
881
|
-
readonly welcomeMessage:
|
|
881
|
+
readonly welcomeMessage: `
|
|
882
|
+
${string}`;
|
|
883
|
+
};
|
|
884
|
+
readonly prompts: {
|
|
885
|
+
readonly parentComponents: "[--project-base] What would you like in your project?";
|
|
886
|
+
readonly emptyProject: "Empty Project";
|
|
887
|
+
readonly app: "App";
|
|
882
888
|
};
|
|
883
889
|
readonly examples: {
|
|
884
890
|
readonly default: "Create a new project";
|
|
@@ -897,6 +903,21 @@ Local development of unified apps is currently only compatible with accounts tha
|
|
|
897
903
|
readonly templateSource: {
|
|
898
904
|
readonly describe: "Path to custom GitHub repository from which to create project template";
|
|
899
905
|
};
|
|
906
|
+
readonly platformVersion: {
|
|
907
|
+
readonly describe: "The target platform version for the new project.";
|
|
908
|
+
};
|
|
909
|
+
readonly projectBase: {
|
|
910
|
+
readonly describe: "The top level component to include in the project.";
|
|
911
|
+
};
|
|
912
|
+
readonly distribution: {
|
|
913
|
+
readonly describe: "How the app will be distributed.";
|
|
914
|
+
};
|
|
915
|
+
readonly auth: {
|
|
916
|
+
readonly describe: "Authentication model for the application.";
|
|
917
|
+
};
|
|
918
|
+
readonly features: {
|
|
919
|
+
readonly describe: "Features to include in the project. Only valid if project-base is app";
|
|
920
|
+
};
|
|
900
921
|
};
|
|
901
922
|
};
|
|
902
923
|
readonly migrateApp: {
|
|
@@ -982,11 +1003,23 @@ Local development of unified apps is currently only compatible with accounts tha
|
|
|
982
1003
|
readonly type: {
|
|
983
1004
|
readonly describe: "The path to the component type's location within the hubspot-project-components Github repo: https://github.com/HubSpot/hubspot-project-components";
|
|
984
1005
|
};
|
|
1006
|
+
readonly distribution: {
|
|
1007
|
+
readonly describe: "The distribution method for the application.";
|
|
1008
|
+
};
|
|
1009
|
+
readonly auth: {
|
|
1010
|
+
readonly describe: "The authentication type for the application.";
|
|
1011
|
+
};
|
|
1012
|
+
readonly features: {
|
|
1013
|
+
readonly describe: "Which features to include with the application.";
|
|
1014
|
+
};
|
|
985
1015
|
};
|
|
986
1016
|
readonly creatingComponent: (projectName: string) => string;
|
|
987
|
-
readonly success: (componentName: string) => string;
|
|
1017
|
+
readonly success: (componentName: string, multiple?: boolean) => string;
|
|
988
1018
|
readonly error: {
|
|
989
1019
|
readonly failedToDownloadComponent: "Failed to download project component. Please try again later.";
|
|
1020
|
+
readonly maxExceeded: (maxCount: number) => string;
|
|
1021
|
+
readonly authTypeNotAllowed: (authType: string) => string;
|
|
1022
|
+
readonly distributionNotAllowed: (dist: string) => string;
|
|
990
1023
|
readonly locationInProject: "This command must be run from within a project directory.";
|
|
991
1024
|
readonly failedToFetchComponentList: "Failed to fetch the list of available components. Please try again later.";
|
|
992
1025
|
readonly projectContainsPublicApp: "This project contains a public app. This command is currently only compatible with projects that contain private apps.";
|
|
@@ -2355,10 +2388,21 @@ Run ${string} to upgrade to version ${string}`;
|
|
|
2355
2388
|
};
|
|
2356
2389
|
readonly projects: {
|
|
2357
2390
|
readonly create: {
|
|
2391
|
+
readonly prompt: {
|
|
2392
|
+
readonly marketPlaceDistribution: "On the HubSpot marketplace";
|
|
2393
|
+
readonly privateDistribution: "Privately";
|
|
2394
|
+
readonly distribution: "[--distribution] How would you like to distribute your application?";
|
|
2395
|
+
readonly auth: "[--auth] What type of authentication would you like your application to use";
|
|
2396
|
+
readonly staticAuth: "Static Auth";
|
|
2397
|
+
readonly oauth: "OAuth";
|
|
2398
|
+
};
|
|
2358
2399
|
readonly errors: {
|
|
2359
2400
|
readonly noProjectsInConfig: "Unable to find any projects in the target repository's config.json file. Please ensure that there is a \"projects\" array in the config file.";
|
|
2360
2401
|
readonly missingConfigFileTemplateSource: "Failed to fetch the config.json file from the target repository. Please ensure that there is a valid config.json file at the root of the repository and try again.";
|
|
2361
|
-
readonly missingPropertiesInConfig: "Found misconfigured projects in the target repository's config.json file. Please ensure that each project in the target repository's config.json file contains the following properties: [\"name\", \"label\", \"path\"
|
|
2402
|
+
readonly missingPropertiesInConfig: "Found misconfigured projects in the target repository's config.json file. Please ensure that each project in the target repository's config.json file contains the following properties: [\"name\", \"label\", \"path\"].";
|
|
2403
|
+
readonly exceededMaxNumberOfApps: (max: number) => string;
|
|
2404
|
+
readonly unableToParseAppConfig: (file: string) => string;
|
|
2405
|
+
readonly invalidAuthDistCombo: (authType: string, distribution: string) => string;
|
|
2362
2406
|
};
|
|
2363
2407
|
};
|
|
2364
2408
|
readonly validateProjectConfig: {
|
|
@@ -2718,7 +2762,9 @@ Run ${string} to upgrade to version ${string}`;
|
|
|
2718
2762
|
readonly enterName: "[--name] Give your component a name: ";
|
|
2719
2763
|
readonly errors: {
|
|
2720
2764
|
readonly nameRequired: "A component name is required";
|
|
2765
|
+
readonly componentRequired: "Must select a feature to add";
|
|
2721
2766
|
readonly invalidType: (type: string) => string;
|
|
2767
|
+
readonly cannotAddFeature: (feature: string, reasons: string | boolean) => string;
|
|
2722
2768
|
};
|
|
2723
2769
|
};
|
|
2724
2770
|
readonly secretPrompt: {
|
package/lang/en.js
CHANGED
|
@@ -11,6 +11,7 @@ const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
|
11
11
|
const ui_1 = require("../lib/ui");
|
|
12
12
|
const urls_1 = require("../lib/projects/urls");
|
|
13
13
|
const constants_1 = require("../lib/constants");
|
|
14
|
+
const v3_1 = require("../lib/projects/create/v3");
|
|
14
15
|
exports.commands = {
|
|
15
16
|
generalErrors: {
|
|
16
17
|
srcIsProject: (src, command) => `"${src}" is in a project folder. Did you mean "hs project ${command}"?`,
|
|
@@ -878,8 +879,13 @@ exports.commands = {
|
|
|
878
879
|
cannotNestProjects: (projectDir) => `A project already exists at ${projectDir}. Projects cannot be nested within other projects. Please choose a different destination and try again.`,
|
|
879
880
|
},
|
|
880
881
|
logs: {
|
|
881
|
-
success: (projectName, projectDest) =>
|
|
882
|
-
welcomeMessage: 'Welcome to HubSpot Developer Projects!'
|
|
882
|
+
success: (projectName, projectDest) => `\nProject ${chalk_1.default.bold(projectName)} was successfully created in ${projectDest}`,
|
|
883
|
+
welcomeMessage: `\n${chalk_1.default.bold('Welcome to HubSpot Developer Projects!')}`,
|
|
884
|
+
},
|
|
885
|
+
prompts: {
|
|
886
|
+
parentComponents: '[--project-base] What would you like in your project?',
|
|
887
|
+
emptyProject: 'Empty Project',
|
|
888
|
+
app: 'App',
|
|
883
889
|
},
|
|
884
890
|
examples: {
|
|
885
891
|
default: 'Create a new project',
|
|
@@ -898,6 +904,21 @@ exports.commands = {
|
|
|
898
904
|
templateSource: {
|
|
899
905
|
describe: 'Path to custom GitHub repository from which to create project template',
|
|
900
906
|
},
|
|
907
|
+
platformVersion: {
|
|
908
|
+
describe: 'The target platform version for the new project.',
|
|
909
|
+
},
|
|
910
|
+
projectBase: {
|
|
911
|
+
describe: 'The top level component to include in the project.',
|
|
912
|
+
},
|
|
913
|
+
distribution: {
|
|
914
|
+
describe: 'How the app will be distributed.',
|
|
915
|
+
},
|
|
916
|
+
auth: {
|
|
917
|
+
describe: 'Authentication model for the application.',
|
|
918
|
+
},
|
|
919
|
+
features: {
|
|
920
|
+
describe: `Features to include in the project. Only valid if project-base is ${v3_1.PROJECT_WITH_APP}`,
|
|
921
|
+
},
|
|
901
922
|
},
|
|
902
923
|
},
|
|
903
924
|
migrateApp: {
|
|
@@ -983,11 +1004,23 @@ exports.commands = {
|
|
|
983
1004
|
type: {
|
|
984
1005
|
describe: "The path to the component type's location within the hubspot-project-components Github repo: https://github.com/HubSpot/hubspot-project-components",
|
|
985
1006
|
},
|
|
1007
|
+
distribution: {
|
|
1008
|
+
describe: 'The distribution method for the application.',
|
|
1009
|
+
},
|
|
1010
|
+
auth: {
|
|
1011
|
+
describe: 'The authentication type for the application.',
|
|
1012
|
+
},
|
|
1013
|
+
features: {
|
|
1014
|
+
describe: 'Which features to include with the application.',
|
|
1015
|
+
},
|
|
986
1016
|
},
|
|
987
|
-
creatingComponent: (projectName) =>
|
|
988
|
-
success: (componentName) => `${componentName} was successfully added to your
|
|
1017
|
+
creatingComponent: (projectName) => `\nAdding a new component to ${chalk_1.default.bold(projectName)}\n`,
|
|
1018
|
+
success: (componentName, multiple = false) => `${componentName} ${multiple ? 'were' : 'was'} successfully added to your app.`,
|
|
989
1019
|
error: {
|
|
990
1020
|
failedToDownloadComponent: 'Failed to download project component. Please try again later.',
|
|
1021
|
+
maxExceeded: (maxCount) => `This project has the maximum allowed(${maxCount})`,
|
|
1022
|
+
authTypeNotAllowed: (authType) => `Auth type '${authType}' not allowed.`,
|
|
1023
|
+
distributionNotAllowed: (dist) => `Distribution '${dist}' not allowed.`,
|
|
991
1024
|
locationInProject: 'This command must be run from within a project directory.',
|
|
992
1025
|
failedToFetchComponentList: 'Failed to fetch the list of available components. Please try again later.',
|
|
993
1026
|
projectContainsPublicApp: 'This project contains a public app. This command is currently only compatible with projects that contain private apps.',
|
|
@@ -2353,10 +2386,21 @@ exports.lib = {
|
|
|
2353
2386
|
},
|
|
2354
2387
|
projects: {
|
|
2355
2388
|
create: {
|
|
2389
|
+
prompt: {
|
|
2390
|
+
marketPlaceDistribution: 'On the HubSpot marketplace',
|
|
2391
|
+
privateDistribution: 'Privately',
|
|
2392
|
+
distribution: '[--distribution] How would you like to distribute your application?',
|
|
2393
|
+
auth: '[--auth] What type of authentication would you like your application to use',
|
|
2394
|
+
staticAuth: 'Static Auth',
|
|
2395
|
+
oauth: 'OAuth',
|
|
2396
|
+
},
|
|
2356
2397
|
errors: {
|
|
2357
2398
|
noProjectsInConfig: 'Unable to find any projects in the target repository\'s config.json file. Please ensure that there is a "projects" array in the config file.',
|
|
2358
2399
|
missingConfigFileTemplateSource: 'Failed to fetch the config.json file from the target repository. Please ensure that there is a valid config.json file at the root of the repository and try again.',
|
|
2359
|
-
missingPropertiesInConfig: 'Found misconfigured projects in the target repository\'s config.json file. Please ensure that each project in the target repository\'s config.json file contains the following properties: ["name", "label", "path"
|
|
2400
|
+
missingPropertiesInConfig: 'Found misconfigured projects in the target repository\'s config.json file. Please ensure that each project in the target repository\'s config.json file contains the following properties: ["name", "label", "path"].',
|
|
2401
|
+
exceededMaxNumberOfApps: (max) => `This project currently has the maximum number of apps: ${max}`,
|
|
2402
|
+
unableToParseAppConfig: (file) => `Unable to parse app file: ${file}`,
|
|
2403
|
+
invalidAuthDistCombo: (authType, distribution) => `Invalid distribution and auth combination. Apps with distribution '${distribution}' must have auth '${authType}'`,
|
|
2360
2404
|
},
|
|
2361
2405
|
},
|
|
2362
2406
|
validateProjectConfig: {
|
|
@@ -2714,7 +2758,9 @@ exports.lib = {
|
|
|
2714
2758
|
enterName: '[--name] Give your component a name: ',
|
|
2715
2759
|
errors: {
|
|
2716
2760
|
nameRequired: 'A component name is required',
|
|
2761
|
+
componentRequired: 'Must select a feature to add',
|
|
2717
2762
|
invalidType: (type) => `[--type] Could not find type "${type}". Please choose an available type:`,
|
|
2763
|
+
cannotAddFeature: (feature, reasons) => `Cannot Add feature '${feature}' to project for the following reasons: ${reasons}`,
|
|
2718
2764
|
},
|
|
2719
2765
|
},
|
|
2720
2766
|
secretPrompt: {
|
package/lang/en.lyaml
CHANGED
|
@@ -1033,7 +1033,7 @@ en:
|
|
|
1033
1033
|
errors:
|
|
1034
1034
|
noProjectsInConfig: "Unable to find any projects in the target repository's config.json file. Please ensure that there is a \"projects\" array in the config file."
|
|
1035
1035
|
missingConfigFileTemplateSource: "Failed to fetch the config.json file from the target repository. Please ensure that there is a valid config.json file at the root of the repository and try again."
|
|
1036
|
-
missingPropertiesInConfig: "Found misconfigured projects in the target repository's config.json file. Please ensure that each project in the target repository's config.json file contains the following properties: [\"name\", \"label\", \"path\"
|
|
1036
|
+
missingPropertiesInConfig: "Found misconfigured projects in the target repository's config.json file. Please ensure that each project in the target repository's config.json file contains the following properties: [\"name\", \"label\", \"path\"]."
|
|
1037
1037
|
validateProjectConfig:
|
|
1038
1038
|
configNotFound: "Unable to locate a project configuration file. Try running again from a project directory, or run {{ createCommand }} to create a new project."
|
|
1039
1039
|
configMissingFields: "The project configuration file is missing required fields."
|
package/lib/constants.d.ts
CHANGED
|
@@ -82,7 +82,19 @@ export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
|
82
82
|
UPLOAD_SUCCESS: string;
|
|
83
83
|
UPLOAD_FAILURE: string;
|
|
84
84
|
UPDATE_PROJECT_NODES: string;
|
|
85
|
+
UPDATE_APP_DATA: string;
|
|
86
|
+
UPDATE_PROJECT_DATA: string;
|
|
85
87
|
};
|
|
86
88
|
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
87
89
|
UPLOAD: string;
|
|
88
90
|
};
|
|
91
|
+
export declare const APP_INSTALLATION_STATES: {
|
|
92
|
+
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
93
|
+
readonly INSTALLED: "INSTALLED";
|
|
94
|
+
readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
|
|
95
|
+
};
|
|
96
|
+
export declare const staticAuth = "static";
|
|
97
|
+
export declare const oAuth = "oauth";
|
|
98
|
+
export declare const privateDistribution = "private";
|
|
99
|
+
export declare const marketplaceDistribution = "marketplace";
|
|
100
|
+
export declare const appComponent = "app";
|