@contentstack/cli-audit 1.5.2 → 1.5.3
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 +8 -8
- package/lib/modules/workflows.js +22 -17
- package/oclif.manifest.json +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-audit
|
|
|
19
19
|
$ csdx COMMAND
|
|
20
20
|
running command...
|
|
21
21
|
$ csdx (--version|-v)
|
|
22
|
-
@contentstack/cli-audit/1.5.
|
|
22
|
+
@contentstack/cli-audit/1.5.3 linux-x64 node-v18.20.1
|
|
23
23
|
$ csdx --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ csdx COMMAND
|
|
@@ -285,7 +285,7 @@ EXAMPLES
|
|
|
285
285
|
$ csdx plugins
|
|
286
286
|
```
|
|
287
287
|
|
|
288
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
288
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/index.ts)_
|
|
289
289
|
|
|
290
290
|
## `csdx plugins:add PLUGIN`
|
|
291
291
|
|
|
@@ -359,7 +359,7 @@ EXAMPLES
|
|
|
359
359
|
$ csdx plugins:inspect myplugin
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
362
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/inspect.ts)_
|
|
363
363
|
|
|
364
364
|
## `csdx plugins:install PLUGIN`
|
|
365
365
|
|
|
@@ -408,7 +408,7 @@ EXAMPLES
|
|
|
408
408
|
$ csdx plugins:install someuser/someplugin
|
|
409
409
|
```
|
|
410
410
|
|
|
411
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
411
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/install.ts)_
|
|
412
412
|
|
|
413
413
|
## `csdx plugins:link PATH`
|
|
414
414
|
|
|
@@ -438,7 +438,7 @@ EXAMPLES
|
|
|
438
438
|
$ csdx plugins:link myplugin
|
|
439
439
|
```
|
|
440
440
|
|
|
441
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
441
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/link.ts)_
|
|
442
442
|
|
|
443
443
|
## `csdx plugins:remove [PLUGIN]`
|
|
444
444
|
|
|
@@ -479,7 +479,7 @@ FLAGS
|
|
|
479
479
|
--reinstall Reinstall all plugins after uninstalling.
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
482
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/reset.ts)_
|
|
483
483
|
|
|
484
484
|
## `csdx plugins:uninstall [PLUGIN]`
|
|
485
485
|
|
|
@@ -507,7 +507,7 @@ EXAMPLES
|
|
|
507
507
|
$ csdx plugins:uninstall myplugin
|
|
508
508
|
```
|
|
509
509
|
|
|
510
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
510
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/uninstall.ts)_
|
|
511
511
|
|
|
512
512
|
## `csdx plugins:unlink [PLUGIN]`
|
|
513
513
|
|
|
@@ -551,5 +551,5 @@ DESCRIPTION
|
|
|
551
551
|
Update installed plugins.
|
|
552
552
|
```
|
|
553
553
|
|
|
554
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.
|
|
554
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.0.7/src/commands/plugins/update.ts)_
|
|
555
555
|
<!-- commandsstop -->
|
package/lib/modules/workflows.js
CHANGED
|
@@ -29,7 +29,7 @@ class Workflows {
|
|
|
29
29
|
* @returns Array of object containing the workflow name, uid and content_types that are missing
|
|
30
30
|
*/
|
|
31
31
|
async run() {
|
|
32
|
-
var _a;
|
|
32
|
+
var _a, _b, _c;
|
|
33
33
|
if (!(0, fs_1.existsSync)(this.folderPath)) {
|
|
34
34
|
this.log(`Skipping ${this.moduleName} audit`, 'warn');
|
|
35
35
|
this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
|
|
@@ -42,14 +42,17 @@ class Workflows {
|
|
|
42
42
|
this.ctSchema.forEach((ct) => this.ctUidSet.add(ct.uid));
|
|
43
43
|
for (const workflow of this.workflowSchema) {
|
|
44
44
|
const ctNotPresent = workflow.content_types.filter((ct) => !this.ctUidSet.has(ct));
|
|
45
|
-
|
|
46
|
-
if (
|
|
45
|
+
let branchesToBeRemoved = [];
|
|
46
|
+
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.branch) {
|
|
47
|
+
branchesToBeRemoved = ((_b = workflow === null || workflow === void 0 ? void 0 : workflow.branches) === null || _b === void 0 ? void 0 : _b.filter((branch) => { var _a; return branch !== ((_a = this.config) === null || _a === void 0 ? void 0 : _a.branch); })) || [];
|
|
48
|
+
}
|
|
49
|
+
if (ctNotPresent.length || (branchesToBeRemoved === null || branchesToBeRemoved === void 0 ? void 0 : branchesToBeRemoved.length)) {
|
|
47
50
|
const tempwf = (0, lodash_1.cloneDeep)(workflow);
|
|
48
51
|
tempwf.content_types = ctNotPresent || [];
|
|
49
|
-
if (workflow === null || workflow === void 0 ? void 0 : workflow.branches) {
|
|
50
|
-
tempwf.branches =
|
|
52
|
+
if ((workflow === null || workflow === void 0 ? void 0 : workflow.branches) && ((_c = this.config) === null || _c === void 0 ? void 0 : _c.branch)) {
|
|
53
|
+
tempwf.branches = branchesToBeRemoved;
|
|
51
54
|
}
|
|
52
|
-
if (
|
|
55
|
+
if (branchesToBeRemoved === null || branchesToBeRemoved === void 0 ? void 0 : branchesToBeRemoved.length) {
|
|
53
56
|
this.isBranchFixDone = true;
|
|
54
57
|
}
|
|
55
58
|
ctNotPresent.forEach((ct) => this.missingCts.add(ct));
|
|
@@ -75,18 +78,20 @@ class Workflows {
|
|
|
75
78
|
for (const workflow of this.workflowSchema) {
|
|
76
79
|
const fixedCts = workflow.content_types.filter((ct) => !this.missingCts.has(ct));
|
|
77
80
|
const fixedBranches = [];
|
|
78
|
-
(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
if (this.config.branch) {
|
|
82
|
+
(_a = workflow === null || workflow === void 0 ? void 0 : workflow.branches) === null || _a === void 0 ? void 0 : _a.forEach((branch) => {
|
|
83
|
+
var _a;
|
|
84
|
+
if (branch !== ((_a = this.config) === null || _a === void 0 ? void 0 : _a.branch)) {
|
|
85
|
+
const { uid, name } = workflow;
|
|
86
|
+
this.log((0, messages_1.$t)(messages_1.commonMsg.WF_BRANCH_REMOVAL, { uid, name, branch }), { color: 'yellow' });
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
fixedBranches.push(branch);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
if (fixedBranches.length > 0) {
|
|
93
|
+
newWorkflowSchema[workflow.uid].branches = fixedBranches;
|
|
86
94
|
}
|
|
87
|
-
});
|
|
88
|
-
if (fixedBranches.length > 0) {
|
|
89
|
-
newWorkflowSchema[workflow.uid].branches = fixedBranches;
|
|
90
95
|
}
|
|
91
96
|
if (fixedCts.length) {
|
|
92
97
|
newWorkflowSchema[workflow.uid].content_types = fixedCts;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.3",
|
|
3
3
|
"commands": {
|
|
4
4
|
"cm:stacks:audit:fix": {
|
|
5
5
|
"id": "cm:stacks:audit:fix",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"audit:fix",
|
|
13
13
|
"cm:stacks:audit:fix"
|
|
14
14
|
],
|
|
15
|
+
"hiddenAliases": [],
|
|
15
16
|
"examples": [
|
|
16
17
|
"$ <%= config.bin %> <%= command.id %> --copy-dir",
|
|
17
18
|
"$ <%= config.bin %> <%= command.id %> --report-path=<path> --copy-dir",
|
|
@@ -166,6 +167,7 @@
|
|
|
166
167
|
"audit",
|
|
167
168
|
"cm:stacks:audit"
|
|
168
169
|
],
|
|
170
|
+
"hiddenAliases": [],
|
|
169
171
|
"examples": [
|
|
170
172
|
"$ <%= config.bin %> <%= command.id %>",
|
|
171
173
|
"$ <%= config.bin %> <%= command.id %> --report-path=<path>",
|