@sitecore-content-sdk/cli 2.0.0-canary.9 → 2.0.2-canary.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.
@@ -54,12 +54,14 @@ const path_1 = __importDefault(require("path"));
54
54
  const chalk_1 = __importDefault(require("chalk"));
55
55
  const child_process_1 = require("child_process");
56
56
  const tools = __importStar(require("@sitecore-content-sdk/content/tools"));
57
+ const core_1 = require("@sitecore-content-sdk/core");
57
58
  const serverTools = __importStar(require("@sitecore-content-sdk/content/node-tools"));
58
59
  const inquirer_1 = __importDefault(require("inquirer"));
59
60
  const generate_map_1 = require("./generate-map");
60
61
  const load_config_1 = __importDefault(require("../../../utils/load-config"));
61
62
  let { getComponentSpec, getComponentSpecUrl } = tools;
62
63
  let { getComponentList } = serverTools;
64
+ const { ERROR_MESSAGES } = core_1.constants;
63
65
  const unitMocks = (toolsModule) => {
64
66
  getComponentSpec = toolsModule.getComponentSpec;
65
67
  getComponentList = toolsModule.getComponentList;
@@ -149,7 +151,7 @@ function handler(argv) {
149
151
  let targetPath = targetPathArg;
150
152
  const cliConfig = (0, load_config_1.default)(config);
151
153
  if (!cliConfig.config) {
152
- console.error('The `sitecore.cli.config` file is missing a `config`. Please add it to use this command.');
154
+ console.error(ERROR_MESSAGES.MV_005('config'));
153
155
  return;
154
156
  }
155
157
  const { edgeUrl } = cliConfig.config.api.edge;
@@ -236,7 +238,7 @@ function handler(argv) {
236
238
  fs_1.default.renameSync(backupPath, resolvedFilePath);
237
239
  }
238
240
  const errorMessage = error instanceof Error ? error.message : String(error);
239
- console.error(chalk_1.default.red(`Failed to add component: ${errorMessage}`));
241
+ console.error(chalk_1.default.red(`Failed to add a generated component. ${errorMessage}. ${ERROR_MESSAGES.CONTACT_SUPPORT}`));
240
242
  return;
241
243
  }
242
244
  });
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.builder = builder;
7
7
  exports.args = args;
8
8
  exports.handler = handler;
9
+ const core_1 = require("@sitecore-content-sdk/core");
9
10
  const watch_items_1 = require("../../../utils/watch-items");
10
11
  const load_config_1 = __importDefault(require("../../../utils/load-config"));
12
+ const { ERROR_MESSAGES } = core_1.constants;
11
13
  /**
12
14
  * @param {Argv} yargs
13
15
  */
