@hubspot/cli 7.0.12-experimental.0 → 7.1.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/deploy.js +2 -2
- package/commands/project/upload.js +2 -2
- package/lang/en.lyaml +5 -3
- package/lib/doctor/Doctor.js +19 -6
- package/lib/projects/buildAndDeploy.d.ts +1 -1
- package/lib/projects/buildAndDeploy.js +5 -1
- package/lib/projects/structure.d.ts +4 -1
- package/lib/projects/structure.js +3 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
|
-
const
|
|
4
|
+
const { useV3Api } = require('../../lib/projects/buildAndDeploy');
|
|
5
5
|
const chalk = require('chalk');
|
|
6
6
|
const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
7
7
|
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
@@ -84,7 +84,7 @@ exports.handler = async (options) => {
|
|
|
84
84
|
logger.error(i18n(`${i18nKey}.errors.noBuildId`));
|
|
85
85
|
return process.exit(EXIT_CODES.ERROR);
|
|
86
86
|
}
|
|
87
|
-
const { data: deployResp } = await deployProject(derivedAccountId, projectName, buildIdToDeploy,
|
|
87
|
+
const { data: deployResp } = await deployProject(derivedAccountId, projectName, buildIdToDeploy, useV3Api(projectConfig?.platformVersion));
|
|
88
88
|
if (!deployResp || deployResp.error) {
|
|
89
89
|
logger.error(i18n(`${i18nKey}.errors.deploy`, {
|
|
90
90
|
details: deployResp.error.message,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-nocheck
|
|
4
|
-
const
|
|
4
|
+
const { useV3Api } = require('../../lib/projects/buildAndDeploy');
|
|
5
5
|
const { addAccountOptions, addConfigOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
6
6
|
const chalk = require('chalk');
|
|
7
7
|
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
@@ -31,7 +31,7 @@ exports.handler = async (options) => {
|
|
|
31
31
|
uploadCommand: true,
|
|
32
32
|
});
|
|
33
33
|
try {
|
|
34
|
-
const { result, uploadError } = await handleProjectUpload(derivedAccountId, projectConfig, projectDir, pollProjectBuildAndDeploy, message,
|
|
34
|
+
const { result, uploadError } = await handleProjectUpload(derivedAccountId, projectConfig, projectDir, pollProjectBuildAndDeploy, message, useV3Api(projectConfig?.platformVersion));
|
|
35
35
|
if (uploadError) {
|
|
36
36
|
if (isSpecifiedError(uploadError, {
|
|
37
37
|
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
package/lang/en.lyaml
CHANGED
|
@@ -1262,7 +1262,7 @@ en:
|
|
|
1262
1262
|
selectScopes: "Select access scopes (see https://developers.hubspot.com/docs/methods/oauth2/initiate-oauth-integration#scopes)"
|
|
1263
1263
|
personalAccessKeySetupTitle: "HubSpot Personal Access Key Setup"
|
|
1264
1264
|
personalAccessKeyBrowserOpenPrep: "A personal access key is required to authenticate the CLI to interact with your HubSpot account. We'll open a secure page in your default browser where you can view and copy your personal access key."
|
|
1265
|
-
personalAccessKeyBrowserOpenPrompt: "Open
|
|
1265
|
+
personalAccessKeyBrowserOpenPrompt: "Open HubSpot to copy your personal access key?"
|
|
1266
1266
|
logs:
|
|
1267
1267
|
openingWebBrowser: "Opening {{ url }} in your web browser"
|
|
1268
1268
|
errors:
|
|
@@ -1372,8 +1372,8 @@ en:
|
|
|
1372
1372
|
installPublicAppPrompt:
|
|
1373
1373
|
explanation: "Local development requires this app to be installed in the target test account"
|
|
1374
1374
|
reinstallExplanation: "This app's required scopes have been updated since it was last installed on the target test account. To avoid issues with local development, we recommend reinstalling the app with the updated scopes."
|
|
1375
|
-
prompt: "Open
|
|
1376
|
-
reinstallPrompt: "Open
|
|
1375
|
+
prompt: "Open HubSpot to install this app?"
|
|
1376
|
+
reinstallPrompt: "Open HubSpot to reinstall this app?"
|
|
1377
1377
|
decline: "To continue local development of this app, install it in your target test account and re-run {{#bold}}`hs project dev`{{/bold}}"
|
|
1378
1378
|
selectHubDBTablePrompt:
|
|
1379
1379
|
selectTable: "Select a HubDB table:"
|
|
@@ -1517,6 +1517,8 @@ en:
|
|
|
1517
1517
|
inactiveSecondary: "Run {{ command }} to remove inactive accounts from your CLI config"
|
|
1518
1518
|
unableToDetermine: "Unable to determine if the portal is active"
|
|
1519
1519
|
pak:
|
|
1520
|
+
incomplete: "Personal access key is valid, but there are more scopes available to your user that are not included in your key."
|
|
1521
|
+
incompleteSecondary: "To add the available scopes, run {{ command }} and re-authenticate your account with a new key that has those scopes. Visit HubSpot to view selected and available scopes for your personal access key. {{ link }}"
|
|
1520
1522
|
invalid: "Personal access key is invalid"
|
|
1521
1523
|
invalidSecondary: "To get a new key, run {{ command }}, deactivate your access key, and generate a new one. Then use that new key to authenticate your account."
|
|
1522
1524
|
valid: "Personal Access Key is valid. {{ link }}"
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -91,16 +91,29 @@ class Doctor {
|
|
|
91
91
|
const localI18nKey = `${i18nKey}.accountChecks`;
|
|
92
92
|
try {
|
|
93
93
|
await (0, personalAccessKey_1.accessTokenForPersonalAccessKey)(this.accountId, true);
|
|
94
|
+
const pakScopes = new Set(await (0, personalAccessKey_1.scopesOnAccessToken)(this.accountId));
|
|
95
|
+
const missingScopes = (await (0, personalAccessKey_1.authorizedScopesForPortalAndUser)(this.accountId)).filter((data) => data.userAuthorized && !pakScopes.has(data.scopeGroup.name));
|
|
94
96
|
this.diagnosis?.addCLIConfigSection({
|
|
95
97
|
type: 'success',
|
|
96
98
|
message: i18n(`${localI18nKey}.active`),
|
|
97
99
|
});
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
const linkToPakUI = uiLink(i18n(`${localI18nKey}.pak.viewScopes`), `${(0, urls_1.getHubSpotWebsiteOrigin)(this.diagnosticInfoBuilder?.env || 'PROD')}/personal-access-key/${this.diagnosticInfo?.account.accountId}`);
|
|
101
|
+
if (missingScopes.length > 0) {
|
|
102
|
+
this.diagnosis?.addCLIConfigSection({
|
|
103
|
+
type: 'warning',
|
|
104
|
+
message: i18n(`${localI18nKey}.pak.incomplete`),
|
|
105
|
+
secondaryMessaging: i18n(`${localI18nKey}.pak.incompleteSecondary`, {
|
|
106
|
+
command: (0, ui_1.uiCommandReference)(`hs auth`),
|
|
107
|
+
link: linkToPakUI,
|
|
108
|
+
}),
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
this.diagnosis?.addCLIConfigSection({
|
|
113
|
+
type: 'success',
|
|
114
|
+
message: i18n(`${localI18nKey}.pak.valid`, { link: linkToPakUI }),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
104
117
|
}
|
|
105
118
|
catch (error) {
|
|
106
119
|
const portalNotActive = (0, index_1.isSpecifiedError)(error, {
|
|
@@ -2,7 +2,7 @@ import { FileResult } from 'tmp';
|
|
|
2
2
|
import { Build } from '@hubspot/local-dev-lib/types/Build';
|
|
3
3
|
import { Deploy } from '@hubspot/local-dev-lib/types/Deploy';
|
|
4
4
|
import { ProjectConfig, ProjectTask, ProjectPollResult } from '../../types/Projects';
|
|
5
|
-
export declare function useV3Api(platformVersion?: string | null):
|
|
5
|
+
export declare function useV3Api(platformVersion?: string | null): boolean;
|
|
6
6
|
type PollTaskStatusFunction<T extends ProjectTask> = (accountId: number, taskName: string, taskId: number, deployedBuildId: number | null, silenceLogs: boolean) => Promise<T>;
|
|
7
7
|
export declare const pollBuildStatus: PollTaskStatusFunction<Build>;
|
|
8
8
|
export declare const pollDeployStatus: PollTaskStatusFunction<Deploy>;
|
|
@@ -21,7 +21,11 @@ const SPINNER_STATUS = {
|
|
|
21
21
|
SPINNING: 'spinning',
|
|
22
22
|
};
|
|
23
23
|
function useV3Api(platformVersion) {
|
|
24
|
-
|
|
24
|
+
if (!platformVersion || typeof platformVersion !== 'string') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const [year, minor] = platformVersion.split('.');
|
|
28
|
+
return Number(year) >= 2025 && Number(minor) >= 1;
|
|
25
29
|
}
|
|
26
30
|
function getSubtasks(task) {
|
|
27
31
|
if ('subbuildStatuses' in task) {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { ComponentTypes, Component, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects';
|
|
1
|
+
import { ComponentTypes, Component, GenericComponentConfig, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects';
|
|
2
2
|
export declare const CONFIG_FILES: {
|
|
3
3
|
[k in ComponentTypes]: string;
|
|
4
4
|
};
|
|
5
|
+
export declare function getComponentTypeFromConfigFile(configFile: string): ComponentTypes | null;
|
|
6
|
+
export declare function loadConfigFile(configPath: string): GenericComponentConfig | null;
|
|
5
7
|
export declare function getAppCardConfigs(appConfig: PublicAppComponentConfig | PrivateAppComponentConfig, appPath: string): Array<AppCardComponentConfig>;
|
|
8
|
+
export declare function getIsLegacyApp(appConfig: GenericComponentConfig, appPath: string): boolean;
|
|
6
9
|
export declare function findProjectComponents(projectSourceDir: string): Promise<Array<Component>>;
|
|
7
10
|
export declare function getProjectComponentTypes(components: Array<Component>): {
|
|
8
11
|
[key in ComponentTypes]?: boolean;
|
|
@@ -34,7 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.CONFIG_FILES = void 0;
|
|
37
|
+
exports.getComponentTypeFromConfigFile = getComponentTypeFromConfigFile;
|
|
38
|
+
exports.loadConfigFile = loadConfigFile;
|
|
37
39
|
exports.getAppCardConfigs = getAppCardConfigs;
|
|
40
|
+
exports.getIsLegacyApp = getIsLegacyApp;
|
|
38
41
|
exports.findProjectComponents = findProjectComponents;
|
|
39
42
|
exports.getProjectComponentTypes = getProjectComponentTypes;
|
|
40
43
|
exports.getComponentUid = getComponentUid;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.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
|
-
"@hubspot/local-dev-lib": "3.
|
|
8
|
+
"@hubspot/local-dev-lib": "3.3.0",
|
|
9
9
|
"@hubspot/project-parsing-lib": "0.0.4",
|
|
10
10
|
"@hubspot/serverless-dev-runtime": "7.0.2",
|
|
11
11
|
"@hubspot/theme-preview-dev-server": "0.0.10",
|