@sitecore-content-sdk/cli 0.2.0-canary.3 → 0.2.0-canary.30
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/sitecore-tools.js +6 -4
- package/dist/cjs/cli.js +8 -4
- package/dist/cjs/scripts/index.js +3 -5
- package/dist/cjs/scripts/{build.js → project/build.js} +2 -2
- package/dist/cjs/scripts/project/component/index.js +55 -0
- package/dist/cjs/scripts/{scaffold.js → project/component/scaffold.js} +2 -2
- package/dist/cjs/scripts/project/index.js +56 -0
- package/dist/esm/cli.js +8 -4
- package/dist/esm/scripts/index.js +2 -3
- package/dist/esm/scripts/{build.js → project/build.js} +2 -2
- package/dist/esm/scripts/project/component/index.js +19 -0
- package/dist/esm/scripts/{scaffold.js → project/component/scaffold.js} +2 -2
- package/dist/esm/scripts/project/index.js +20 -0
- package/package.json +14 -15
- package/types/scripts/index.d.ts +2 -3
- package/types/scripts/{build.d.ts → project/build.d.ts} +1 -1
- package/types/scripts/project/component/index.d.ts +5 -0
- package/types/scripts/project/index.d.ts +5 -0
- /package/types/scripts/{scaffold.d.ts → project/component/scaffold.d.ts} +0 -0
|
@@ -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
|
|
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
|
|
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
|
|
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]}"
|
|
56
|
+
console.error(`Command not found: "${argv._[0]}"`);
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
|
-
console.error('No command provided
|
|
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.
|
|
39
|
-
const
|
|
40
|
-
exports.
|
|
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("
|
|
17
|
+
const load_config_1 = __importDefault(require("../../utils/load-config"));
|
|
18
18
|
exports.command = 'build';
|
|
19
|
-
exports.describe = '
|
|
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("
|
|
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
|
|
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
|
|
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]}"
|
|
50
|
+
console.error(`Command not found: "${argv._[0]}"`);
|
|
50
51
|
}
|
|
51
52
|
else {
|
|
52
|
-
console.error('No command provided
|
|
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
|
|
4
|
-
|
|
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 '
|
|
10
|
+
import loadCliConfig from '../../utils/load-config';
|
|
11
11
|
export const command = 'build';
|
|
12
|
-
export const describe = '
|
|
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 '
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.2.0-canary.30",
|
|
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.
|
|
38
|
-
"dotenv": "^16.
|
|
39
|
-
"dotenv-expand": "^12.0.
|
|
37
|
+
"@sitecore-content-sdk/core": "0.2.0-canary.30",
|
|
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.
|
|
42
|
+
"tsx": "^4.19.4",
|
|
43
43
|
"yargs": "^17.7.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/chai": "^
|
|
46
|
+
"@types/chai": "^5.2.2",
|
|
47
47
|
"@types/mocha": "^10.0.10",
|
|
48
|
-
"@types/node": "^22.13
|
|
48
|
+
"@types/node": "^22.15.13",
|
|
49
49
|
"@types/resolve": "^1.20.6",
|
|
50
|
-
"@types/sinon": "^
|
|
50
|
+
"@types/sinon": "^17.0.4",
|
|
51
51
|
"@types/tmp": "^0.2.6",
|
|
52
52
|
"@types/yargs": "^17.0.33",
|
|
53
|
-
"chai": "^4.
|
|
54
|
-
"
|
|
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.
|
|
56
|
+
"mocha": "^11.2.2",
|
|
58
57
|
"nyc": "^17.1.0",
|
|
59
58
|
"proxyquire": "^2.1.3",
|
|
60
|
-
"sinon": "^
|
|
59
|
+
"sinon": "^20.0.0",
|
|
61
60
|
"ts-node": "^10.9.1",
|
|
62
|
-
"typescript": "~5.
|
|
61
|
+
"typescript": "~5.8.3"
|
|
63
62
|
},
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "e13108ffd37e83ce84c60597c9c4dd699033a600",
|
|
65
64
|
"files": [
|
|
66
65
|
"dist",
|
|
67
66
|
"types"
|
package/types/scripts/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
export { build, scaffold };
|
|
1
|
+
import * as project from './project';
|
|
2
|
+
export { project };
|
|
File without changes
|