@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
|
@@ -13,11 +13,13 @@ import { getWarningBox } from '../../ui/components/StatusMessageBoxes.js';
|
|
|
13
13
|
import { getHasMigratableThemes, migrateThemes2025_2, } from '../../lib/theme/migrate.js';
|
|
14
14
|
import { hasFeature } from '../../lib/hasFeature.js';
|
|
15
15
|
import { FEATURES } from '../../lib/constants.js';
|
|
16
|
+
import { trackCommandMetadataUsage, trackCommandUsage, } from '../../lib/usageTracking.js';
|
|
16
17
|
const { v2025_2 } = PLATFORM_VERSIONS;
|
|
17
18
|
const command = 'migrate';
|
|
18
19
|
const describe = commands.project.migrate.describe;
|
|
19
20
|
async function handler(args) {
|
|
20
|
-
const { platformVersion, unstable } = args;
|
|
21
|
+
const { platformVersion, unstable, derivedAccountId } = args;
|
|
22
|
+
await trackCommandUsage('project-migrate', {}, derivedAccountId);
|
|
21
23
|
const projectConfig = await getProjectConfig();
|
|
22
24
|
if (!projectConfig.projectConfig) {
|
|
23
25
|
uiLogger.error(commands.project.migrate.errors.noProjectConfig(uiCommandReference('hs app migrate')));
|
|
@@ -37,7 +39,6 @@ async function handler(args) {
|
|
|
37
39
|
}));
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
|
-
const { derivedAccountId } = args;
|
|
41
42
|
try {
|
|
42
43
|
const { hasMigratableThemes, migratableThemesCount } = await getHasMigratableThemes(projectConfig);
|
|
43
44
|
if (hasMigratableThemes) {
|
|
@@ -64,9 +65,11 @@ async function handler(args) {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
catch (error) {
|
|
68
|
+
await trackCommandMetadataUsage('project-migrate', { successful: false }, derivedAccountId);
|
|
67
69
|
logError(error);
|
|
68
70
|
return process.exit(EXIT_CODES.ERROR);
|
|
69
71
|
}
|
|
72
|
+
await trackCommandMetadataUsage('project-migrate', { successful: true }, derivedAccountId);
|
|
70
73
|
return process.exit(EXIT_CODES.SUCCESS);
|
|
71
74
|
}
|
|
72
75
|
function projectMigrateBuilder(yargs) {
|
package/commands/project.js
CHANGED
|
@@ -15,6 +15,7 @@ import cloneApp from './project/cloneApp.js';
|
|
|
15
15
|
import installDeps from './project/installDeps.js';
|
|
16
16
|
import profile from './project/profile.js';
|
|
17
17
|
import projectValidate from './project/validate.js';
|
|
18
|
+
import list from './project/list.js';
|
|
18
19
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
19
20
|
const command = ['project', 'projects'];
|
|
20
21
|
const describe = commands.project.describe;
|
|
@@ -23,6 +24,7 @@ function projectBuilder(yargs) {
|
|
|
23
24
|
.command(create)
|
|
24
25
|
.command(add)
|
|
25
26
|
.command(watch)
|
|
27
|
+
.command(list)
|
|
26
28
|
.command(dev)
|
|
27
29
|
.command(upload)
|
|
28
30
|
.command(deploy)
|
package/commands/remove.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const cmsRemoveCommand: YargsCommandModule<unknown, RemoveArgs>;
|
|
6
|
-
export default cmsRemoveCommand;
|
|
1
|
+
import { YargsCommandModule } from '../types/Yargs.js';
|
|
2
|
+
import { DeleteArgs } from './cms/delete.js';
|
|
3
|
+
declare const deprecatedCmsRemoveCommand: YargsCommandModule<unknown, DeleteArgs>;
|
|
4
|
+
export default deprecatedCmsRemoveCommand;
|
package/commands/remove.js
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { trackCommandUsage } from '../lib/usageTracking.js';
|
|
4
|
-
import { commands } from '../lang/en.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../lib/ui/index.js';
|
|
2
|
+
import cmsDeleteCommand from './cms/delete.js';
|
|
5
3
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
6
|
-
import {
|
|
4
|
+
import { commands } from '../lang/en.js';
|
|
7
5
|
const command = 'remove <path>';
|
|
8
|
-
const describe =
|
|
6
|
+
const describe = uiDeprecatedTag(cmsDeleteCommand.describe, false);
|
|
9
7
|
async function handler(args) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
await deleteFile(derivedAccountId, hsPath);
|
|
14
|
-
uiLogger.log(commands.remove.deleted(hsPath, derivedAccountId));
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
uiLogger.error(commands.remove.errors.deleteFailed(hsPath, derivedAccountId));
|
|
18
|
-
logError(error, new ApiErrorContext({
|
|
19
|
-
accountId: derivedAccountId,
|
|
20
|
-
request: hsPath,
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
8
|
+
uiCommandRelocatedMessage('hs cms delete');
|
|
9
|
+
await cmsDeleteCommand.handler(args);
|
|
23
10
|
}
|
|
24
|
-
function
|
|
11
|
+
function deprecatedCmsRemoveBuilder(yargs) {
|
|
25
12
|
yargs.positional('path', {
|
|
26
|
-
describe: commands.
|
|
13
|
+
describe: commands.cms.subcommands.delete.positionals.path,
|
|
27
14
|
type: 'string',
|
|
28
15
|
});
|
|
29
16
|
return yargs;
|
|
30
17
|
}
|
|
31
|
-
const
|
|
18
|
+
const verboseDescribe = uiCommandRenamedDescription(cmsDeleteCommand.describe, 'hs cms delete');
|
|
19
|
+
const builder = makeYargsBuilder(deprecatedCmsRemoveBuilder, command, verboseDescribe, {
|
|
32
20
|
useGlobalOptions: true,
|
|
33
21
|
useConfigOptions: true,
|
|
34
22
|
useAccountOptions: true,
|
|
35
23
|
useEnvironmentOptions: true,
|
|
36
24
|
});
|
|
37
|
-
const
|
|
25
|
+
const deprecatedCmsRemoveCommand = {
|
|
38
26
|
command,
|
|
39
27
|
describe,
|
|
40
28
|
handler,
|
|
41
29
|
builder,
|
|
42
30
|
};
|
|
43
|
-
export default
|
|
31
|
+
export default deprecatedCmsRemoveCommand;
|
|
@@ -13,7 +13,7 @@ import { commands } from '../../lang/en.js';
|
|
|
13
13
|
import { createDeveloperTestAccountConfigPrompt } from '../../lib/prompts/createDeveloperTestAccountConfigPrompt.js';
|
|
14
14
|
import { debugError, logError } from '../../lib/errorHandlers/index.js';
|
|
15
15
|
import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
16
|
-
import {
|
|
16
|
+
import { createDeveloperTestAccountV2, saveAccountToConfig, } from '../../lib/buildAccount.js';
|
|
17
17
|
const command = 'create';
|
|
18
18
|
const describe = commands.testAccount.create.describe;
|
|
19
19
|
async function handler(args) {
|
|
@@ -69,7 +69,7 @@ async function handler(args) {
|
|
|
69
69
|
text: commands.testAccount.create.polling.start(testAccountConfig.accountName),
|
|
70
70
|
});
|
|
71
71
|
try {
|
|
72
|
-
const createResult = await
|
|
72
|
+
const createResult = await createDeveloperTestAccountV2(derivedAccountId, testAccountConfig);
|
|
73
73
|
resultJson.accountName = createResult.accountName;
|
|
74
74
|
resultJson.accountId = createResult.accountId;
|
|
75
75
|
resultJson.personalAccessKey = createResult.personalAccessKey;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const themeSelectorsCommand: YargsCommandModule<unknown, ThemeSelectorArgs>;
|
|
6
|
-
export default themeSelectorsCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
import { ThemeSelectorArgs } from '../cms/theme/generate-selectors.js';
|
|
3
|
+
declare const deprecatedGenerateSelectorsCommand: YargsCommandModule<unknown, ThemeSelectorArgs>;
|
|
4
|
+
export default deprecatedGenerateSelectorsCommand;
|
|
@@ -1,168 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { findFieldsJsonPath, combineThemeCss, setPreviewSelectors, generateInheritedSelectors, generateSelectorsMap, getMaxFieldsDepth, } from '../../lib/generateSelectors.js';
|
|
4
|
-
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../lib/ui/index.js';
|
|
2
|
+
import generateSelectorsCommand from '../cms/theme/generate-selectors.js';
|
|
5
3
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
6
|
-
import {
|
|
7
|
-
const HUBL_EXPRESSION_REGEX = new RegExp(/{%\s*(.*)\s*%}/, 'g');
|
|
8
|
-
const HUBL_VARIABLE_NAME_REGEX = new RegExp(/{%\s*set\s*(\w*)/, 'i');
|
|
9
|
-
const HUBL_STATEMENT_REGEX = new RegExp(/{{\s*[\w.(,\d\-\s)|/~]*.*}}/, 'g');
|
|
10
|
-
const HUBL_STATEMENT_PLACEHOLDER_REGEX = new RegExp(/hubl_statement_\d*/, 'g');
|
|
11
|
-
const CSS_VARS_REGEX = new RegExp(/--([\w.(,\d\-)]*):(.*);/, 'g');
|
|
12
|
-
const CSS_VARS_NAME_REGEX = new RegExp(/(--[\w.(,\d\-)]*)/, 'g');
|
|
13
|
-
const CSS_SELECTORS_REGEX = new RegExp(/([\s\w:.,\0-[\]]*){/, 'i');
|
|
14
|
-
const CSS_EXPRESSION_REGEX = new RegExp(/(?!\s)([^}])*(?![.#\s,>])[^}]*}/, 'g');
|
|
15
|
-
const THEME_PATH_REGEX = new RegExp(/=\s*.*(theme\.(\w|\.)*)/, 'i');
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
16
5
|
const command = 'generate-selectors <path>';
|
|
17
|
-
const describe =
|
|
6
|
+
const describe = uiDeprecatedTag(generateSelectorsCommand.describe, false);
|
|
18
7
|
async function handler(args) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (!fieldsJsonPath) {
|
|
22
|
-
uiLogger.error(commands.theme.subcommands.generateSelectors.errors.fieldsNotFound);
|
|
23
|
-
process.exit(EXIT_CODES.ERROR);
|
|
24
|
-
}
|
|
25
|
-
let fieldsJson = JSON.parse(fs.readFileSync(fieldsJsonPath, 'utf-8'));
|
|
26
|
-
let cssString = combineThemeCss(path) ?? '';
|
|
27
|
-
/**
|
|
28
|
-
* Creates map of HubL variable names to theme field paths
|
|
29
|
-
*/
|
|
30
|
-
const HubLExpressions = cssString.match(HUBL_EXPRESSION_REGEX);
|
|
31
|
-
const hublVariableMap = HubLExpressions
|
|
32
|
-
? HubLExpressions.reduce((_hublVariableMap, expression) => {
|
|
33
|
-
const variableName = expression.match(HUBL_VARIABLE_NAME_REGEX);
|
|
34
|
-
const themeFieldKey = expression.match(THEME_PATH_REGEX);
|
|
35
|
-
if (!themeFieldKey || !variableName)
|
|
36
|
-
return _hublVariableMap;
|
|
37
|
-
_hublVariableMap[variableName[1]] = themeFieldKey[1];
|
|
38
|
-
return _hublVariableMap;
|
|
39
|
-
}, {})
|
|
40
|
-
: {};
|
|
41
|
-
/**
|
|
42
|
-
* Removes HubL variable expressions
|
|
43
|
-
*/
|
|
44
|
-
cssString = cssString.replace(HUBL_EXPRESSION_REGEX, '');
|
|
45
|
-
/**
|
|
46
|
-
* Regex for HubL variable names
|
|
47
|
-
*/
|
|
48
|
-
const HUBL_EXPRESSIONS = new RegExp(`.*(${Object.keys(hublVariableMap).join('|')}).*`, 'g');
|
|
49
|
-
/**
|
|
50
|
-
* Matches all HubL statements in the CSS and replaces them with a placeholder string
|
|
51
|
-
* This is to prevent the the css expression regex from capturing all the HubL as well
|
|
52
|
-
*/
|
|
53
|
-
const hublStatements = cssString.match(HUBL_STATEMENT_REGEX) || [];
|
|
54
|
-
const hublStatementsMap = {};
|
|
55
|
-
hublStatements.forEach((statement, index) => {
|
|
56
|
-
const statementKey = `hubl_statement_${index}`;
|
|
57
|
-
hublStatementsMap[statementKey] = statement;
|
|
58
|
-
cssString = cssString.replace(statement, statementKey);
|
|
59
|
-
});
|
|
60
|
-
/**
|
|
61
|
-
* Matchs all css variables and determines if there are hubl within those vars.
|
|
62
|
-
*/
|
|
63
|
-
const cssVars = cssString.match(CSS_VARS_REGEX) || [];
|
|
64
|
-
const cssVarsMap = cssVars.reduce((acc, expression) => {
|
|
65
|
-
const cssVarName = expression.match(CSS_VARS_NAME_REGEX);
|
|
66
|
-
const hublVariables = expression.match(HUBL_STATEMENT_PLACEHOLDER_REGEX);
|
|
67
|
-
if (!cssVarName || !hublVariables)
|
|
68
|
-
return acc;
|
|
69
|
-
cssString = cssString.replace(expression, '');
|
|
70
|
-
return { ...acc, [cssVarName[0]]: hublVariables };
|
|
71
|
-
}, {});
|
|
72
|
-
// replace all css variable references with corresponding hubl placeholder
|
|
73
|
-
Object.keys(cssVarsMap).forEach(cssVarName => {
|
|
74
|
-
const hublPlaceholders = cssVarsMap[cssVarName];
|
|
75
|
-
cssString = cssString.replace(cssVarName, hublPlaceholders.join(' '));
|
|
76
|
-
});
|
|
77
|
-
/**
|
|
78
|
-
* Parses each css string for a HubL statement and tries to map theme field paths to CSS selectors
|
|
79
|
-
*/
|
|
80
|
-
const cssExpressions = (cssString.match(CSS_EXPRESSION_REGEX) || []).map(exp => exp.replace(/\r?\n/g, ' '));
|
|
81
|
-
const finalMap = cssExpressions.reduce((themeFieldsSelectorMap, cssExpression) => {
|
|
82
|
-
const hublStatementsPlaceholderKey = cssExpression.match(HUBL_STATEMENT_PLACEHOLDER_REGEX) || [];
|
|
83
|
-
hublStatementsPlaceholderKey.forEach(placeholderKey => {
|
|
84
|
-
let hublStatement;
|
|
85
|
-
let themeFieldPath;
|
|
86
|
-
if (placeholderKey in hublStatementsMap) {
|
|
87
|
-
hublStatement =
|
|
88
|
-
hublStatementsMap[placeholderKey].match(HUBL_EXPRESSIONS);
|
|
89
|
-
themeFieldPath =
|
|
90
|
-
hublStatementsMap[placeholderKey].match(/theme\.[\w|.]*/);
|
|
91
|
-
}
|
|
92
|
-
const cssSelectors = cssExpression.match(CSS_SELECTORS_REGEX);
|
|
93
|
-
/**
|
|
94
|
-
* Try to match a HubL statement to any HubL Variables being used
|
|
95
|
-
*/
|
|
96
|
-
if (cssSelectors && themeFieldPath) {
|
|
97
|
-
const cssSelector = cssSelectors[1].replace(/\n/g, ' ');
|
|
98
|
-
const hublThemePath = themeFieldPath?.[0] ?? '';
|
|
99
|
-
if (!themeFieldsSelectorMap[hublThemePath]) {
|
|
100
|
-
themeFieldsSelectorMap[hublThemePath] = [];
|
|
101
|
-
}
|
|
102
|
-
if (!themeFieldsSelectorMap[hublThemePath].includes(cssSelector)) {
|
|
103
|
-
themeFieldsSelectorMap[hublThemePath] =
|
|
104
|
-
themeFieldsSelectorMap[hublThemePath].concat(cssSelector);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (cssSelectors && hublStatement) {
|
|
108
|
-
const cssSelector = cssSelectors?.[1]?.replace(/\n/g, ' ') ?? '';
|
|
109
|
-
const hublVariableName = Object.keys(hublVariableMap).find(_hubl => {
|
|
110
|
-
return hublStatement && hublStatement[0].includes(_hubl);
|
|
111
|
-
}) || '';
|
|
112
|
-
const themeFieldKey = hublVariableName
|
|
113
|
-
? hublVariableMap[hublVariableName]
|
|
114
|
-
: undefined;
|
|
115
|
-
/**
|
|
116
|
-
* If the theme path is referenced directly add selectors
|
|
117
|
-
*/
|
|
118
|
-
if (themeFieldKey) {
|
|
119
|
-
if (!themeFieldsSelectorMap[themeFieldKey]) {
|
|
120
|
-
themeFieldsSelectorMap[themeFieldKey] = [];
|
|
121
|
-
}
|
|
122
|
-
if (!themeFieldsSelectorMap[themeFieldKey].includes(cssSelector)) {
|
|
123
|
-
themeFieldsSelectorMap[themeFieldKey] =
|
|
124
|
-
themeFieldsSelectorMap[themeFieldKey].concat(cssSelector);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
return themeFieldsSelectorMap;
|
|
130
|
-
}, {});
|
|
131
|
-
if (!Object.keys(finalMap).length) {
|
|
132
|
-
uiLogger.error(commands.theme.subcommands.generateSelectors.errors.noSelectorsFound);
|
|
133
|
-
process.exit(EXIT_CODES.ERROR);
|
|
134
|
-
}
|
|
135
|
-
Object.keys(finalMap).forEach(themeFieldKey => {
|
|
136
|
-
const fieldKey = themeFieldKey.split('.');
|
|
137
|
-
const selectors = finalMap[themeFieldKey];
|
|
138
|
-
fieldsJson = setPreviewSelectors(fieldsJson, fieldKey.splice(1), selectors);
|
|
139
|
-
});
|
|
140
|
-
// Because fields can have nested inheritance we generated inherited selectors
|
|
141
|
-
// multiple times to make sure all inherted selectors are bubbled up.
|
|
142
|
-
const maxFieldsDepth = getMaxFieldsDepth();
|
|
143
|
-
for (let i = 0; i < maxFieldsDepth; i += 1) {
|
|
144
|
-
fieldsJson = generateInheritedSelectors(fieldsJson);
|
|
145
|
-
}
|
|
146
|
-
const selectorsMap = generateSelectorsMap(fieldsJson);
|
|
147
|
-
const selectorsPath = `${path}/editor-preview.json`;
|
|
148
|
-
fs.writeFileSync(selectorsPath, `${JSON.stringify({ selectors: selectorsMap }, null, 2)}\n`);
|
|
149
|
-
uiLogger.success(commands.theme.subcommands.generateSelectors.success(path, selectorsPath));
|
|
8
|
+
uiCommandRelocatedMessage('hs cms theme generate-selectors');
|
|
9
|
+
await generateSelectorsCommand.handler(args);
|
|
150
10
|
}
|
|
151
|
-
function
|
|
11
|
+
function deprecatedThemeSelectorBuilder(yargs) {
|
|
152
12
|
yargs.positional('path', {
|
|
153
|
-
describe: commands.theme.subcommands.generateSelectors.positionals
|
|
13
|
+
describe: commands.cms.subcommands.theme.subcommands.generateSelectors.positionals
|
|
14
|
+
.path,
|
|
154
15
|
type: 'string',
|
|
155
16
|
required: true,
|
|
156
17
|
});
|
|
157
18
|
return yargs;
|
|
158
19
|
}
|
|
159
|
-
const
|
|
20
|
+
const verboseDescribe = uiCommandRenamedDescription(generateSelectorsCommand.describe, 'hs cms theme generate-selectors');
|
|
21
|
+
const builder = makeYargsBuilder(deprecatedThemeSelectorBuilder, command, verboseDescribe, {
|
|
160
22
|
useGlobalOptions: true,
|
|
161
23
|
});
|
|
162
|
-
const
|
|
163
|
-
|
|
24
|
+
const deprecatedGenerateSelectorsCommand = {
|
|
25
|
+
...generateSelectorsCommand,
|
|
164
26
|
describe,
|
|
165
27
|
handler,
|
|
166
28
|
builder,
|
|
167
29
|
};
|
|
168
|
-
export default
|
|
30
|
+
export default deprecatedGenerateSelectorsCommand;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const themeValidateCommand: YargsCommandModule<unknown, ThemeValidateArgs>;
|
|
6
|
-
export default themeValidateCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
import { ThemeValidateArgs } from '../cms/theme/marketplace-validate.js';
|
|
3
|
+
declare const deprecatedMarketplaceValidateCommand: YargsCommandModule<unknown, ThemeValidateArgs>;
|
|
4
|
+
export default deprecatedMarketplaceValidateCommand;
|
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { kickOffValidation, pollForValidationFinish, fetchValidationResults, processValidationErrors, displayValidationResults, } from '../../lib/marketplaceValidate.js';
|
|
4
|
-
import { commands } from '../../lang/en.js';
|
|
1
|
+
import { uiCommandRelocatedMessage, uiCommandRenamedDescription, uiDeprecatedTag, } from '../../lib/ui/index.js';
|
|
2
|
+
import marketplaceValidateCommand from '../cms/theme/marketplace-validate.js';
|
|
5
3
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
4
|
+
import { commands } from '../../lang/en.js';
|
|
6
5
|
const command = 'marketplace-validate <path>';
|
|
7
|
-
const describe =
|
|
6
|
+
const describe = uiDeprecatedTag(marketplaceValidateCommand.describe, false);
|
|
8
7
|
async function handler(args) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
SpinniesManager.init();
|
|
12
|
-
SpinniesManager.add('marketplaceValidation', {
|
|
13
|
-
text: commands.theme.subcommands.marketplaceValidate.logs.validatingTheme(path),
|
|
14
|
-
});
|
|
15
|
-
const assetType = 'THEME';
|
|
16
|
-
const validationId = await kickOffValidation(derivedAccountId, assetType, path);
|
|
17
|
-
await pollForValidationFinish(derivedAccountId, validationId);
|
|
18
|
-
SpinniesManager.remove('marketplaceValidation');
|
|
19
|
-
const validationResults = await fetchValidationResults(derivedAccountId, validationId);
|
|
20
|
-
processValidationErrors(commands.theme.subcommands.marketplaceValidate.errors.invalidPath, validationResults);
|
|
21
|
-
displayValidationResults(commands.theme.subcommands.marketplaceValidate.results, validationResults);
|
|
22
|
-
process.exit();
|
|
8
|
+
uiCommandRelocatedMessage('hs cms theme marketplace-validate');
|
|
9
|
+
await marketplaceValidateCommand.handler(args);
|
|
23
10
|
}
|
|
24
|
-
function
|
|
11
|
+
function deprecatedThemeValidateBuilder(yargs) {
|
|
25
12
|
yargs.positional('path', {
|
|
26
|
-
describe: commands.theme.subcommands.marketplaceValidate.positionals
|
|
13
|
+
describe: commands.cms.subcommands.theme.subcommands.marketplaceValidate.positionals
|
|
14
|
+
.path.describe,
|
|
27
15
|
type: 'string',
|
|
28
16
|
required: true,
|
|
29
17
|
});
|
|
30
18
|
return yargs;
|
|
31
19
|
}
|
|
32
|
-
const
|
|
20
|
+
const verboseDescribe = uiCommandRenamedDescription(marketplaceValidateCommand.describe, 'hs cms theme marketplace-validate');
|
|
21
|
+
const builder = makeYargsBuilder(deprecatedThemeValidateBuilder, command, verboseDescribe, {
|
|
33
22
|
useGlobalOptions: true,
|
|
34
23
|
useConfigOptions: true,
|
|
35
24
|
useAccountOptions: true,
|
|
36
25
|
useEnvironmentOptions: true,
|
|
37
26
|
});
|
|
38
|
-
const
|
|
39
|
-
|
|
27
|
+
const deprecatedMarketplaceValidateCommand = {
|
|
28
|
+
...marketplaceValidateCommand,
|
|
40
29
|
describe,
|
|
41
30
|
handler,
|
|
42
31
|
builder,
|
|
43
32
|
};
|
|
44
|
-
export default
|
|
33
|
+
export default deprecatedMarketplaceValidateCommand;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
notify: string;
|
|
6
|
-
'no-ssl'?: boolean;
|
|
7
|
-
port?: number;
|
|
8
|
-
resetSession?: boolean;
|
|
9
|
-
generateFieldsTypes?: boolean;
|
|
10
|
-
};
|
|
11
|
-
declare const themePreviewCommand: YargsCommandModule<unknown, ThemePreviewArgs>;
|
|
12
|
-
export default themePreviewCommand;
|
|
1
|
+
import { YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
import { ThemePreviewArgs } from '../cms/theme/preview.js';
|
|
3
|
+
declare const deprecatedPreviewCommand: YargsCommandModule<unknown, ThemePreviewArgs>;
|
|
4
|
+
export default deprecatedPreviewCommand;
|