@sitecore-content-sdk/cli 0.2.0-canary.9 → 1.0.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.
package/dist/cjs/cli.js CHANGED
@@ -48,18 +48,22 @@ function cli(commands) {
48
48
  }
49
49
  }
50
50
  }
51
- appCommands.command({
51
+ appCommands
52
+ .command({
52
53
  command: '*',
53
54
  handler: (argv) => {
54
55
  if (argv._.length > 0) {
55
- console.error(`Command not found: "${argv._[0]}". Use --help to see available commands.`);
56
+ console.error(`Command not found: "${argv._[0]}"`);
56
57
  }
57
58
  else {
58
- console.error('No command provided. Use --help to see available commands.');
59
+ console.error('No command provided');
59
60
  }
61
+ yargs_1.default.showHelp();
60
62
  process.exit(1);
61
63
  },
62
- });
64
+ })
65
+ .demandCommand(1, 'You need to specify a command to run')
66
+ .strict();
63
67
  yield appCommands.argv;
64
68
  });
65
69
  }
@@ -35,8 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  };
36
36
  })();
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.scaffold = exports.build = void 0;
39
- const build = __importStar(require("./build"));
40
- exports.build = build;
41
- const scaffold = __importStar(require("./scaffold"));
42
- exports.scaffold = scaffold;
38
+ exports.project = void 0;
39
+ const project = __importStar(require("./project"));
40
+ exports.project = project;
@@ -14,9 +14,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.builder = exports.describe = exports.command = void 0;
16
16
  exports.handler = handler;
17
- const load_config_1 = __importDefault(require("../utils/load-config"));
17
+ const load_config_1 = __importDefault(require("../../utils/load-config"));
18
18
  exports.command = 'build';
19
- exports.describe = 'Handles build time automation';
19
+ exports.describe = 'Performs build time automation';
20
20
  exports.builder = {
21
21
  config: {
22
22
  requiresArg: false,
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.builder = builder;
37
+ const scaffold = __importStar(require("./scaffold"));
38
+ /**
39
+ * @param {Argv} yargs
40
+ */
41
+ function builder(yargs) {
42
+ return yargs.command({
43
+ command: 'component',
44
+ describe: 'Performs component level operations',
45
+ builder: (_yargs) => {
46
+ _yargs = _yargs
47
+ .command([scaffold])
48
+ .strict()
49
+ .demandCommand(1, 'You need to specify a command to run');
50
+ _yargs = scaffold.builder(_yargs);
51
+ return _yargs;
52
+ },
53
+ handler: () => { },
54
+ });
55
+ }
@@ -7,13 +7,13 @@ exports.builder = builder;
7
7
  exports.args = args;
8
8
  exports.handler = handler;
9
9
  const tools_1 = require("@sitecore-content-sdk/core/tools");
10
- const load_config_1 = __importDefault(require("../utils/load-config"));
10
+ const load_config_1 = __importDefault(require("../../../utils/load-config"));
11
11
  const config_1 = require("@sitecore-content-sdk/core/config");
12
12
  /**
13
13
  * @param {Argv} yargs
14
14
  */
15
15
  function builder(yargs) {
16
- return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `sitecore-tools scaffold --help` for available options.', args, handler);
16
+ return yargs.command('scaffold <componentName>', 'Scaffolds a new component', args, handler);
17
17
  }
18
18
  /**
19
19
  * @param {Argv} yargs
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.builder = builder;
37
+ const build = __importStar(require("./build"));
38
+ const component = __importStar(require("./component"));
39
+ /**
40
+ * @param {Argv} yargs
41
+ */
42
+ function builder(yargs) {
43
+ return yargs.command({
44
+ command: 'project',
45
+ describe: 'Performs project level operations',
46
+ builder: (_yargs) => {
47
+ _yargs = _yargs
48
+ .command([build, component])
49
+ .strict()
50
+ .demandCommand(1, 'You need to specify a command to run');
51
+ _yargs = component.builder(_yargs);
52
+ return _yargs;
53
+ },
54
+ handler: () => { },
55
+ });
56
+ }
package/dist/esm/cli.js CHANGED
@@ -42,18 +42,22 @@ export default function cli(commands) {
42
42
  }
43
43
  }
44
44
  }
45
- appCommands.command({
45
+ appCommands
46
+ .command({
46
47
  command: '*',
47
48
  handler: (argv) => {
48
49
  if (argv._.length > 0) {
49
- console.error(`Command not found: "${argv._[0]}". Use --help to see available commands.`);
50
+ console.error(`Command not found: "${argv._[0]}"`);
50
51
  }
51
52
  else {
52
- console.error('No command provided. Use --help to see available commands.');
53
+ console.error('No command provided');
53
54
  }
55
+ yargs.showHelp();
54
56
  process.exit(1);
55
57
  },
56
- });
58
+ })
59
+ .demandCommand(1, 'You need to specify a command to run')
60
+ .strict();
57
61
  yield appCommands.argv;
58
62
  });
59
63
  }
@@ -1,5 +1,4 @@
1
1
  // commands available when running from an app location (with CLI installed to local node_modules)
2
2
  // e.g. setup, deploy
3
- import * as build from './build';
4
- import * as scaffold from './scaffold';
5
- export { build, scaffold };
3
+ import * as project from './project';
4
+ export { project };
@@ -7,9 +7,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import loadCliConfig from '../utils/load-config';
10
+ import loadCliConfig from '../../utils/load-config';
11
11
  export const command = 'build';
