@squiz/dxp-cli-next 3.3.3-develop.1 → 4.0.0-develop.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/lib/__tests__/helpers.js
CHANGED
|
@@ -18,7 +18,8 @@ function runCLI(dir, args, options = {
|
|
|
18
18
|
}
|
|
19
19
|
exports.runCLI = runCLI;
|
|
20
20
|
const spawnScript = (execPath, args, options) => {
|
|
21
|
-
const
|
|
21
|
+
const execArgs = getExecaOptions(options);
|
|
22
|
+
const result = execa_1.default.sync(execPath, args, execArgs);
|
|
22
23
|
handleTestFailure(execPath, options, result, args);
|
|
23
24
|
return result;
|
|
24
25
|
};
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const helpers_1 = require("../helpers");
|
|
4
4
|
describe('dxp', () => {
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
process.env.FEATURE_TD_ACTIVE = 'true';
|
|
7
|
+
});
|
|
8
|
+
afterAll(() => {
|
|
9
|
+
process.env.FEATURE_TD_ACTIVE = undefined;
|
|
10
|
+
});
|
|
5
11
|
it('should display the help contents', () => {
|
|
6
12
|
const { stdout } = (0, helpers_1.runCLI)(process.cwd(), ['--help']);
|
|
7
13
|
expect(stdout).toContain('Usage: dxp [options] [command]');
|
|
@@ -17,4 +23,15 @@ describe('dxp', () => {
|
|
|
17
23
|
'cmp Component Service Commands',
|
|
18
24
|
]);
|
|
19
25
|
});
|
|
26
|
+
it('if FEATURE_TD_ACTIVE not set to true, td command should not be visible', () => {
|
|
27
|
+
var _a;
|
|
28
|
+
process.env.FEATURE_TD_ACTIVE = undefined;
|
|
29
|
+
const { stdout } = (0, helpers_1.runCLI)(process.cwd(), ['--help']);
|
|
30
|
+
const commandsText = (_a = stdout
|
|
31
|
+
.match(/Commands\:(.*)/is)) === null || _a === void 0 ? void 0 : _a[1].split('\n').map(a => a.trim()).filter(a => !!a);
|
|
32
|
+
expect(commandsText).toEqual([
|
|
33
|
+
'auth log into the sxc',
|
|
34
|
+
'cmp Component Service Commands',
|
|
35
|
+
]);
|
|
36
|
+
});
|
|
20
37
|
});
|
package/lib/dxp.js
CHANGED
|
@@ -21,8 +21,11 @@ program
|
|
|
21
21
|
.name('dxp')
|
|
22
22
|
.version(version)
|
|
23
23
|
.description('dxp commands')
|
|
24
|
-
.addCommand(auth_1.default)
|
|
25
|
-
|
|
24
|
+
.addCommand(auth_1.default);
|
|
25
|
+
if (process.env.FEATURE_TD_ACTIVE === 'true') {
|
|
26
|
+
program.addCommand(td_1.default);
|
|
27
|
+
}
|
|
28
|
+
program
|
|
26
29
|
.addCommand(cmp_1.default)
|
|
27
30
|
.action(() => {
|
|
28
31
|
program.help();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squiz/dxp-cli-next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-develop.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://gitlab.squiz.net/developer-experience/dxp-cli-next"
|
|
6
6
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"bin/**/*"
|
|
11
11
|
],
|
|
12
12
|
"bin": {
|
|
13
|
-
"dxp": "./bin/dxp.js"
|
|
13
|
+
"dxp-next": "./bin/dxp.js"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc",
|