@sitecore-content-sdk/cli 1.3.0-canary.9 → 1.4.0-canary.1

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.
Files changed (49) hide show
  1. package/README.md +5 -5
  2. package/dist/cjs/bin/sitecore-tools.js +77 -77
  3. package/dist/cjs/cli.js +69 -69
  4. package/dist/cjs/scripts/index.js +40 -40
  5. package/dist/cjs/scripts/project/build.js +42 -42
  6. package/dist/cjs/scripts/project/component/add.js +241 -236
  7. package/dist/cjs/scripts/project/component/generate-map.js +70 -68
  8. package/dist/cjs/scripts/project/component/index.js +57 -57
  9. package/dist/cjs/scripts/project/component/scaffold.js +69 -66
  10. package/dist/cjs/scripts/project/index.js +56 -56
  11. package/dist/cjs/utils/load-config.js +42 -42
  12. package/dist/cjs/utils/process-env.js +70 -70
  13. package/dist/cjs/utils/watch-items.js +18 -18
  14. package/dist/esm/cli.js +63 -63
  15. package/dist/esm/scripts/index.js +4 -4
  16. package/dist/esm/scripts/project/build.js +35 -35
  17. package/dist/esm/scripts/project/component/add.js +198 -193
  18. package/dist/esm/scripts/project/component/generate-map.js +62 -60
  19. package/dist/esm/scripts/project/component/index.js +21 -21
  20. package/dist/esm/scripts/project/component/scaffold.js +61 -58
  21. package/dist/esm/scripts/project/index.js +20 -20
  22. package/dist/esm/utils/load-config.js +36 -36
  23. package/dist/esm/utils/process-env.js +31 -31
  24. package/dist/esm/utils/watch-items.js +12 -12
  25. package/package.json +3 -3
  26. package/types/bin/sitecore-tools.d.ts +3 -2
  27. package/types/bin/sitecore-tools.d.ts.map +1 -0
  28. package/types/cli.d.ts +14 -13
  29. package/types/cli.d.ts.map +1 -0
  30. package/types/scripts/index.d.ts +3 -2
  31. package/types/scripts/index.d.ts.map +1 -0
  32. package/types/scripts/project/build.d.ts +25 -24
  33. package/types/scripts/project/build.d.ts.map +1 -0
  34. package/types/scripts/project/component/add.d.ts +59 -58
  35. package/types/scripts/project/component/add.d.ts.map +1 -0
  36. package/types/scripts/project/component/generate-map.d.ts +33 -32
  37. package/types/scripts/project/component/generate-map.d.ts.map +1 -0
  38. package/types/scripts/project/component/index.d.ts +6 -5
  39. package/types/scripts/project/component/index.d.ts.map +1 -0
  40. package/types/scripts/project/component/scaffold.d.ts +45 -44
  41. package/types/scripts/project/component/scaffold.d.ts.map +1 -0
  42. package/types/scripts/project/index.d.ts +6 -5
  43. package/types/scripts/project/index.d.ts.map +1 -0
  44. package/types/utils/load-config.d.ts +9 -8
  45. package/types/utils/load-config.d.ts.map +1 -0
  46. package/types/utils/process-env.d.ts +9 -8
  47. package/types/utils/process-env.d.ts.map +1 -0
  48. package/types/utils/watch-items.d.ts +7 -6
  49. package/types/utils/watch-items.d.ts.map +1 -0
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # Sitecore Content SDK CLI
2
-
3
- This module is provided as a part of Sitecore Contents SDK. It contains the Sitecore Content SDK command line interface.
4
-
5
- [Documentation Sitecore Content SDK CLI](https://doc.sitecore.com/xmc/en/developers/content-sdk/cli-commands-and-configuration.html)
1
+ # Sitecore Content SDK CLI
2
+
3
+ This module is provided as a part of Sitecore Contents SDK. It contains the Sitecore Content SDK command line interface.
4
+
5
+ [Documentation Sitecore Content SDK CLI](https://doc.sitecore.com/xmc/en/developers/content-sdk/cli-commands-and-configuration.html)
@@ -1,77 +1,77 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const resolve_1 = __importDefault(require("resolve"));
41
- const process_env_1 = __importDefault(require("../utils/process-env"));
42
- const commands = __importStar(require("../scripts"));
43
- /**
44
- * Resolves and executes the locally installed version of the sitecore content sdk CLI (sitecore-tools).
45
- */
46
- (0, resolve_1.default)('@sitecore-content-sdk/cli', { basedir: process.cwd() }, (error, projectLocalCli) => {
47
- let cli;
48
- if (error) {
49
- // If there is an error, resolve could not find the cli
50
- // library from a package.json. Instead, include it from a relative
51
- // path to this script file (which is likely a globally installed
52
- // npm package).
53
- // Not erroring here because cli can be used in global mode.
54
- cli = require('../cli').default;
55
- console.warn('Sitecore Content SDK CLI is running in global mode because it was not installed in the local node_modules folder.');
56
- }
57
- else {
58
- // No error implies a projectLocalCli, which will load whatever
59
- // version of content sdk cli you have installed in a local package.json
60
- cli = require(projectLocalCli).default;
61
- }
62
- // load environment variables from current working directory
63
- // if the current working directory is not an app project root .env file will be missing and nothing will be loaded
64
- // in that case loading environment variables will be handled by the actual cli command
65
- (0, process_env_1.default)(process.cwd());
66
- // Re-enable debug logging after environment variables are loaded
67
- // This ensures that DEBUG environment variables from .env files take effect
68
- if (process.env.DEBUG) {
69
- const debugScopes = process.env.DEBUG.split(',')
70
- .map((scope) => scope.trim())
71
- .filter(Boolean);
72
- console.log(`Debug enabled for scopes: [${debugScopes.join(', ')}]`);
73
- const debug = require('debug');
74
- debug.enable(process.env.DEBUG);
75
- }
76
- cli(commands);
77
- });
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const resolve_1 = __importDefault(require("resolve"));
41
+ const process_env_1 = __importDefault(require("../utils/process-env"));
42
+ const commands = __importStar(require("../scripts"));
43
+ /**
44
+ * Resolves and executes the locally installed version of the sitecore content sdk CLI (sitecore-tools).
45
+ */
46
+ (0, resolve_1.default)('@sitecore-content-sdk/cli', { basedir: process.cwd() }, (error, projectLocalCli) => {
47
+ let cli;
48
+ if (error) {
49
+ // If there is an error, resolve could not find the cli
50
+ // library from a package.json. Instead, include it from a relative
51
+ // path to this script file (which is likely a globally installed
52
+ // npm package).
53
+ // Not erroring here because cli can be used in global mode.
54
+ cli = require('../cli').default;
55
+ console.warn('Sitecore Content SDK CLI is running in global mode because it was not installed in the local node_modules folder.');
56
+ }
57
+ else {
58
+ // No error implies a projectLocalCli, which will load whatever
59
+ // version of content sdk cli you have installed in a local package.json
60
+ cli = require(projectLocalCli).default;
61
+ }
62
+ // load environment variables from current working directory
63
+ // if the current working directory is not an app project root .env file will be missing and nothing will be loaded
64
+ // in that case loading environment variables will be handled by the actual cli command
65
+ (0, process_env_1.default)(process.cwd());
66
+ // Re-enable debug logging after environment variables are loaded
67
+ // This ensures that DEBUG environment variables from .env files take effect
68
+ if (process.env.DEBUG) {
69
+ const debugScopes = process.env.DEBUG.split(',')
70
+ .map((scope) => scope.trim())
71
+ .filter(Boolean);
72
+ console.log(`Debug enabled for scopes: [${debugScopes.join(', ')}]`);
73
+ const debug = require('debug');
74
+ debug.enable(process.env.DEBUG);
75
+ }
76
+ cli(commands);
77
+ });
package/dist/cjs/cli.js CHANGED
@@ -1,69 +1,69 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.default = cli;
16
- const yargs_1 = __importDefault(require("yargs"));
17
- // Makes the script crash on unhandled rejections instead of silently
18
- // ignoring them. In the future, promise rejections that are not handled will
19
- // terminate the Node.js process with a non-zero exit code.
20
- process.on('unhandledRejection', (err) => {
21
- throw err;
22
- });
23
- /**
24
- * Initializes and configures the CLI application using yargs.
25
- * This function registers commands, sets up argument parsing, and handles command execution.
26
- * @param {object} commands - An object containing command modules to be registered with yargs.
27
- * Each key in the object represents a command name, and the value is a `CommandModule` object
28
- * that defines the command's behavior, arguments, and options.
29
- */
30
- function cli(commands) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- let appCommands = yargs_1.default.usage('$0 <command>');
33
- appCommands = appCommands.scriptName('sitecore-tools');
34
- // Register commands if available
35
- if (commands && Object.keys(commands).length > 0) {
36
- for (const cmd of Object.keys(commands)) {
37
- const commandObject = commands[cmd];
38
- if (typeof commandObject.builder === 'function') {
39
- appCommands = yield commandObject.builder(appCommands);
40
- }
41
- if (typeof commandObject.builder === 'object') {
42
- const ogBuilder = commandObject.builder;
43
- const builderFunc = commandObject.disableStrictArgs
44
- ? (yarrrrg) => yarrrrg.options(ogBuilder)
45
- : (yarrrrg) => yarrrrg.options(ogBuilder).strict();
46
- commandObject.builder = builderFunc;
47
- appCommands = appCommands.command(commandObject);
48
- }
49
- }
50
- }
51
- appCommands
52
- .command({
53
- command: '*',
54
- handler: (argv) => {
55
- if (argv._.length > 0) {
56
- console.error(`Command not found: "${argv._[0]}"`);
57
- }
58
- else {
59
- console.error('No command provided');
60
- }
61
- yargs_1.default.showHelp();
62
- process.exit(1);
63
- },
64
- })
65
- .demandCommand(1, 'You need to specify a command to run')
66
- .strict();
67
- yield appCommands.argv;
68
- });
69
- }
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = cli;
16
+ const yargs_1 = __importDefault(require("yargs"));
17
+ // Makes the script crash on unhandled rejections instead of silently
18
+ // ignoring them. In the future, promise rejections that are not handled will
19
+ // terminate the Node.js process with a non-zero exit code.
20
+ process.on('unhandledRejection', (err) => {
21
+ throw err;
22
+ });
23
+ /**
24
+ * Initializes and configures the CLI application using yargs.
25
+ * This function registers commands, sets up argument parsing, and handles command execution.
26
+ * @param {object} commands - An object containing command modules to be registered with yargs.
27
+ * Each key in the object represents a command name, and the value is a `CommandModule` object
28
+ * that defines the command's behavior, arguments, and options.
29
+ */
30
+ function cli(commands) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ let appCommands = yargs_1.default.usage('$0 <command>');
33
+ appCommands = appCommands.scriptName('sitecore-tools');
34
+ // Register commands if available
35
+ if (commands && Object.keys(commands).length > 0) {
36
+ for (const cmd of Object.keys(commands)) {
37
+ const commandObject = commands[cmd];
38
+ if (typeof commandObject.builder === 'function') {
39
+ appCommands = yield commandObject.builder(appCommands);
40
+ }
41
+ if (typeof commandObject.builder === 'object') {
42
+ const ogBuilder = commandObject.builder;
43
+ const builderFunc = commandObject.disableStrictArgs
44
+ ? (yarrrrg) => yarrrrg.options(ogBuilder)
45
+ : (yarrrrg) => yarrrrg.options(ogBuilder).strict();
46
+ commandObject.builder = builderFunc;
47
+ appCommands = appCommands.command(commandObject);
48
+ }
49
+ }
50
+ }
51
+ appCommands
52
+ .command({
53
+ command: '*',
54
+ handler: (argv) => {
55
+ if (argv._.length > 0) {
56
+ console.error(`Command not found: "${argv._[0]}"`);
57
+ }
58
+ else {
59
+ console.error('No command provided');
60
+ }
61
+ yargs_1.default.showHelp();
62
+ process.exit(1);
63
+ },
64
+ })
65
+ .demandCommand(1, 'You need to specify a command to run')
66
+ .strict();
67
+ yield appCommands.argv;
68
+ });
69
+ }
@@ -1,40 +1,40 @@
1
- "use strict";
2
- // commands available when running from an app location (with CLI installed to local node_modules)
3
- // e.g. setup, deploy
4
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
- if (k2 === undefined) k2 = k;
6
- var desc = Object.getOwnPropertyDescriptor(m, k);
7
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
- desc = { enumerable: true, get: function() { return m[k]; } };
9
- }
10
- Object.defineProperty(o, k2, desc);
11
- }) : (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- o[k2] = m[k];
14
- }));
15
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
- Object.defineProperty(o, "default", { enumerable: true, value: v });
17
- }) : function(o, v) {
18
- o["default"] = v;
19
- });
20
- var __importStar = (this && this.__importStar) || (function () {
21
- var ownKeys = function(o) {
22
- ownKeys = Object.getOwnPropertyNames || function (o) {
23
- var ar = [];
24
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
- return ar;
26
- };
27
- return ownKeys(o);
28
- };
29
- return function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- })();
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.project = void 0;
39
- const project = __importStar(require("./project"));
40
- exports.project = project;
1
+ "use strict";
2
+ // commands available when running from an app location (with CLI installed to local node_modules)
3
+ // e.g. setup, deploy
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.project = void 0;
39
+ const project = __importStar(require("./project"));
40
+ exports.project = project;
@@ -1,42 +1,42 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.builder = exports.describe = exports.command = void 0;
16
- exports.handler = handler;
17
- const load_config_1 = __importDefault(require("../../utils/load-config"));
18
- exports.command = 'build';
19
- exports.describe = 'Performs build time automation';
20
- exports.builder = {
21
- config: {
22
- requiresArg: false,
23
- type: 'string',
24
- describe: 'Path to the `sitecore.cli.config` file. Supports both JavaScript (`.js`) and TypeScript (`.ts`) formats.',
25
- },
26
- };
27
- /**
28
- * Handler for the build command.
29
- * @param {BuildArgs} argv - The arguments passed to the command.
30
- */
31
- function handler(argv) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const cliConfig = (0, load_config_1.default)(argv.config);
34
- if (cliConfig.build && Array.isArray(cliConfig.build.commands)) {
35
- for (const command of cliConfig.build.commands) {
36
- yield command({ scConfig: cliConfig.config });
37
- }
38
- }
39
- // Exit the process to avoid hanging the process by custom build commands
40
- process.exit(0);
41
- });
42
- }
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.builder = exports.describe = exports.command = void 0;
16
+ exports.handler = handler;
17
+ const load_config_1 = __importDefault(require("../../utils/load-config"));
18
+ exports.command = ['build', 'b'];
19
+ exports.describe = 'Performs build time automation';
20
+ exports.builder = {
21
+ config: {
22
+ requiresArg: false,
23
+ type: 'string',
24
+ describe: 'Path to the `sitecore.cli.config` file. Supports both JavaScript (`.js`) and TypeScript (`.ts`) formats.',
25
+ },
26
+ };
27
+ /**
28
+ * Handler for the build command.
29
+ * @param {BuildArgs} argv - The arguments passed to the command.
30
+ */
31
+ function handler(argv) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ const cliConfig = (0, load_config_1.default)(argv.config);
34
+ if (cliConfig.build && Array.isArray(cliConfig.build.commands)) {
35
+ for (const command of cliConfig.build.commands) {
36
+ yield command({ scConfig: cliConfig.config });
37
+ }
38
+ }
39
+ // Exit the process to avoid hanging the process by custom build commands
40
+ process.exit(0);
41
+ });
42
+ }