@sitecore-content-sdk/cli 0.1.0-beta.24 → 0.1.0-beta.26
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/bin/{scs.js → sitecore-tools.js} +2 -2
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/scripts/scaffold.js +2 -2
- package/dist/cjs/utils/load-config.js +10 -0
- package/dist/esm/cli.js +1 -1
- package/dist/esm/scripts/scaffold.js +2 -2
- package/dist/esm/utils/load-config.js +10 -0
- package/package.json +5 -5
- /package/types/bin/{scs.d.ts → sitecore-tools.d.ts} +0 -0
|
@@ -39,9 +39,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const resolve_1 = __importDefault(require("resolve"));
|
|
41
41
|
const process_env_1 = __importDefault(require("../utils/process-env"));
|
|
42
|
-
const commands = __importStar(require("
|
|
42
|
+
const commands = __importStar(require("../scripts"));
|
|
43
43
|
/**
|
|
44
|
-
* Resolves and executes the locally installed version of the sitecore
|
|
44
|
+
* Resolves and executes the locally installed version of the sitecore content sdk CLI (sitecore-tools).
|
|
45
45
|
*/
|
|
46
46
|
(0, resolve_1.default)('@sitecore-content-sdk/cli', { basedir: process.cwd() }, (error, projectLocalCli) => {
|
|
47
47
|
let cli;
|
package/dist/cjs/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ process.on('unhandledRejection', (err) => {
|
|
|
30
30
|
function cli(commands) {
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
let appCommands = yargs_1.default.usage('$0 <command>');
|
|
33
|
-
appCommands = appCommands.scriptName('
|
|
33
|
+
appCommands = appCommands.scriptName('sitecore-tools');
|
|
34
34
|
// Register commands if available
|
|
35
35
|
if (commands && Object.keys(commands).length > 0) {
|
|
36
36
|
for (const cmd of Object.keys(commands)) {
|
|
@@ -13,7 +13,7 @@ const config_1 = require("@sitecore-content-sdk/core/config");
|
|
|
13
13
|
* @param {Argv} yargs
|
|
14
14
|
*/
|
|
15
15
|
function builder(yargs) {
|
|
16
|
-
return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `
|
|
16
|
+
return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `sitecore-tools scaffold --help` for available options.', args, handler);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @param {Argv} yargs
|
|
@@ -51,7 +51,7 @@ dashes, or underscores. It can also contain slashes to indicate a subfolder. Exa
|
|
|
51
51
|
function handler(argv) {
|
|
52
52
|
var _a;
|
|
53
53
|
if (!argv.componentName) {
|
|
54
|
-
throw new Error('Component name is required. Usage:
|
|
54
|
+
throw new Error('Component name is required. Usage: sitecore-tools scaffold <ComponentName>');
|
|
55
55
|
}
|
|
56
56
|
const nameParamFormat = new RegExp(/^((?:[\w\-]+\/)*)([A-Z][\w-]+)$/);
|
|
57
57
|
const regExResult = nameParamFormat.exec(argv.componentName);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = loadCliConfig;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const process_env_1 = __importDefault(require("./process-env"));
|
|
9
10
|
const tsx = require('tsx/cjs/api');
|
|
10
11
|
/**
|
|
11
12
|
* Loads Sitecore Content SDK CLI configuration from the specified file.
|
|
@@ -21,6 +22,15 @@ function loadCliConfig(configFile) {
|
|
|
21
22
|
configFile = './sitecore.cli.config.js';
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
else {
|
|
26
|
+
// configuration file/filepath has been provided
|
|
27
|
+
// the env variables have been already loaded from the current working directory, however the current command may be running outside of a context of a project
|
|
28
|
+
// if so try loading the env vars from the directory of the provided config file
|
|
29
|
+
const configFileDirectory = path_1.default.dirname(path_1.default.resolve(process.cwd(), configFile));
|
|
30
|
+
if (process.cwd() !== configFileDirectory) {
|
|
31
|
+
(0, process_env_1.default)(configFileDirectory);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
24
34
|
let cliConfig;
|
|
25
35
|
try {
|
|
26
36
|
cliConfig = tsx.require(path_1.default.resolve(process.cwd(), configFile), __filename);
|
package/dist/esm/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ process.on('unhandledRejection', (err) => {
|
|
|
24
24
|
export default function cli(commands) {
|
|
25
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
26
|
let appCommands = yargs.usage('$0 <command>');
|
|
27
|
-
appCommands = appCommands.scriptName('
|
|
27
|
+
appCommands = appCommands.scriptName('sitecore-tools');
|
|
28
28
|
// Register commands if available
|
|
29
29
|
if (commands && Object.keys(commands).length > 0) {
|
|
30
30
|
for (const cmd of Object.keys(commands)) {
|
|
@@ -5,7 +5,7 @@ import { ComponentTemplateType } from '@sitecore-content-sdk/core/config';
|
|
|
5
5
|
* @param {Argv} yargs
|
|
6
6
|
*/
|
|
7
7
|
export function builder(yargs) {
|
|
8
|
-
return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `
|
|
8
|
+
return yargs.command('scaffold <componentName>', 'Scaffolds a new component. Use `sitecore-tools scaffold --help` for available options.', args, handler);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* @param {Argv} yargs
|
|
@@ -43,7 +43,7 @@ dashes, or underscores. It can also contain slashes to indicate a subfolder. Exa
|
|
|
43
43
|
export function handler(argv) {
|
|
44
44
|
var _a;
|
|
45
45
|
if (!argv.componentName) {
|
|
46
|
-
throw new Error('Component name is required. Usage:
|
|
46
|
+
throw new Error('Component name is required. Usage: sitecore-tools scaffold <ComponentName>');
|
|
47
47
|
}
|
|
48
48
|
const nameParamFormat = new RegExp(/^((?:[\w\-]+\/)*)([A-Z][\w-]+)$/);
|
|
49
49
|
const regExResult = nameParamFormat.exec(argv.componentName);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import processEnv from './process-env';
|
|
3
4
|
const tsx = require('tsx/cjs/api');
|
|
4
5
|
/**
|
|
5
6
|
* Loads Sitecore Content SDK CLI configuration from the specified file.
|
|
@@ -15,6 +16,15 @@ export default function loadCliConfig(configFile) {
|
|
|
15
16
|
configFile = './sitecore.cli.config.js';
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
else {
|
|
20
|
+
// configuration file/filepath has been provided
|
|
21
|
+
// the env variables have been already loaded from the current working directory, however the current command may be running outside of a context of a project
|
|
22
|
+
// if so try loading the env vars from the directory of the provided config file
|
|
23
|
+
const configFileDirectory = path.dirname(path.resolve(process.cwd(), configFile));
|
|
24
|
+
if (process.cwd() !== configFileDirectory) {
|
|
25
|
+
processEnv(configFileDirectory);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
let cliConfig;
|
|
19
29
|
try {
|
|
20
30
|
cliConfig = tsx.require(path.resolve(process.cwd(), configFile), __filename);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.26",
|
|
4
4
|
"description": "Sitecore JSS command-line",
|
|
5
5
|
"main": "dist/cjs/cli.js",
|
|
6
6
|
"module": "dist/esm/cli.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "npm run clean && tsc -p tsconfig.json && tsc -p tsconfig-esm.json",
|
|
14
14
|
"clean": "del-cli dist types",
|
|
15
15
|
"lint": "eslint \"./src/**/*.ts\"",
|
|
16
|
-
"
|
|
16
|
+
"sitecore-tools": "node ./dist/cjs/bin/sitecore-tools.js",
|
|
17
17
|
"test": "mocha --require ts-node/register/transpile-only \"./src/**/*.test.ts\"",
|
|
18
18
|
"coverage": "nyc --require ts-node/register/transpile-only npm test"
|
|
19
19
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"preferGlobal": true,
|
|
24
24
|
"bin": {
|
|
25
|
-
"
|
|
25
|
+
"sitecore-tools": "./dist/cjs/bin/sitecore-tools.js"
|
|
26
26
|
},
|
|
27
27
|
"author": {
|
|
28
28
|
"name": "Sitecore Corporation",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/sitecore/jss/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@sitecore-content-sdk/core": "0.1.0-beta.
|
|
37
|
+
"@sitecore-content-sdk/core": "0.1.0-beta.26",
|
|
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": "
|
|
64
|
+
"gitHead": "534f88bad88d588fc2be201ae29c1b065a539e8e",
|
|
65
65
|
"files": [
|
|
66
66
|
"dist",
|
|
67
67
|
"types"
|
|
File without changes
|