@sitecore-content-sdk/cli 0.2.0-canary.2 → 0.2.0-canary.22

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Sitecore Content SDK CLI Tools
1
+ # Sitecore Content SDK CLI
2
2
 
3
3
  This module is provided as a part of Sitecore Contents SDK. It contains the Sitecore Content SDK command line interface.
4
4
 
@@ -50,16 +50,18 @@ const commands = __importStar(require("../scripts"));
50
50
  // library from a package.json. Instead, include it from a relative
51
51
  // path to this script file (which is likely a globally installed
52
52
  // npm package).
53
- // Not erroring here because we might use this in future for scaffolding.
53
+ // Not erroring here because cli can be used in global mode.
54
54
  cli = require('../cli').default;
55
55
  console.warn('Sitecore Content SDK CLI is running in global mode because it was not installed in the local node_modules folder.');
56
56
  }
57
57
  else {
58
58
  // No error implies a projectLocalCli, which will load whatever
59
- // version of jss-cli you have installed in a local package.json
59
+ // version of content sdk cli you have installed in a local package.json
60
60
  cli = require(projectLocalCli).default;
61
- // Since we are in context of a project, load its environment variables
62
- (0, process_env_1.default)(process.cwd());
63
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());
64
66
  cli(commands);
65
67
  });
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.2",
3
+ "version": "0.2.0-canary.22",
4
4
  "description": "Sitecore Content SDK CLI",
5
5
  "main": "dist/cjs/cli.js",
6
6
  "module": "dist/esm/cli.js",
@@ -34,7 +34,7 @@
34
34
  "url": "https://github.com/sitecore/content-sdk/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@sitecore-content-sdk/core": "0.2.0-canary.2",
37
+ "@sitecore-content-sdk/core": "0.2.0-canary.22",
38
38
  "dotenv": "^16.4.7",
39
39
  "dotenv-expand": "^12.0.1",
40
40
  "resolve": "^1.22.10",
@@ -61,7 +61,7 @@
61
61
  "ts-node": "^10.9.1",
62
62
  "typescript": "~5.7.3"
63
63
  },
64
- "gitHead": "38793084d3c2e0099cf7fde68369ccf744f418e6",
64
+ "gitHead": "c8e795b396852c63fb6da0bdf5d14370faa24fa3",
65
65
  "files": [
66
66
  "dist",
67
67
  "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<{}>;