@sitecore-content-sdk/cli 1.3.0-canary.7 → 1.3.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.
- package/LICENSE.txt +202 -202
- package/README.md +5 -5
- package/dist/cjs/bin/sitecore-tools.js +77 -77
- package/dist/cjs/cli.js +69 -69
- package/dist/cjs/scripts/index.js +40 -40
- package/dist/cjs/scripts/project/build.js +42 -42
- package/dist/cjs/scripts/project/component/add.js +241 -236
- package/dist/cjs/scripts/project/component/generate-map.js +70 -68
- package/dist/cjs/scripts/project/component/index.js +57 -57
- package/dist/cjs/scripts/project/component/scaffold.js +69 -66
- package/dist/cjs/scripts/project/index.js +56 -56
- package/dist/cjs/utils/load-config.js +42 -42
- package/dist/cjs/utils/process-env.js +70 -70
- package/dist/cjs/utils/watch-items.js +18 -18
- package/dist/esm/cli.js +63 -63
- package/dist/esm/scripts/index.js +4 -4
- package/dist/esm/scripts/project/build.js +35 -35
- package/dist/esm/scripts/project/component/add.js +198 -193
- package/dist/esm/scripts/project/component/generate-map.js +62 -60
- package/dist/esm/scripts/project/component/index.js +21 -21
- package/dist/esm/scripts/project/component/scaffold.js +61 -58
- package/dist/esm/scripts/project/index.js +20 -20
- package/dist/esm/utils/load-config.js +36 -36
- package/dist/esm/utils/process-env.js +31 -31
- package/dist/esm/utils/watch-items.js +12 -12
- package/package.json +79 -79
- package/types/bin/sitecore-tools.d.ts +3 -2
- package/types/bin/sitecore-tools.d.ts.map +1 -0
- package/types/cli.d.ts +14 -13
- package/types/cli.d.ts.map +1 -0
- package/types/scripts/index.d.ts +3 -2
- package/types/scripts/index.d.ts.map +1 -0
- package/types/scripts/project/build.d.ts +25 -24
- package/types/scripts/project/build.d.ts.map +1 -0
- package/types/scripts/project/component/add.d.ts +59 -58
- package/types/scripts/project/component/add.d.ts.map +1 -0
- package/types/scripts/project/component/generate-map.d.ts +33 -32
- package/types/scripts/project/component/generate-map.d.ts.map +1 -0
- package/types/scripts/project/component/index.d.ts +6 -5
- package/types/scripts/project/component/index.d.ts.map +1 -0
- package/types/scripts/project/component/scaffold.d.ts +45 -44
- package/types/scripts/project/component/scaffold.d.ts.map +1 -0
- package/types/scripts/project/index.d.ts +6 -5
- package/types/scripts/project/index.d.ts.map +1 -0
- package/types/utils/load-config.d.ts +9 -8
- package/types/utils/load-config.d.ts.map +1 -0
- package/types/utils/process-env.d.ts +9 -8
- package/types/utils/process-env.d.ts.map +1 -0
- package/types/utils/watch-items.d.ts +7 -6
- package/types/utils/watch-items.d.ts.map +1 -0
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
|
+
}
|