12
- export const describe = 'Handles build time automation';
12
+ export const describe = 'Performs build time automation';
13
13
  export const builder = {
14
14
  config: {
15
15
  requiresArg: false,
@@ -0,0 +1,19 @@
1
+ import * as scaffold from './scaffold';
2
+ /**
3
+ * @param {Argv} yargs
4
+ */
5
+ export function builder(yargs) {
6
+ return yargs.command({
7
+ command: 'component',
8
+ describe: 'Performs component level operations',
9
+ builder: (_yargs) => {
10
+ _yargs = _yargs
11
+ .command([scaffold])
12
+ .strict()
13
+ .demandCommand(1, 'You need to specify a command to run');
14
+ _yargs = scaffold.builder(_yargs);
15
+ return _yargs;
16
+ },
17
+ handler: () => { },
18
+ });
19
+ }
@@ -1,11 +1,11 @@
1
1
  import { scaffoldComponent } from '@sitecore-content-sdk/core/tools';
2
- import loadCliConfig from '../utils/load-config';
2
+ import loadCliConfig from '../../../utils/load-config';
3
3
  import { ComponentTemplateType } from '@sitecore-content-sdk/core/config';
4
4
  /**
5
5
  * @param {Argv} yargs
6
6
  */
7
7
  export function builder(yargs) {
8
- return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `sitecore-tools scaffold --help` for available options.', args, handler);
8
+ return yargs.command('scaffold <componentName>', 'Scaffolds a new component', args, handler);
9
9
  }
10
10
  /**
11
11
  * @param {Argv} yargs
@@ -0,0 +1,20 @@
1
+ import * as build from './build';
2
+ import * as component from './component';
3
+ /**
4
+ * @param {Argv} yargs
5
+ */
6
+ export function builder(yargs) {
7
+ return yargs.command({
8
+ command: 'project',
9
+ describe: 'Performs project level operations',
10
+ builder: (_yargs) => {
11
+ _yargs = _yargs
12
+ .command([build, component])
13
+ .strict()
14
+ .demandCommand(1, 'You need to specify a command to run');
15
+ _yargs = component.builder(_yargs);
16
+ return _yargs;
17
+ },
18
+ handler: () => { },
19
+ });
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitecore-content-sdk/cli",
3
- "version": "0.2.0-canary.9",
3
+ "version": "1.0.0-canary.1",
4
4
  "description": "Sitecore Content SDK CLI",
5
5
  "main": "dist/cjs/cli.js",
6
6
  "module": "dist/esm/cli.js",
@@ -34,34 +34,33 @@
34
34
  "url": "https://github.com/sitecore/content-sdk/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@sitecore-content-sdk/core": "0.2.0-canary.9",
38
- "dotenv": "^16.4.7",
39
- "dotenv-expand": "^12.0.1",
37
+ "@sitecore-content-sdk/core": "1.0.0-canary.1",
38
+ "dotenv": "^16.5.0",
39
+ "dotenv-expand": "^12.0.2",
40
40
  "resolve": "^1.22.10",
41
41
  "tmp": "^0.2.3",
42
- "tsx": "^4.19.3",
42
+ "tsx": "^4.19.4",
43
43
  "yargs": "^17.7.2"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/chai": "^4.2.4",
46
+ "@types/chai": "^5.2.2",
47
47
  "@types/mocha": "^10.0.10",
48
- "@types/node": "^22.13.0",
48
+ "@types/node": "^22.15.13",
49
49
  "@types/resolve": "^1.20.6",
50
- "@types/sinon": "^10.0.13",
50
+ "@types/sinon": "^17.0.4",
51
51
  "@types/tmp": "^0.2.6",
52
52
  "@types/yargs": "^17.0.33",
53
- "chai": "^4.3.7",
54
- "cross-env": "^7.0.3",
55
- "del-cli": "^5.0.0",
53
+ "chai": "^4.4.1",
54
+ "del-cli": "^6.0.0",
56
55
  "eslint": "^8.56.0",
57
- "mocha": "^11.1.0",
56
+ "mocha": "^11.2.2",
58
57
  "nyc": "^17.1.0",
59
58
  "proxyquire": "^2.1.3",
60
- "sinon": "^19.0.2",
59
+ "sinon": "^20.0.0",
61
60
  "ts-node": "^10.9.1",
62
- "typescript": "~5.7.3"
61
+ "typescript": "~5.8.3"
63
62
  },
64
- "gitHead": "3252b3ee59727ca40e34a5c0c131d47e5416beb0",
63
+ "gitHead": "5344d67a03260a187e0db155ff8316a4118569f3",
65
64
  "files": [
66
65
  "dist",
67
66
  "types"
@@ -1,3 +1,2 @@
1
- import * as build from './build';
2
- import * as scaffold from './scaffold';
3
- export { build, scaffold };
1
+ import * as project from './project';
2
+ export { project };
@@ -1,5 +1,5 @@
1
1
  export declare const command = "build";
2
- export declare const describe = "Handles build time automation";
2
+ export declare const describe = "Performs build time automation";
3
3
  export declare const builder: {
4
4
  config: {
5
5
  requiresArg: boolean;
@@ -0,0 +1,5 @@
1
+ import { Argv } from 'yargs';
2
+ /**
3
+ * @param {Argv} yargs
4
+ */
5
+ export declare function builder(yargs: Argv): Argv<{}>;
@@ -0,0 +1,5 @@
1
+ import { Argv } from 'yargs';
2
+ /**
3
+ * @param {Argv} yargs
4
+ */
5
+ export declare function builder(yargs: Argv): Argv<{}>;