@hubspot/cli 7.4.0-experimental.0 → 7.4.2-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/commands/project/create.js +1 -0
- package/lang/en.js +6 -1
- package/lang/en.lyaml +4 -0
- package/lib/DevServerManagerV2.d.ts +1 -2
- package/lib/DevServerManagerV2.js +1 -2
- package/lib/LocalDevManagerV2.js +10 -15
- package/lib/app/migrate.js +25 -5
- package/lib/projects/structure.d.ts +1 -2
- package/lib/projects/structure.js +0 -4
- package/package.json +2 -2
- package/types/ProjectComponents.d.ts +0 -15
package/lang/en.js
CHANGED
|
@@ -2841,7 +2841,7 @@ export const lib = {
|
|
|
2841
2841
|
disabledUrlText: 'See all HubSpot CLI commands here.',
|
|
2842
2842
|
featureHighlight: {
|
|
2843
2843
|
defaultTitle: "What's next?",
|
|
2844
|
-
|
|
2844
|
+
featureKeys: {
|
|
2845
2845
|
accountOption: {
|
|
2846
2846
|
command: '--account',
|
|
2847
2847
|
message: command =>
|
|
@@ -2895,6 +2895,11 @@ export const lib = {
|
|
|
2895
2895
|
message: command =>
|
|
2896
2896
|
`Run ${command} to set up your test environment and start local development`,
|
|
2897
2897
|
},
|
|
2898
|
+
projectInstallDepsCommand: {
|
|
2899
|
+
command: 'hs project install-deps',
|
|
2900
|
+
message: command =>
|
|
2901
|
+
`Run ${command} to install dependencies for your project components`,
|
|
2902
|
+
},
|
|
2898
2903
|
sampleProjects: {
|
|
2899
2904
|
linkText: "HubSpot's sample projects",
|
|
2900
2905
|
url: 'https://developers.hubspot.com/docs/platform/sample-projects?utm_source=cli&utm_content=project_create_whats_next',
|
package/lang/en.lyaml
CHANGED
|
@@ -1109,6 +1109,7 @@ en:
|
|
|
1109
1109
|
missingComponents: "Couldn't find the following components in the deployed build for this project: {{#bold}}'{{ missingComponents }}'{{/bold}}. This may cause issues in local development."
|
|
1110
1110
|
defaultWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}"
|
|
1111
1111
|
defaultPublicAppWarning: "{{#bold}}Changing project configuration requires a new project build.{{/bold}}\n\nThis will affect your public app's {{#bold}}{{ installCount }} existing {{ installText }}{{/bold}}. If your app has users in production, we strongly recommend creating a copy of this app to test your changes before proceding."
|
|
1112
|
+
defaultMarketplaceAppWarning: "{{#bold}}Changing project configuration requires creating a new project build.{{/bold}}\n\nYour marketplace app is currently installed in {{#bold}}{{ installCount }} {{ accountText }}{{/bold}}. Any uploaded changes will impact your app's users. We strongly recommend creating a copy of this app to test your changes before proceding."
|
|
1112
1113
|
header: "{{ warning }} To reflect these changes and continue testing:"
|
|
1113
1114
|
stopDev: " * Stop {{ command }}"
|
|
1114
1115
|
runUpload: " * Run {{ command }}"
|
|
@@ -1244,6 +1245,9 @@ en:
|
|
|
1244
1245
|
projectDevCommand:
|
|
1245
1246
|
command: "hs project dev"
|
|
1246
1247
|
message: "Run {{ command }} to set up your test environment and start local development"
|
|
1248
|
+
projectInstallDepsCommand:
|
|
1249
|
+
command: "hs project install-deps"
|
|
1250
|
+
message: "Run {{ command }} to install dependencies for your project components"
|
|
1247
1251
|
projectCommandTip:
|
|
1248
1252
|
message: "Tip: All project commands must be run from within a project directory"
|
|
1249
1253
|
sampleProjects:
|
|
@@ -12,11 +12,10 @@ declare class DevServerManagerV2 {
|
|
|
12
12
|
private devServers;
|
|
13
13
|
constructor();
|
|
14
14
|
iterateDevServers(callback: (serverInterface: DevServerInterface) => Promise<void>): Promise<void>;
|
|
15
|
-
setup({ projectNodes,
|
|
15
|
+
setup({ projectNodes, accountId, setActiveApp, }: {
|
|
16
16
|
projectNodes: {
|
|
17
17
|
[key: string]: IntermediateRepresentationNodeLocalDev;
|
|
18
18
|
};
|
|
19
|
-
onUploadRequired: () => void;
|
|
20
19
|
accountId: number;
|
|
21
20
|
setActiveApp: (appUid: string | undefined) => Promise<void>;
|
|
22
21
|
}): Promise<void>;
|
|
@@ -20,7 +20,7 @@ class DevServerManagerV2 {
|
|
|
20
20
|
async iterateDevServers(callback) {
|
|
21
21
|
await Promise.all(this.devServers.map(devServer => callback(devServer)));
|
|
22
22
|
}
|
|
23
|
-
async setup({ projectNodes,
|
|
23
|
+
async setup({ projectNodes, accountId, setActiveApp, }) {
|
|
24
24
|
let env;
|
|
25
25
|
const accountConfig = (0, config_1.getAccountConfig)(accountId);
|
|
26
26
|
if (accountConfig) {
|
|
@@ -31,7 +31,6 @@ class DevServerManagerV2 {
|
|
|
31
31
|
if (serverInterface.setup) {
|
|
32
32
|
await serverInterface.setup({
|
|
33
33
|
components: projectNodes,
|
|
34
|
-
onUploadRequired,
|
|
35
34
|
promptUser: promptUtils_1.promptUser,
|
|
36
35
|
logger: logger_1.logger,
|
|
37
36
|
urls: {
|
package/lib/LocalDevManagerV2.js
CHANGED
|
@@ -10,6 +10,7 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
|
10
10
|
const localDevAuth_1 = require("@hubspot/local-dev-lib/api/localDevAuth");
|
|
11
11
|
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
12
12
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
13
14
|
const constants_1 = require("./constants");
|
|
14
15
|
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
15
16
|
const DevServerManagerV2_1 = __importDefault(require("./DevServerManagerV2"));
|
|
@@ -212,16 +213,13 @@ class LocalDevManagerV2 {
|
|
|
212
213
|
: (0, ui_1.uiCommandReference)('hs project upload');
|
|
213
214
|
}
|
|
214
215
|
logUploadWarning(reason) {
|
|
215
|
-
let warning;
|
|
216
|
-
if (
|
|
217
|
-
warning = reason;
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
216
|
+
let warning = reason;
|
|
217
|
+
if (!warning) {
|
|
220
218
|
warning =
|
|
221
219
|
this.publicAppActiveInstalls && this.publicAppActiveInstalls > 0
|
|
222
|
-
? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.
|
|
220
|
+
? (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultMarketplaceAppWarning`, {
|
|
223
221
|
installCount: this.publicAppActiveInstalls,
|
|
224
|
-
|
|
222
|
+
accountText: this.publicAppActiveInstalls === 1 ? 'account' : 'accounts',
|
|
225
223
|
})
|
|
226
224
|
: (0, lang_1.i18n)(`${i18nKey}.uploadWarning.defaultWarning`);
|
|
227
225
|
}
|
|
@@ -268,10 +266,10 @@ class LocalDevManagerV2 {
|
|
|
268
266
|
const deployedComponentNames = this.deployedBuild.subbuildStatuses.map(subbuildStatus => subbuildStatus.buildName);
|
|
269
267
|
const missingProjectNodes = [];
|
|
270
268
|
Object.values(this.projectNodes).forEach(node => {
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
269
|
+
if (!deployedComponentNames.includes(node.uid)) {
|
|
270
|
+
const userFriendlyName = (0, project_parsing_lib_1.mapToUserFriendlyName)(node.componentType);
|
|
271
|
+
const label = userFriendlyName ? `[${userFriendlyName}] ` : '';
|
|
272
|
+
missingProjectNodes.push(`${label}${node.uid}`);
|
|
275
273
|
}
|
|
276
274
|
});
|
|
277
275
|
if (missingProjectNodes.length) {
|
|
@@ -284,9 +282,7 @@ class LocalDevManagerV2 {
|
|
|
284
282
|
this.watcher = chokidar_1.default.watch(this.projectDir, {
|
|
285
283
|
ignoreInitial: true,
|
|
286
284
|
});
|
|
287
|
-
const configPaths = Object.values(this.projectNodes)
|
|
288
|
-
.filter(structure_1.isAppIRNode)
|
|
289
|
-
.map(component => component.localDev.componentConfigPath);
|
|
285
|
+
const configPaths = Object.values(this.projectNodes).map(component => component.localDev.componentConfigPath);
|
|
290
286
|
const projectConfigPath = path_1.default.join(this.projectDir, constants_1.PROJECT_CONFIG_FILE);
|
|
291
287
|
configPaths.push(projectConfigPath);
|
|
292
288
|
this.watcher.on('add', filePath => {
|
|
@@ -317,7 +313,6 @@ class LocalDevManagerV2 {
|
|
|
317
313
|
try {
|
|
318
314
|
await DevServerManagerV2_1.default.setup({
|
|
319
315
|
projectNodes: this.projectNodes,
|
|
320
|
-
onUploadRequired: this.logUploadWarning.bind(this),
|
|
321
316
|
accountId: this.targetTestingAccountId,
|
|
322
317
|
setActiveApp: this.setActiveApp.bind(this),
|
|
323
318
|
});
|
package/lib/app/migrate.js
CHANGED
|
@@ -31,6 +31,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
31
31
|
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
32
32
|
const projects_3 = require("@hubspot/local-dev-lib/constants/projects");
|
|
33
33
|
const transform_1 = require("@hubspot/project-parsing-lib/src/lib/transform");
|
|
34
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
34
35
|
function getUnmigratableReason(reasonCode) {
|
|
35
36
|
switch (reasonCode) {
|
|
36
37
|
case projects_3.UNMIGRATABLE_REASONS.UP_TO_DATE:
|
|
@@ -273,15 +274,34 @@ async function migrateApp2023_2(derivedAccountId, options, accountConfig) {
|
|
|
273
274
|
}
|
|
274
275
|
const createProjectPromptResponse = await (0, createProjectPrompt_1.createProjectPrompt)(options);
|
|
275
276
|
const { name: projectName, dest: projectDest } = createProjectPromptResponse;
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
noLogs: true,
|
|
279
|
-
});
|
|
280
|
-
if (projectExists) {
|
|
277
|
+
try {
|
|
278
|
+
await (0, projects_2.fetchProject)(derivedAccountId, projectName);
|
|
281
279
|
throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.projectAlreadyExists`, {
|
|
282
280
|
projectName,
|
|
283
281
|
}));
|
|
284
282
|
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
if (!(0, index_1.isSpecifiedError)(error, { statusCode: 404 })) {
|
|
285
|
+
(0, errorHandlers_1.logError)(error, new errorHandlers_1.ApiErrorContext({ accountId: derivedAccountId }));
|
|
286
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
// const { projectExists } = await ensureProjectExists(
|
|
290
|
+
// derivedAccountId,
|
|
291
|
+
// projectName,
|
|
292
|
+
// {
|
|
293
|
+
// allowCreate: false,
|
|
294
|
+
// noLogs: true,
|
|
295
|
+
// }
|
|
296
|
+
// );
|
|
297
|
+
//
|
|
298
|
+
// if (projectExists) {
|
|
299
|
+
// throw new Error(
|
|
300
|
+
// i18n(`${i18nKey}.errors.projectAlreadyExists`, {
|
|
301
|
+
// projectName,
|
|
302
|
+
// })
|
|
303
|
+
// );
|
|
304
|
+
// }
|
|
285
305
|
await (0, usageTracking_1.trackCommandMetadataUsage)('migrate-app', { step: 'STARTED' }, derivedAccountId);
|
|
286
306
|
logger_1.logger.log('');
|
|
287
307
|
(0, ui_1.uiLine)();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentTypes, Component, GenericComponentConfig, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects';
|
|
2
2
|
import { IntermediateRepresentationNodeLocalDev } from '@hubspot/project-parsing-lib/src/lib/types';
|
|
3
|
-
import { AppIRNode
|
|
3
|
+
import { AppIRNode } from '../../types/ProjectComponents';
|
|
4
4
|
export declare const CONFIG_FILES: {
|
|
5
5
|
[k in ComponentTypes]: string;
|
|
6
6
|
};
|
|
@@ -16,4 +16,3 @@ export declare function getComponentUid(component?: Component | null): string |
|
|
|
16
16
|
export declare function componentIsApp(component?: Component | null): component is Component<PublicAppComponentConfig | PrivateAppComponentConfig>;
|
|
17
17
|
export declare function componentIsPublicApp(component?: Component | null): component is Component<PublicAppComponentConfig>;
|
|
18
18
|
export declare function isAppIRNode(component: IntermediateRepresentationNodeLocalDev): component is AppIRNode;
|
|
19
|
-
export declare function isCardIRNode(component: IntermediateRepresentationNodeLocalDev): component is CardIRNode;
|
|
@@ -44,7 +44,6 @@ exports.getComponentUid = getComponentUid;
|
|
|
44
44
|
exports.componentIsApp = componentIsApp;
|
|
45
45
|
exports.componentIsPublicApp = componentIsPublicApp;
|
|
46
46
|
exports.isAppIRNode = isAppIRNode;
|
|
47
|
-
exports.isCardIRNode = isCardIRNode;
|
|
48
47
|
const fs = __importStar(require("fs"));
|
|
49
48
|
const path = __importStar(require("path"));
|
|
50
49
|
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
@@ -175,6 +174,3 @@ function componentIsPublicApp(component) {
|
|
|
175
174
|
function isAppIRNode(component) {
|
|
176
175
|
return component.componentType === constants_1.IR_COMPONENT_TYPES.APPLICATION;
|
|
177
176
|
}
|
|
178
|
-
function isCardIRNode(component) {
|
|
179
|
-
return component.componentType === constants_1.IR_COMPONENT_TYPES.CARD;
|
|
180
|
-
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.2-experimental.0",
|
|
4
4
|
"description": "The official CLI for developing on HubSpot",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/HubSpot/hubspot-cli",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@hubspot/local-dev-lib": "0.3.0-experimental.0",
|
|
9
|
-
"@hubspot/project-parsing-lib": "0.1.
|
|
9
|
+
"@hubspot/project-parsing-lib": "0.1.5",
|
|
10
10
|
"@hubspot/serverless-dev-runtime": "7.0.2",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|
|
12
12
|
"@hubspot/ui-extensions-dev-server": "0.8.52",
|
|
@@ -16,23 +16,8 @@ type AppConfig = {
|
|
|
16
16
|
conditionallyRequiredScopes: string[];
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
type CardConfig = {
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
previewImage: {
|
|
23
|
-
file: string;
|
|
24
|
-
altText: string;
|
|
25
|
-
};
|
|
26
|
-
entrypoint: string;
|
|
27
|
-
location: string;
|
|
28
|
-
objectTypes: string[];
|
|
29
|
-
};
|
|
30
19
|
export interface AppIRNode extends IntermediateRepresentationNodeLocalDev {
|
|
31
20
|
componentType: typeof IR_COMPONENT_TYPES.APPLICATION;
|
|
32
21
|
config: AppConfig;
|
|
33
22
|
}
|
|
34
|
-
export interface CardIRNode extends IntermediateRepresentationNodeLocalDev {
|
|
35
|
-
componentType: typeof IR_COMPONENT_TYPES.CARD;
|
|
36
|
-
config: CardConfig;
|
|
37
|
-
}
|
|
38
23
|
export {};
|