@contentstack/cli-audit 1.7.3 → 1.7.4
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/audit-base-command.js +6 -0
- package/lib/modules/entries.js +20 -2
- package/lib/types/content-types.d.ts +3 -1
- package/lib/types/content-types.js +2 -0
- package/lib/util/log.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +7 -7
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.7.
|
|
22
|
+
@contentstack/cli-audit/1.7.4 linux-x64 node-v18.20.5
|
|
23
23
|
$ csdx --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ csdx COMMAND
|
|
@@ -269,7 +269,7 @@ EXAMPLES
|
|
|
269
269
|
$ csdx plugins
|
|
270
270
|
```
|
|
271
271
|
|
|
272
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
272
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/index.ts)_
|
|
273
273
|
|
|
274
274
|
## `csdx plugins:add PLUGIN`
|
|
275
275
|
|
|
@@ -343,7 +343,7 @@ EXAMPLES
|
|
|
343
343
|
$ csdx plugins:inspect myplugin
|
|
344
344
|
```
|
|
345
345
|
|
|
346
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
346
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/inspect.ts)_
|
|
347
347
|
|
|
348
348
|
## `csdx plugins:install PLUGIN`
|
|
349
349
|
|
|
@@ -392,7 +392,7 @@ EXAMPLES
|
|
|
392
392
|
$ csdx plugins:install someuser/someplugin
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
395
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/install.ts)_
|
|
396
396
|
|
|
397
397
|
## `csdx plugins:link PATH`
|
|
398
398
|
|
|
@@ -423,7 +423,7 @@ EXAMPLES
|
|
|
423
423
|
$ csdx plugins:link myplugin
|
|
424
424
|
```
|
|
425
425
|
|
|
426
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
426
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/link.ts)_
|
|
427
427
|
|
|
428
428
|
## `csdx plugins:remove [PLUGIN]`
|
|
429
429
|
|
|
@@ -464,7 +464,7 @@ FLAGS
|
|
|
464
464
|
--reinstall Reinstall all plugins after uninstalling.
|
|
465
465
|
```
|
|
466
466
|
|
|
467
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
467
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/reset.ts)_
|
|
468
468
|
|
|
469
469
|
## `csdx plugins:uninstall [PLUGIN]`
|
|
470
470
|
|
|
@@ -492,7 +492,7 @@ EXAMPLES
|
|
|
492
492
|
$ csdx plugins:uninstall myplugin
|
|
493
493
|
```
|
|
494
494
|
|
|
495
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
495
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/uninstall.ts)_
|
|
496
496
|
|
|
497
497
|
## `csdx plugins:unlink [PLUGIN]`
|
|
498
498
|
|
|
@@ -536,5 +536,5 @@ DESCRIPTION
|
|
|
536
536
|
Update installed plugins.
|
|
537
537
|
```
|
|
538
538
|
|
|
539
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.
|
|
539
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.22/src/commands/plugins/update.ts)_
|
|
540
540
|
<!-- commandsstop -->
|
|
@@ -250,6 +250,12 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
250
250
|
cli_utilities_1.ux.table(tableValues, Object.assign(Object.assign({ name: {
|
|
251
251
|
minWidth: 7,
|
|
252
252
|
header: 'Title',
|
|
253
|
+
}, ct: {
|
|
254
|
+
minWidth: 7,
|
|
255
|
+
header: "Content Type"
|
|
256
|
+
}, locale: {
|
|
257
|
+
minWidth: 7,
|
|
258
|
+
header: "Locale"
|
|
253
259
|
}, display_name: {
|
|
254
260
|
minWidth: 7,
|
|
255
261
|
header: 'Field name',
|
package/lib/modules/entries.js
CHANGED
|
@@ -42,7 +42,7 @@ class Entries {
|
|
|
42
42
|
* @returns the `missingRefs` object.
|
|
43
43
|
*/
|
|
44
44
|
async run() {
|
|
45
|
-
var _a;
|
|
45
|
+
var _a, _b, _c, _d;
|
|
46
46
|
if (!(0, fs_1.existsSync)(this.folderPath)) {
|
|
47
47
|
this.log(`Skipping ${this.moduleName} audit`, 'warn');
|
|
48
48
|
this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
|
|
@@ -76,8 +76,26 @@ class Entries {
|
|
|
76
76
|
this.removeMissingKeysOnEntry(ctSchema.schema, this.entries[entryUid]);
|
|
77
77
|
}
|
|
78
78
|
this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
|
|
79
|
+
if ((_a = this.missingRefs[this.currentUid]) === null || _a === void 0 ? void 0 : _a.length) {
|
|
80
|
+
this.missingRefs[this.currentUid].forEach((entry) => {
|
|
81
|
+
entry.ct = ctSchema.uid;
|
|
82
|
+
entry.locale = code;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if ((_b = this.missingSelectFeild[this.currentUid]) === null || _b === void 0 ? void 0 : _b.length) {
|
|
86
|
+
this.missingSelectFeild[this.currentUid].forEach((entry) => {
|
|
87
|
+
entry.ct = ctSchema.uid;
|
|
88
|
+
entry.locale = code;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if ((_c = this.missingMandatoryFields[this.currentUid]) === null || _c === void 0 ? void 0 : _c.length) {
|
|
92
|
+
this.missingMandatoryFields[this.currentUid].forEach((entry) => {
|
|
93
|
+
entry.ct = ctSchema.uid;
|
|
94
|
+
entry.locale = code;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
79
97
|
const fields = this.missingMandatoryFields[uid];
|
|
80
|
-
const isPublished = ((
|
|
98
|
+
const isPublished = ((_d = entry.publish_details) === null || _d === void 0 ? void 0 : _d.length) > 0;
|
|
81
99
|
if ((this.fix && fields.length && isPublished) || (!this.fix && fields)) {
|
|
82
100
|
const fixStatus = this.fix ? 'Fixed' : '';
|
|
83
101
|
fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
|
|
@@ -103,6 +103,8 @@ declare enum OutputColumn {
|
|
|
103
103
|
'isPublished' = "isPublished",
|
|
104
104
|
'Entry UID' = "Entry UID",
|
|
105
105
|
'Content Type UID' = "Content Type UID",
|
|
106
|
-
"Locale" = "Locale"
|
|
106
|
+
"Locale" = "Locale",
|
|
107
|
+
"Content Type" = "ct",
|
|
108
|
+
"locale" = "locale"
|
|
107
109
|
}
|
|
108
110
|
export { CtConstructorParam, ContentTypeStruct, ModuleConstructorParam, ReferenceFieldDataType, GlobalFieldDataType, ExtensionOrAppFieldDataType, JsonRTEFieldDataType, GroupFieldDataType, ModularBlocksDataType, RefErrorReturnType, ModularBlocksSchemaTypes, ModularBlockType, OutputColumn, ContentTypeSchemaType, GlobalFieldSchemaTypes, WorkflowExtensionsRefErrorReturnType, SelectFeildStruct, };
|
|
@@ -20,5 +20,7 @@ var OutputColumn;
|
|
|
20
20
|
OutputColumn["Entry UID"] = "Entry UID";
|
|
21
21
|
OutputColumn["Content Type UID"] = "Content Type UID";
|
|
22
22
|
OutputColumn["Locale"] = "Locale";
|
|
23
|
+
OutputColumn["Content Type"] = "ct";
|
|
24
|
+
OutputColumn["locale"] = "locale";
|
|
23
25
|
})(OutputColumn || (OutputColumn = {}));
|
|
24
26
|
exports.OutputColumn = OutputColumn;
|
package/lib/util/log.js
CHANGED
|
@@ -54,7 +54,7 @@ class Logger {
|
|
|
54
54
|
if (logType === 'error') {
|
|
55
55
|
consoleOptions.level = logType;
|
|
56
56
|
}
|
|
57
|
-
const filename = (0, path_1.normalize)((0, path_1.resolve)(this.config.basePath, 'logs', `${logType}.log`)).replace(/^(\.\.(\/|\\|$))+/, '');
|
|
57
|
+
const filename = (0, path_1.normalize)((0, path_1.resolve)(this.config.basePath, 'Audit logs', `${logType}.log`)).replace(/^(\.\.(\/|\\|$))+/, '');
|
|
58
58
|
const transports = [
|
|
59
59
|
new winston_1.default.transports.File(Object.assign(Object.assign({}, this.loggerOptions), { level: logType, filename })),
|
|
60
60
|
];
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-audit",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "Contentstack audit plugin",
|
|
5
5
|
"author": "Contentstack CLI",
|
|
6
6
|
"homepage": "https://github.com/contentstack/cli",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@contentstack/cli-command": "~1.3.2",
|
|
22
22
|
"@contentstack/cli-utilities": "~1.8.0",
|
|
23
23
|
"@oclif/plugin-help": "^5.2.20",
|
|
24
|
-
"@oclif/plugin-plugins": "^5.4.
|
|
24
|
+
"@oclif/plugin-plugins": "^5.4.22",
|
|
25
25
|
"chalk": "^4.1.2",
|
|
26
26
|
"fast-csv": "^4.3.6",
|
|
27
27
|
"fs-extra": "^11.2.0",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@contentstack/cli-dev-dependencies": "^1.2.4",
|
|
34
|
-
"@oclif/test": "^4.1.
|
|
34
|
+
"@oclif/test": "^4.1.4",
|
|
35
35
|
"@types/chai": "^4.3.20",
|
|
36
36
|
"@types/fs-extra": "^11.0.4",
|
|
37
|
-
"@types/mocha": "^10.0.
|
|
38
|
-
"@types/node": "^20.17.
|
|
37
|
+
"@types/mocha": "^10.0.10",
|
|
38
|
+
"@types/node": "^20.17.10",
|
|
39
39
|
"@types/uuid": "^9.0.8",
|
|
40
40
|
"chai": "^4.5.0",
|
|
41
41
|
"eslint": "^8.57.1",
|
|
42
42
|
"eslint-config-oclif": "^4.0.0",
|
|
43
|
-
"eslint-config-oclif-typescript": "^3.1.
|
|
43
|
+
"eslint-config-oclif-typescript": "^3.1.13",
|
|
44
44
|
"mocha": "^10.8.2",
|
|
45
45
|
"nyc": "^15.1.0",
|
|
46
46
|
"oclif": "^3.17.2",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"ts-jest": "^29.2.5",
|
|
50
50
|
"ts-node": "^10.9.2",
|
|
51
51
|
"tslib": "^2.8.1",
|
|
52
|
-
"typescript": "^5.
|
|
52
|
+
"typescript": "^5.7.2"
|
|
53
53
|
},
|
|
54
54
|
"oclif": {
|
|
55
55
|
"bin": "csdx",
|