@@ -40,7 +42,7 @@ function args(yargs) {
40
42
  function handler(argv) {
41
43
  const cliConfig = (0, load_config_1.default)(argv.config);
42
44
  if (!cliConfig.componentMap) {
43
- console.error('The `sitecore.cli.config` file is missing a `componentMap` configuration. Please add it to use this command.');
45
+ console.error(ERROR_MESSAGES.MV_005('componentMap'));
44
46
  return;
45
47
  }
46
48
  const componentMapGenerator = cliConfig.componentMap.generator;
@@ -12,12 +12,14 @@ import path from 'path';
12
12
  import chalk from 'chalk';
13
13
  import { execSync } from 'child_process';
14
14
  import * as tools from '@sitecore-content-sdk/content/tools';
15
+ import { constants } from '@sitecore-content-sdk/core';
15
16
  import * as serverTools from '@sitecore-content-sdk/content/node-tools';
16
17
  import inquirer from 'inquirer';
17
18
  import { handler as generateMapHandler } from './generate-map';
18
19
  import loadCliConfig from '../../../utils/load-config';
19
20
  let { getComponentSpec, getComponentSpecUrl } = tools;
20
21
  let { getComponentList } = serverTools;
22
+ const { ERROR_MESSAGES } = constants;
21
23
  export const unitMocks = (toolsModule) => {
22
24
  getComponentSpec = toolsModule.getComponentSpec;
23
25
  getComponentList = toolsModule.getComponentList;
@@ -106,7 +108,7 @@ export function handler(argv) {
106
108
  let targetPath = targetPathArg;
107
109
  const cliConfig = loadCliConfig(config);
108
110
  if (!cliConfig.config) {
109
- console.error('The `sitecore.cli.config` file is missing a `config`. Please add it to use this command.');
111
+ console.error(ERROR_MESSAGES.MV_005('config'));
110
112
  return;
111
113
  }
112
114
  const { edgeUrl } = cliConfig.config.api.edge;
@@ -193,7 +195,7 @@ export function handler(argv) {
193
195
  fs.renameSync(backupPath, resolvedFilePath);
194
196
  }
195
197
  const errorMessage = error instanceof Error ? error.message : String(error);
196
- console.error(chalk.red(`Failed to add component: ${errorMessage}`));
198
+ console.error(chalk.red(`Failed to add a generated component. ${errorMessage}. ${ERROR_MESSAGES.CONTACT_SUPPORT}`));
197
199
  return;
198
200
  }
199
201
  });
@@ -1,5 +1,7 @@
1
+ import { constants } from '@sitecore-content-sdk/core';
1
2
  import { watchItems } from '../../../utils/watch-items';
2
3
  import loadCliConfig from '../../../utils/load-config';
4
+ const { ERROR_MESSAGES } = constants;
3
5
  /**
4
6
  * @param {Argv} yargs
5
7
  */
@@ -32,7 +34,7 @@ export function args(yargs) {
32
34
  export function handler(argv) {
33
35
  const cliConfig = loadCliConfig(argv.config);
34
36
  if (!cliConfig.componentMap) {
35
- console.error('The `sitecore.cli.config` file is missing a `componentMap` configuration. Please add it to use this command.');
37
+ console.error(ERROR_MESSAGES.MV_005('componentMap'));
36
38
  return;
37
39
  }
38
40
  const componentMapGenerator = cliConfig.componentMap.generator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/cli",
3
- "version": "2.0.0-canary.9",
3
+ "version": "2.0.2-canary.0",
4
4
  "description": "Sitecore Content SDK CLI",
5
5
  "main": "dist/cjs/cli.js",
6
6
  "module": "dist/esm/cli.js",
@@ -34,7 +34,8 @@
34
34
  "url": "https://github.com/sitecore/content-sdk/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@sitecore-content-sdk/content": "2.0.0-canary.9",
37
+ "@sitecore-content-sdk/content": "2.0.2-canary.0",
38
+ "@sitecore-content-sdk/core": "2.0.2-canary.0",
38
39
  "chokidar": "^4.0.3",
39
40
  "dotenv": "^16.5.0",
40
41
  "dotenv-expand": "^12.0.2",
@@ -71,7 +72,7 @@
71
72
  "ts-node": "^10.9.1",
72
73
  "typescript": "~5.8.3"
73
74
  },
74
- "gitHead": "152ff7ce9979733dfe56ec6872fd8b466370d594",
75
+ "gitHead": "2c38dbe915264c92dfc8482535afa0f0466e0b35",
75
76
  "files": [
76
77
  "dist",
77
78
  "types"
@@ -32,12 +32,12 @@ type AddArgs = {
32
32
  targetPath?: string;
33
33
  /**
34
34
  * If true, skips the component map generation.
35
- * Default: false.
35
+ * Default: `false`.
36
36
  */
37
37
  skipComponentMap?: boolean;
38
38
  /**
39
39
  * If true, overwrites the existing component.
40
- * Default: false.
40
+ * Default: `false`.
41
41
  */
42
42
  overwrite?: boolean;
43
43
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/scripts/project/component/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAK7B,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAM7D,QAAA,IAAM,gBAAgB;;;;;+GAAE,mBAAmB;;;;;YAAU,CAAC;AACtD,QAAA,IAAM,gBAAgB,2FAAgB,CAAC;AAEvC,eAAO,MAAM,SAAS,GAAI,aAAa;IACrC,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;CACjD,SAIA,CAAC;AAEF,KAAK,OAAO,GAAG;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;;;;;;;;;;;;GA4CxC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,iBAQ3C;AAyBD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,iBAoI1C"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/scripts/project/component/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAK7B,OAAO,KAAK,KAAK,MAAM,qCAAqC,CAAC;AAO7D,QAAA,IAAM,gBAAgB;;;;;+GAAE,mBAAmB;;;;;YAAU,CAAC;AACtD,QAAA,IAAM,gBAAgB,2FAAgB,CAAC;AAIvC,eAAO,MAAM,SAAS,GAAI,aAAa;IACrC,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;IAC1C,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;CACjD,SAIA,CAAC;AAEF,KAAK,OAAO,GAAG;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;;;;;;;;;;;;GA4CxC;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,iBAQ3C;AAyBD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,OAAO,iBAsI1C"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-map.d.ts","sourceRoot":"","sources":["../../../../src/scripts/project/component/generate-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAI7B;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,4BAOtD;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC;;;;GAiBnD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,kBAAkB,QAqC/C"}
1
+ {"version":3,"file":"generate-map.d.ts","sourceRoot":"","sources":["../../../../src/scripts/project/component/generate-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAO7B;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,4BAOtD;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC;;;;GAiBnD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,kBAAkB,QAqC/C"}