@hubspot/cli 7.8.12-experimental.1 → 7.9.0-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/__tests__/cms.test.js +44 -1
- package/commands/__tests__/customObject.test.js +22 -1
- package/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/auth.js +1 -0
- package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
- package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
- package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +82 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +79 -0
- package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +60 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +135 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +45 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +17 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
- package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +46 -0
- package/commands/cms/theme/preview.d.ts +12 -0
- package/commands/cms/theme/preview.js +224 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +14 -0
- package/commands/cms/watch.js +138 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.js +26 -0
- package/commands/create.js +4 -2
- package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +56 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/schema/create.d.ts +4 -6
- package/commands/customObject/schema/create.js +13 -36
- package/commands/customObject/schema/delete.d.ts +4 -7
- package/commands/customObject/schema/delete.js +15 -50
- package/commands/customObject/schema/fetch-all.d.ts +4 -6
- package/commands/customObject/schema/fetch-all.js +14 -41
- package/commands/customObject/schema/fetch.d.ts +4 -7
- package/commands/customObject/schema/fetch.js +14 -49
- package/commands/customObject/schema/list.d.ts +4 -4
- package/commands/customObject/schema/list.js +10 -19
- package/commands/customObject/schema/update.d.ts +4 -7
- package/commands/customObject/schema/update.js +15 -50
- package/commands/customObject/schema.js +4 -2
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +71 -0
- package/commands/customObject.js +16 -1
- package/commands/feedback.js +1 -1
- package/commands/fetch.d.ts +4 -12
- package/commands/fetch.js +19 -46
- package/commands/function/deploy.d.ts +4 -6
- package/commands/function/deploy.js +14 -71
- package/commands/function/list.d.ts +4 -6
- package/commands/function/list.js +14 -40
- package/commands/function/server.d.ts +4 -10
- package/commands/function/server.js +22 -29
- package/commands/function.d.ts +2 -4
- package/commands/function.js +25 -14
- package/commands/lint.d.ts +4 -6
- package/commands/lint.js +13 -65
- package/commands/list.d.ts +4 -6
- package/commands/list.js +13 -74
- package/commands/logs.d.ts +4 -10
- package/commands/logs.js +24 -87
- package/commands/module/marketplace-validate.d.ts +4 -6
- package/commands/module/marketplace-validate.js +15 -27
- package/commands/module.d.ts +2 -2
- package/commands/module.js +17 -15
- package/commands/mv.d.ts +4 -7
- package/commands/mv.js +13 -39
- package/commands/project/__tests__/add.test.js +12 -12
- package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/migrate.test.js +1 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +3 -2
- package/commands/project/create.js +1 -1
- package/commands/project/dev/deprecatedFlow.js +2 -2
- package/commands/project/dev/index.js +5 -5
- package/commands/project/dev/unifiedFlow.js +8 -3
- package/commands/project/download.js +5 -2
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +1 -0
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/migrate.js +5 -2
- package/commands/project.js +2 -0
- package/commands/remove.d.ts +4 -6
- package/commands/remove.js +12 -24
- package/commands/testAccount/create.js +2 -2
- package/commands/testAccount/delete.js +1 -1
- package/commands/theme/generate-selectors.d.ts +4 -6
- package/commands/theme/generate-selectors.js +14 -152
- package/commands/theme/marketplace-validate.d.ts +4 -6
- package/commands/theme/marketplace-validate.js +14 -25
- package/commands/theme/preview.d.ts +4 -12
- package/commands/theme/preview.js +18 -180
- package/commands/theme.d.ts +2 -2
- package/commands/theme.js +19 -13
- package/commands/upload.d.ts +4 -12
- package/commands/upload.js +19 -169
- package/commands/watch.d.ts +4 -14
- package/commands/watch.js +23 -88
- package/lang/en.d.ts +560 -425
- package/lang/en.js +562 -427
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -2
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +7 -7
- package/lib/configMigrate.js +88 -9
- package/lib/constants.d.ts +9 -0
- package/lib/constants.js +9 -0
- package/lib/generateSelectors.js +1 -1
- package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
- package/lib/middleware/autoUpdateMiddleware.js +12 -2
- package/lib/middleware/commandTargetingUtils.d.ts +1 -1
- package/lib/middleware/commandTargetingUtils.js +16 -20
- package/lib/projects/__tests__/AppDevModeInterface.test.js +95 -109
- package/lib/projects/__tests__/DevServerManager.test.js +183 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +6 -6
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/upload.test.js +2 -2
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +35 -35
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +2 -2
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +3 -3
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +9 -3
- package/lib/projects/localDev/AppDevModeInterface.js +116 -105
- package/lib/projects/localDev/DevServerManager.d.ts +10 -29
- package/lib/projects/localDev/DevServerManager.js +20 -76
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +6 -6
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +39 -6
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +15 -0
- package/lib/projects/localDev/helpers/project.js +2 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +1 -1
- package/lib/theme/__tests__/migrate.test.js +4 -4
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.js +8 -0
- package/lib/ui/uiMessages.d.ts +5 -0
- package/lib/ui/uiMessages.js +5 -0
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/package.json +6 -5
- package/types/Cms.d.ts +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
- /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
- /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/deleteSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/update.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
- /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
- /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/function.js +0 -0
- /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/index.js +0 -0
- /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/module.js +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/template.js +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
- /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lang/en.lyaml
CHANGED
|
@@ -2,7 +2,7 @@ en:
|
|
|
2
2
|
commands:
|
|
3
3
|
generalErrors:
|
|
4
4
|
updateNotify:
|
|
5
|
-
notifyTitle: "
|
|
5
|
+
notifyTitle: "CLI update available"
|
|
6
6
|
cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
|
|
7
7
|
cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
|
|
8
8
|
srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
|
|
@@ -801,7 +801,7 @@ en:
|
|
|
801
801
|
uploadFailed: "Failed to upload file \"{{ filePath }}\" to \"{{ remotePath }}\""
|
|
802
802
|
deleteFileFailed: "Failed to delete file \"{{ remotePath }}\""
|
|
803
803
|
deleteFolderFailed: "Failed to delete folder \"{{ remotePath }}\""
|
|
804
|
-
|
|
804
|
+
v2ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
|
|
805
805
|
download:
|
|
806
806
|
describe: "Download your project files from HubSpot."
|
|
807
807
|
examples:
|
|
@@ -102,7 +102,7 @@ describe('lib/buildAccount', () => {
|
|
|
102
102
|
expect(result).toBe('test-account-with-new-name');
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
describe('
|
|
105
|
+
describe('createDeveloperTestAccountV2()', () => {
|
|
106
106
|
const parentAccountId = 123456;
|
|
107
107
|
const mockDeveoperTestAccountConfig = {
|
|
108
108
|
accountName: 'Developer Test Account',
|
|
@@ -120,7 +120,7 @@ describe('lib/buildAccount', () => {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
it('should create a developer test account successfully', async () => {
|
|
123
|
-
const result = await buildAccount.
|
|
123
|
+
const result = await buildAccount.createDeveloperTestAccountV2(parentAccountId, mockDeveoperTestAccountConfig);
|
|
124
124
|
expect(result).toEqual({
|
|
125
125
|
accountName: mockDeveoperTestAccountConfig.accountName,
|
|
126
126
|
accountId: 123456,
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
|
4
4
|
import { SandboxResponse, V2Sandbox } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
5
|
import { SandboxAccountType } from '../types/Sandboxes.js';
|
|
6
6
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function createDeveloperTestAccountV2(parentAccountId: number, testAccountConfig: DeveloperTestAccountConfig): Promise<{
|
|
8
8
|
accountName: string;
|
|
9
9
|
accountId?: number;
|
|
10
10
|
personalAccessKey?: string;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number,
|
|
12
|
+
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV2?: boolean): Promise<number>;
|
|
13
13
|
type SandboxAccount = SandboxResponse & {
|
|
14
14
|
name: string;
|
|
15
15
|
};
|
package/lib/buildAccount.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
|
|
|
52
52
|
uiLogger.log('');
|
|
53
53
|
return validName;
|
|
54
54
|
}
|
|
55
|
-
export async function
|
|
55
|
+
export async function createDeveloperTestAccountV2(parentAccountId, testAccountConfig) {
|
|
56
56
|
const result = {
|
|
57
57
|
accountName: testAccountConfig.accountName,
|
|
58
58
|
};
|
|
@@ -66,7 +66,7 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
|
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
68
|
debugError(err);
|
|
69
|
-
throw new Error(lib.buildAccount.
|
|
69
|
+
throw new Error(lib.buildAccount.createDeveloperTestAccountV2.syncFailure);
|
|
70
70
|
}
|
|
71
71
|
// HACK: The status endpoint sometimes returns an early success status.
|
|
72
72
|
// Sleep for an extra 5 seconds to make sure the sync is actually complete.
|
|
@@ -78,11 +78,11 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
|
|
|
78
78
|
}
|
|
79
79
|
catch (err) {
|
|
80
80
|
debugError(err);
|
|
81
|
-
throw new Error(lib.buildAccount.
|
|
81
|
+
throw new Error(lib.buildAccount.createDeveloperTestAccountV2.pakFailure);
|
|
82
82
|
}
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
|
-
export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit,
|
|
85
|
+
export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV2 = false) {
|
|
86
86
|
const id = getAccountIdentifier(parentAccountConfig);
|
|
87
87
|
const parentAccountId = getAccountId(id);
|
|
88
88
|
let testAccountConfig = {
|
|
@@ -91,7 +91,7 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
|
|
|
91
91
|
if (!parentAccountId) {
|
|
92
92
|
throw new Error(lib.developerTestAccount.create.loading.fail(''));
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
94
|
+
if (useV2) {
|
|
95
95
|
testAccountConfig = await createDeveloperTestAccountConfigPrompt({
|
|
96
96
|
name: testAccountConfig.accountName,
|
|
97
97
|
description: 'Test Account created by the HubSpot CLI',
|
|
@@ -107,8 +107,8 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
|
|
|
107
107
|
let developerTestAccountId;
|
|
108
108
|
let developerTestAccountPersonalAccessKey;
|
|
109
109
|
try {
|
|
110
|
-
if (
|
|
111
|
-
const result = await
|
|
110
|
+
if (useV2) {
|
|
111
|
+
const result = await createDeveloperTestAccountV2(parentAccountId, testAccountConfig);
|
|
112
112
|
developerTestAccountId = result.accountId;
|
|
113
113
|
developerTestAccountPersonalAccessKey = result.personalAccessKey;
|
|
114
114
|
}
|
package/lib/configMigrate.js
CHANGED
|
@@ -3,6 +3,37 @@ import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME } from '@hubspot/local-dev-lib/c
|
|
|
3
3
|
import { promptUser } from './prompts/promptUtils.js';
|
|
4
4
|
import { lib } from '../lang/en.js';
|
|
5
5
|
import { uiLogger } from './ui/logger.js';
|
|
6
|
+
async function promptRenameOrOmitAccount(accountName, accountId) {
|
|
7
|
+
const { shouldRename } = await promptUser({
|
|
8
|
+
name: 'shouldRename',
|
|
9
|
+
type: 'confirm',
|
|
10
|
+
message: lib.configMigrate.handleAccountNameConflicts.prompts.renameOrOmitAccountPrompt(accountName, accountId),
|
|
11
|
+
});
|
|
12
|
+
return shouldRename;
|
|
13
|
+
}
|
|
14
|
+
async function promptNewAccountName(account, globalConfig, renamedAccounts) {
|
|
15
|
+
const { newAccountName } = await promptUser({
|
|
16
|
+
name: 'newAccountName',
|
|
17
|
+
type: 'input',
|
|
18
|
+
default: `${account.name}_${account.portalId}`,
|
|
19
|
+
message: lib.configMigrate.handleAccountNameConflicts.prompts.newAccountNamePrompt(account.name, account.portalId),
|
|
20
|
+
validate: value => {
|
|
21
|
+
if (!value) {
|
|
22
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.nameRequired;
|
|
23
|
+
}
|
|
24
|
+
if (value === account.name) {
|
|
25
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.sameName;
|
|
26
|
+
}
|
|
27
|
+
const existingAccount = globalConfig.accounts.some(acc => acc.name === value);
|
|
28
|
+
const renamedAccount = renamedAccounts.some(acc => acc.name === value);
|
|
29
|
+
if (existingAccount || renamedAccount) {
|
|
30
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.nameAlreadyInConfig(value);
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return newAccountName;
|
|
36
|
+
}
|
|
6
37
|
export async function handleMigration(deprecatedConfigPath, hideWarning) {
|
|
7
38
|
if (!hideWarning) {
|
|
8
39
|
uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
|
|
@@ -47,20 +78,67 @@ async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force
|
|
|
47
78
|
}
|
|
48
79
|
return initialConfig;
|
|
49
80
|
}
|
|
81
|
+
async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force) {
|
|
82
|
+
if (!deprecatedConfig.portals?.length || !globalConfig.accounts?.length) {
|
|
83
|
+
return deprecatedConfig;
|
|
84
|
+
}
|
|
85
|
+
const accountsWithConflictsToRemove = new Set();
|
|
86
|
+
const renamedAccounts = [];
|
|
87
|
+
const accountsNotYetInGlobal = deprecatedConfig.portals.filter(portal => portal.portalId &&
|
|
88
|
+
!globalConfig.accounts.some(acc => acc.accountId === portal.portalId));
|
|
89
|
+
const accountsWithConflicts = accountsNotYetInGlobal.filter(localAccount => globalConfig.accounts.some(globalAccount => globalAccount.name === localAccount.name));
|
|
90
|
+
if (accountsWithConflicts.length > 0) {
|
|
91
|
+
uiLogger.log('');
|
|
92
|
+
uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.accountNameConflictMessage(accountsWithConflicts.length));
|
|
93
|
+
if (force) {
|
|
94
|
+
const renameDetails = [];
|
|
95
|
+
for (const account of accountsWithConflicts) {
|
|
96
|
+
accountsWithConflictsToRemove.add(account);
|
|
97
|
+
const newAccountName = `${account.name}_${account.portalId}`;
|
|
98
|
+
renamedAccounts.push({
|
|
99
|
+
...account,
|
|
100
|
+
name: newAccountName,
|
|
101
|
+
});
|
|
102
|
+
renameDetails.push(` "${account.name}" → "${newAccountName}" (ID: ${account.portalId})`);
|
|
103
|
+
}
|
|
104
|
+
uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.forceFlagDetected(accountsWithConflicts.length, renameDetails.join('\n')));
|
|
105
|
+
uiLogger.log('');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
for (const account of accountsWithConflicts) {
|
|
109
|
+
uiLogger.log('');
|
|
110
|
+
const shouldRename = await promptRenameOrOmitAccount(account.name, account.portalId);
|
|
111
|
+
accountsWithConflictsToRemove.add(account);
|
|
112
|
+
if (shouldRename) {
|
|
113
|
+
const newAccountName = await promptNewAccountName(account, globalConfig, renamedAccounts);
|
|
114
|
+
renamedAccounts.push({
|
|
115
|
+
...account,
|
|
116
|
+
name: newAccountName,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
deprecatedConfig.portals.push(...renamedAccounts);
|
|
122
|
+
}
|
|
123
|
+
const cleanedPortals = deprecatedConfig.portals.filter(portal => !accountsWithConflictsToRemove.has(portal));
|
|
124
|
+
return { ...deprecatedConfig, portals: cleanedPortals };
|
|
125
|
+
}
|
|
50
126
|
export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
51
127
|
if (!hideWarning) {
|
|
52
128
|
uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
|
|
53
129
|
uiLogger.log('');
|
|
54
130
|
}
|
|
55
131
|
uiLogger.log(lib.configMigrate.handleMerge.description(ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
132
|
+
if (!force) {
|
|
133
|
+
uiLogger.log('');
|
|
134
|
+
const { shouldMergeConfigs } = await promptUser({
|
|
135
|
+
name: 'shouldMergeConfigs',
|
|
136
|
+
type: 'confirm',
|
|
137
|
+
message: lib.configMigrate.handleMerge.confirmPrompt,
|
|
138
|
+
});
|
|
139
|
+
if (shouldMergeConfigs === false) {
|
|
140
|
+
return true; // exit with "true" so the user is shown a success message instead of an error
|
|
141
|
+
}
|
|
64
142
|
}
|
|
65
143
|
const deprecatedConfig = getDeprecatedConfig(deprecatedConfigPath);
|
|
66
144
|
const globalConfig = getGlobalConfig();
|
|
@@ -68,7 +146,8 @@ export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
|
68
146
|
return true;
|
|
69
147
|
}
|
|
70
148
|
const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
|
|
71
|
-
const
|
|
149
|
+
const cleanedDeprecatedConfig = await handleAccountNameConflicts(mergedConfig, deprecatedConfig, force);
|
|
150
|
+
const { skippedAccountIds } = mergeExistingConfigs(mergedConfig, cleanedDeprecatedConfig);
|
|
72
151
|
if (skippedAccountIds.length > 0) {
|
|
73
152
|
uiLogger.log('');
|
|
74
153
|
uiLogger.log(lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
|
package/lib/constants.d.ts
CHANGED
|
@@ -95,16 +95,21 @@ export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
|
95
95
|
UPDATE_PROJECT_DATA: string;
|
|
96
96
|
UPDATE_UPLOAD_WARNINGS: string;
|
|
97
97
|
CLI_METADATA: string;
|
|
98
|
+
DEV_SERVERS_STARTED: string;
|
|
98
99
|
};
|
|
99
100
|
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
100
101
|
UPLOAD: string;
|
|
101
102
|
DEPLOY: string;
|
|
102
103
|
VIEWED_WELCOME_SCREEN: string;
|
|
104
|
+
APP_INSTALL_SUCCESS: string;
|
|
105
|
+
APP_INSTALL_INITIATED: string;
|
|
106
|
+
APP_INSTALL_FAILURE: string;
|
|
103
107
|
};
|
|
104
108
|
export declare const APP_INSTALLATION_STATES: {
|
|
105
109
|
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
106
110
|
readonly INSTALLED: "INSTALLED";
|
|
107
111
|
readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
|
|
112
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
108
113
|
};
|
|
109
114
|
export declare const staticAuth = "static";
|
|
110
115
|
export declare const oAuth = "oauth";
|
|
@@ -118,7 +123,11 @@ export declare const GET_STARTED_OPTIONS: {
|
|
|
118
123
|
export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
|
|
119
124
|
readonly INITIAL: "INITIAL";
|
|
120
125
|
readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
|
|
126
|
+
readonly STATIC_AUTH_APP_INSTALL_SUCCESS: "APP_INSTALL_SUCCESS";
|
|
127
|
+
readonly STATIC_AUTH_APP_INSTALL_FAILURE: "APP_INSTALL_FAILURE";
|
|
128
|
+
readonly OAUTH_APP_INSTALL_INITIATED: "APP_INSTALL_INITIATED";
|
|
121
129
|
};
|
|
130
|
+
export declare const LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID = "local-dev-ui-websocket-server";
|
|
122
131
|
export declare const CONFIG_LOCAL_STATE_FLAGS: {
|
|
123
132
|
readonly LOCAL_DEV_UI_WELCOME: "LOCAL_DEV_UI_WELCOME";
|
|
124
133
|
};
|
package/lib/constants.js
CHANGED
|
@@ -87,16 +87,21 @@ export const LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
|
87
87
|
UPDATE_PROJECT_DATA: 'server:updateProjectData',
|
|
88
88
|
UPDATE_UPLOAD_WARNINGS: 'server:updateUploadWarnings',
|
|
89
89
|
CLI_METADATA: 'server:cliMetadata',
|
|
90
|
+
DEV_SERVERS_STARTED: 'server:devServersStarted',
|
|
90
91
|
};
|
|
91
92
|
export const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
92
93
|
UPLOAD: 'client:upload',
|
|
93
94
|
DEPLOY: 'client:deploy',
|
|
94
95
|
VIEWED_WELCOME_SCREEN: 'client:viewedWelcomeScreen',
|
|
96
|
+
APP_INSTALL_SUCCESS: 'client:installSuccess',
|
|
97
|
+
APP_INSTALL_INITIATED: 'client:installInitiated',
|
|
98
|
+
APP_INSTALL_FAILURE: 'client:installFailure',
|
|
95
99
|
};
|
|
96
100
|
export const APP_INSTALLATION_STATES = {
|
|
97
101
|
NOT_INSTALLED: 'NOT_INSTALLED',
|
|
98
102
|
INSTALLED: 'INSTALLED',
|
|
99
103
|
INSTALLED_WITH_OUTDATED_SCOPES: 'INSTALLED_WITH_OUTDATED_SCOPES',
|
|
104
|
+
UNKNOWN: 'UNKNOWN',
|
|
100
105
|
};
|
|
101
106
|
export const staticAuth = 'static';
|
|
102
107
|
export const oAuth = 'oauth';
|
|
@@ -110,7 +115,11 @@ export const GET_STARTED_OPTIONS = {
|
|
|
110
115
|
export const LOCAL_DEV_SERVER_MESSAGE_TYPES = {
|
|
111
116
|
INITIAL: 'INITIAL',
|
|
112
117
|
WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
|
|
118
|
+
STATIC_AUTH_APP_INSTALL_SUCCESS: 'APP_INSTALL_SUCCESS',
|
|
119
|
+
STATIC_AUTH_APP_INSTALL_FAILURE: 'APP_INSTALL_FAILURE',
|
|
120
|
+
OAUTH_APP_INSTALL_INITIATED: 'APP_INSTALL_INITIATED',
|
|
113
121
|
};
|
|
122
|
+
export const LOCAL_DEV_WEBSOCKET_SERVER_INSTANCE_ID = 'local-dev-ui-websocket-server';
|
|
114
123
|
export const CONFIG_LOCAL_STATE_FLAGS = {
|
|
115
124
|
LOCAL_DEV_UI_WELCOME: 'LOCAL_DEV_UI_WELCOME',
|
|
116
125
|
};
|
package/lib/generateSelectors.js
CHANGED
|
@@ -11,7 +11,7 @@ export function getMaxFieldsDepth() {
|
|
|
11
11
|
export function findFieldsJsonPath(basePath) {
|
|
12
12
|
const _path = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath;
|
|
13
13
|
if (!fs.existsSync(_path)) {
|
|
14
|
-
uiLogger.error(commands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
14
|
+
uiLogger.error(commands.cms.subcommands.theme.subcommands.generateSelectors.errors.invalidPath(basePath));
|
|
15
15
|
process.exit(EXIT_CODES.ERROR);
|
|
16
16
|
}
|
|
17
17
|
const files = fs.readdirSync(_path);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Arguments } from 'yargs';
|
|
2
|
+
export declare function autoUpdateCLI(argv: Arguments): Promise<void>;
|
|
@@ -7,6 +7,7 @@ import { lib } from '../../lang/en.js';
|
|
|
7
7
|
import { DEFAULT_PACKAGE_MANAGER, isGloballyInstalled, executeInstall, } from '../npm.js';
|
|
8
8
|
import { debugError } from '../errorHandlers/index.js';
|
|
9
9
|
import { uiLogger } from '../ui/logger.js';
|
|
10
|
+
import { isTargetedCommand } from './commandTargetingUtils.js';
|
|
10
11
|
// Default behavior is to check for notifications at most once per day
|
|
11
12
|
// update-notifier stores the last checked date in the user's home directory
|
|
12
13
|
const notifier = updateNotifier({
|
|
@@ -33,13 +34,22 @@ function updateNotification() {
|
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
const SKIP_AUTO_UPDATE_COMMANDS = {
|
|
38
|
+
config: {
|
|
39
|
+
set: true,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const preventAutoUpdateForCommand = (commandParts) => {
|
|
43
|
+
return isTargetedCommand(commandParts, SKIP_AUTO_UPDATE_COMMANDS);
|
|
44
|
+
};
|
|
45
|
+
export async function autoUpdateCLI(argv) {
|
|
37
46
|
// This lets us back to default update-notifier behavior
|
|
38
47
|
let showManualInstallHelp = true;
|
|
39
48
|
if (notifier &&
|
|
40
49
|
notifier.update &&
|
|
41
50
|
!process.env.SKIP_HUBSPOT_CLI_AUTO_UPDATES &&
|
|
42
|
-
isConfigFlagEnabled('allowAutoUpdates')
|
|
51
|
+
isConfigFlagEnabled('allowAutoUpdates') &&
|
|
52
|
+
!preventAutoUpdateForCommand(argv._)) {
|
|
43
53
|
// Ignore all update notifications if the current version is a pre-release
|
|
44
54
|
if (!notifier.update.current.includes('-')) {
|
|
45
55
|
// Attempt auto-update if the current version is not the latest version
|
|
@@ -3,6 +3,6 @@ type TargetCommandMap = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare function isTargetedCommand(commandParts: (string | number)[], targetCommandMap: TargetCommandMap): boolean;
|
|
5
5
|
export declare function shouldLoadConfigForCommand(commandParts: (string | number)[]): boolean;
|
|
6
|
-
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
6
|
export declare function shouldRunConfigValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
|
+
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
8
8
|
export {};
|
|
@@ -33,6 +33,19 @@ export function shouldLoadConfigForCommand(commandParts) {
|
|
|
33
33
|
return (!isGlobalConfigMigration &&
|
|
34
34
|
!isTargetedCommand(commandParts, SKIP_CONFIG_LOADING_COMMANDS));
|
|
35
35
|
}
|
|
36
|
+
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
37
|
+
auth: true,
|
|
38
|
+
mcp: {
|
|
39
|
+
setup: true,
|
|
40
|
+
start: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
// Returns true if the command requires a valid config file to be present
|
|
44
|
+
// Should only run if config has been loaded
|
|
45
|
+
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
46
|
+
return (shouldLoadConfigForCommand(commandParts) &&
|
|
47
|
+
!isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS));
|
|
48
|
+
}
|
|
36
49
|
const accountsSubCommands = {
|
|
37
50
|
auth: true,
|
|
38
51
|
clean: true,
|
|
@@ -45,12 +58,6 @@ const sandboxesSubCommands = {
|
|
|
45
58
|
delete: true,
|
|
46
59
|
};
|
|
47
60
|
const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
48
|
-
init: true,
|
|
49
|
-
auth: true,
|
|
50
|
-
mcp: {
|
|
51
|
-
setup: true,
|
|
52
|
-
start: true,
|
|
53
|
-
},
|
|
54
61
|
account: accountsSubCommands,
|
|
55
62
|
accounts: accountsSubCommands,
|
|
56
63
|
sandbox: sandboxesSubCommands,
|
|
@@ -58,21 +65,10 @@ const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
|
58
65
|
config: {
|
|
59
66
|
migrate: true,
|
|
60
67
|
},
|
|
61
|
-
feedback: true,
|
|
62
68
|
};
|
|
63
69
|
// Returns true if the command requires a valid account to be set in the config
|
|
70
|
+
// Should only run if config has been loaded and validated
|
|
64
71
|
export function shouldRunAccountValidationForCommand(commandParts) {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
68
|
-
init: true,
|
|
69
|
-
auth: true,
|
|
70
|
-
mcp: {
|
|
71
|
-
setup: true,
|
|
72
|
-
start: true,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
// Returns true if the command requires a valid config file to be present
|
|
76
|
-
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
77
|
-
return !isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS);
|
|
72
|
+
return (shouldRunConfigValidationForCommand(commandParts) &&
|
|
73
|
+
!isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS));
|
|
78
74
|
}
|