@contentstack/cli-audit 1.6.1 → 1.6.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 +10 -10
- package/lib/audit-base-command.js +43 -36
- package/lib/messages/index.js +8 -3
- package/lib/modules/content-types.d.ts +1 -0
- package/lib/modules/content-types.js +8 -2
- package/lib/modules/entries.d.ts +1 -1
- package/lib/modules/entries.js +11 -10
- package/lib/modules/extensions.d.ts +1 -0
- package/lib/modules/extensions.js +11 -4
- package/lib/modules/workflows.d.ts +1 -0
- package/lib/modules/workflows.js +8 -2
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
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.6.
|
|
22
|
+
@contentstack/cli-audit/1.6.3 linux-x64 node-v18.20.3
|
|
23
23
|
$ csdx --help [COMMAND]
|
|
24
24
|
USAGE
|
|
25
25
|
$ csdx COMMAND
|
|
@@ -267,7 +267,7 @@ EXAMPLES
|
|
|
267
267
|
$ csdx plugins
|
|
268
268
|
```
|
|
269
269
|
|
|
270
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
270
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/index.ts)_
|
|
271
271
|
|
|
272
272
|
## `csdx plugins:add PLUGIN`
|
|
273
273
|
|
|
@@ -292,7 +292,7 @@ GLOBAL FLAGS
|
|
|
292
292
|
DESCRIPTION
|
|
293
293
|
Installs a plugin into csdx.
|
|
294
294
|
|
|
295
|
-
Uses
|
|
295
|
+
Uses npm to install plugins.
|
|
296
296
|
|
|
297
297
|
Installation of a user-installed plugin will override a core plugin.
|
|
298
298
|
|
|
@@ -341,7 +341,7 @@ EXAMPLES
|
|
|
341
341
|
$ csdx plugins:inspect myplugin
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
344
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/inspect.ts)_
|
|
345
345
|
|
|
346
346
|
## `csdx plugins:install PLUGIN`
|
|
347
347
|
|
|
@@ -366,7 +366,7 @@ GLOBAL FLAGS
|
|
|
366
366
|
DESCRIPTION
|
|
367
367
|
Installs a plugin into csdx.
|
|
368
368
|
|
|
369
|
-
Uses
|
|
369
|
+
Uses npm to install plugins.
|
|
370
370
|
|
|
371
371
|
Installation of a user-installed plugin will override a core plugin.
|
|
372
372
|
|
|
@@ -390,7 +390,7 @@ EXAMPLES
|
|
|
390
390
|
$ csdx plugins:install someuser/someplugin
|
|
391
391
|
```
|
|
392
392
|
|
|
393
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
393
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/install.ts)_
|
|
394
394
|
|
|
395
395
|
## `csdx plugins:link PATH`
|
|
396
396
|
|
|
@@ -420,7 +420,7 @@ EXAMPLES
|
|
|
420
420
|
$ csdx plugins:link myplugin
|
|
421
421
|
```
|
|
422
422
|
|
|
423
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
423
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/link.ts)_
|
|
424
424
|
|
|
425
425
|
## `csdx plugins:remove [PLUGIN]`
|
|
426
426
|
|
|
@@ -461,7 +461,7 @@ FLAGS
|
|
|
461
461
|
--reinstall Reinstall all plugins after uninstalling.
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
464
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/reset.ts)_
|
|
465
465
|
|
|
466
466
|
## `csdx plugins:uninstall [PLUGIN]`
|
|
467
467
|
|
|
@@ -489,7 +489,7 @@ EXAMPLES
|
|
|
489
489
|
$ csdx plugins:uninstall myplugin
|
|
490
490
|
```
|
|
491
491
|
|
|
492
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
492
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/uninstall.ts)_
|
|
493
493
|
|
|
494
494
|
## `csdx plugins:unlink [PLUGIN]`
|
|
495
495
|
|
|
@@ -533,5 +533,5 @@ DESCRIPTION
|
|
|
533
533
|
Update installed plugins.
|
|
534
534
|
```
|
|
535
535
|
|
|
536
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.
|
|
536
|
+
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.3.3/src/commands/plugins/update.ts)_
|
|
537
537
|
<!-- commandsstop -->
|
|
@@ -317,7 +317,7 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
317
317
|
(0, fs_1.mkdirSync)(this.sharedConfig.reportPath, { recursive: true });
|
|
318
318
|
}
|
|
319
319
|
// NOTE write int json
|
|
320
|
-
(0, fs_1.writeFileSync)((0, path_1.join)(this.sharedConfig.reportPath, `${moduleName}.json`), JSON.stringify(listOfMissingRefs));
|
|
320
|
+
(0, fs_1.writeFileSync)((0, path_1.join)((0, cli_utilities_1.sanitizePath)(this.sharedConfig.reportPath), `${(0, cli_utilities_1.sanitizePath)(moduleName)}.json`), JSON.stringify(listOfMissingRefs));
|
|
321
321
|
// NOTE write into CSV
|
|
322
322
|
return this.prepareCSV(moduleName, listOfMissingRefs);
|
|
323
323
|
}
|
|
@@ -332,44 +332,51 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
|
|
|
332
332
|
* @returns The function `prepareCSV` returns a Promise that resolves to `void`.
|
|
333
333
|
*/
|
|
334
334
|
prepareCSV(moduleName, listOfMissingRefs) {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
335
|
+
if (Object.keys(config_1.default.moduleConfig).includes(moduleName)) {
|
|
336
|
+
const csvPath = (0, path_1.join)((0, cli_utilities_1.sanitizePath)(this.sharedConfig.reportPath), `${(0, cli_utilities_1.sanitizePath)(moduleName)}.csv`);
|
|
337
|
+
return new Promise((resolve, reject) => {
|
|
338
|
+
// file deepcode ignore MissingClose: Will auto close once csv stream end
|
|
339
|
+
const ws = (0, fs_1.createWriteStream)(csvPath).on('error', reject);
|
|
340
|
+
const defaultColumns = Object.keys(types_1.OutputColumn);
|
|
341
|
+
const userDefinedColumns = this.sharedConfig.flags.columns ? this.sharedConfig.flags.columns.split(',') : null;
|
|
342
|
+
let missingRefs = Object.values(listOfMissingRefs).flat();
|
|
343
|
+
const columns = userDefinedColumns
|
|
344
|
+
? [...userDefinedColumns, ...defaultColumns.filter((val) => !userDefinedColumns.includes(val))]
|
|
345
|
+
: defaultColumns;
|
|
346
|
+
if (this.sharedConfig.flags.filter) {
|
|
347
|
+
const [column, value] = this.sharedConfig.flags.filter.split('=');
|
|
348
|
+
// Filter the missingRefs array
|
|
349
|
+
missingRefs = missingRefs.filter((row) => {
|
|
350
|
+
if (types_1.OutputColumn[column] in row) {
|
|
351
|
+
const rowKey = types_1.OutputColumn[column];
|
|
352
|
+
return row[rowKey] === value;
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
const rowData = [];
|
|
358
|
+
for (const issue of missingRefs) {
|
|
359
|
+
let row = {};
|
|
360
|
+
for (const column of columns) {
|
|
361
|
+
if (Object.keys(issue).includes(types_1.OutputColumn[column])) {
|
|
362
|
+
const issueKey = types_1.OutputColumn[column];
|
|
363
|
+
row[column] = issue[issueKey];
|
|
364
|
+
row[column] = typeof row[column] === 'object' ? JSON.stringify(row[column]) : row[column];
|
|
365
|
+
}
|
|
352
366
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
const rowData = [];
|
|
357
|
-
for (const issue of missingRefs) {
|
|
358
|
-
let row = {};
|
|
359
|
-
for (const column of columns) {
|
|
360
|
-
if (Object.keys(issue).includes(types_1.OutputColumn[column])) {
|
|
361
|
-
const issueKey = types_1.OutputColumn[column];
|
|
362
|
-
row[column] = issue[issueKey];
|
|
363
|
-
row[column] = typeof row[column] === 'object' ? JSON.stringify(row[column]) : row[column];
|
|
367
|
+
if (this.currentCommand === 'cm:stacks:audit:fix') {
|
|
368
|
+
row['Fix status'] = row.fixStatus;
|
|
364
369
|
}
|
|
370
|
+
rowData.push(row);
|
|
365
371
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
372
|
+
csv.write(rowData, { headers: true }).pipe(ws).on('error', reject).on('finish', resolve);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
return new Promise((reject) => {
|
|
377
|
+
return reject();
|
|
378
|
+
});
|
|
379
|
+
}
|
|
373
380
|
}
|
|
374
381
|
}
|
|
375
382
|
exports.AuditBaseCommand = AuditBaseCommand;
|
package/lib/messages/index.js
CHANGED
|
@@ -49,8 +49,8 @@ const auditFixMsg = {
|
|
|
49
49
|
EMPTY_FIX_MSG: 'Successfully removed the empty field/block found at {path} from the schema.',
|
|
50
50
|
AUDIT_FIX_CMD_DESCRIPTION: 'Perform audits and fix possible errors in the exported Contentstack data.',
|
|
51
51
|
WF_FIX_MSG: 'Successfully removed the workflow {uid} named {name}.',
|
|
52
|
-
ENTRY_MANDATORY_FIELD_FIX: `Removing the publish details from entry
|
|
53
|
-
ENTRY_SELECT_FIELD_FIX: `Adding the value '{value}' in select field of
|
|
52
|
+
ENTRY_MANDATORY_FIELD_FIX: `Removing the publish details from the entry with UID '{uid}' in Locale '{locale}'...`,
|
|
53
|
+
ENTRY_SELECT_FIELD_FIX: `Adding the value '{value}' in the select field of entry UID '{uid}'...`
|
|
54
54
|
};
|
|
55
55
|
exports.auditFixMsg = auditFixMsg;
|
|
56
56
|
const messages = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, errors), commonMsg), auditMsg), auditFixMsg), tableColumnDescriptions);
|
|
@@ -69,7 +69,12 @@ function $t(msg, args) {
|
|
|
69
69
|
return '';
|
|
70
70
|
for (const key of Object.keys(args)) {
|
|
71
71
|
const escapedKey = (0, cli_utilities_1.escapeRegExp)(key);
|
|
72
|
-
|
|
72
|
+
const escapedKeyRegex = new RegExp(`{${escapedKey}}`, 'g');
|
|
73
|
+
let { status } = (0, cli_utilities_1.validateRegex)(escapedKeyRegex);
|
|
74
|
+
if (status === 'safe') {
|
|
75
|
+
const sanitizedValue = args[key] ? (0, cli_utilities_1.escapeRegExp)(args[key]) : '';
|
|
76
|
+
msg = msg.replace(escapedKeyRegex, sanitizedValue || escapedKey);
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
return msg;
|
|
75
80
|
});
|
|
@@ -16,6 +16,7 @@ export default class ContentType {
|
|
|
16
16
|
protected missingRefs: Record<string, any>;
|
|
17
17
|
moduleName: keyof typeof auditConfig.moduleConfig;
|
|
18
18
|
constructor({ log, fix, config, moduleName, ctSchema, gfSchema }: ModuleConstructorParam & CtConstructorParam);
|
|
19
|
+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig;
|
|
19
20
|
/**
|
|
20
21
|
* The `run` function checks if a folder path exists, sets the schema based on the module name,
|
|
21
22
|
* iterates over the schema and looks for references, and returns a list of missing references.
|
|
@@ -21,9 +21,15 @@ class ContentType {
|
|
|
21
21
|
this.fix = fix !== null && fix !== void 0 ? fix : false;
|
|
22
22
|
this.ctSchema = ctSchema;
|
|
23
23
|
this.gfSchema = gfSchema;
|
|
24
|
-
this.moduleName = moduleName
|
|
24
|
+
this.moduleName = this.validateModules(moduleName, this.config.moduleConfig);
|
|
25
25
|
this.fileName = config.moduleConfig[this.moduleName].fileName;
|
|
26
|
-
this.folderPath = (0, path_1.resolve)(config.basePath, config.moduleConfig[this.moduleName].dirName);
|
|
26
|
+
this.folderPath = (0, path_1.resolve)((0, cli_utilities_1.sanitizePath)(config.basePath), (0, cli_utilities_1.sanitizePath)(config.moduleConfig[this.moduleName].dirName));
|
|
27
|
+
}
|
|
28
|
+
validateModules(moduleName, moduleConfig) {
|
|
29
|
+
if (Object.keys(moduleConfig).includes(moduleName)) {
|
|
30
|
+
return moduleName;
|
|
31
|
+
}
|
|
32
|
+
return 'content-types';
|
|
27
33
|
}
|
|
28
34
|
/**
|
|
29
35
|
* The `run` function checks if a folder path exists, sets the schema based on the module name,
|
package/lib/modules/entries.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export default class Entries {
|
|
|
18
18
|
protected missingMandatoryFields: Record<string, any>;
|
|
19
19
|
entryMetaData: Record<string, any>[];
|
|
20
20
|
moduleName: keyof typeof auditConfig.moduleConfig;
|
|
21
|
-
isEntryWithoutTitleField: boolean;
|
|
22
21
|
constructor({ log, fix, config, moduleName, ctSchema, gfSchema }: ModuleConstructorParam & CtConstructorParam);
|
|
22
|
+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig;
|
|
23
23
|
/**
|
|
24
24
|
* The `run` function checks if a folder path exists, sets the schema based on the module name,
|
|
25
25
|
* iterates over the schema and looks for references, and returns a list of missing references.
|
package/lib/modules/entries.js
CHANGED
|
@@ -20,15 +20,20 @@ class Entries {
|
|
|
20
20
|
this.missingMandatoryFields = {};
|
|
21
21
|
this.entryMetaData = [];
|
|
22
22
|
this.moduleName = 'entries';
|
|
23
|
-
this.isEntryWithoutTitleField = false;
|
|
24
23
|
this.log = log;
|
|
25
24
|
this.config = config;
|
|
26
25
|
this.fix = fix !== null && fix !== void 0 ? fix : false;
|
|
27
26
|
this.ctSchema = ctSchema;
|
|
28
27
|
this.gfSchema = gfSchema;
|
|
29
|
-
this.moduleName = moduleName
|
|
28
|
+
this.moduleName = this.validateModules(moduleName, this.config.moduleConfig);
|
|
30
29
|
this.fileName = config.moduleConfig[this.moduleName].fileName;
|
|
31
|
-
this.folderPath = (0, path_1.resolve)(config.basePath, config.moduleConfig.entries.dirName);
|
|
30
|
+
this.folderPath = (0, path_1.resolve)((0, cli_utilities_1.sanitizePath)(config.basePath), (0, cli_utilities_1.sanitizePath)(config.moduleConfig.entries.dirName));
|
|
31
|
+
}
|
|
32
|
+
validateModules(moduleName, moduleConfig) {
|
|
33
|
+
if (Object.keys(moduleConfig).includes(moduleName)) {
|
|
34
|
+
return moduleName;
|
|
35
|
+
}
|
|
36
|
+
return 'entries';
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* The `run` function checks if a folder path exists, sets the schema based on the module name,
|
|
@@ -36,6 +41,7 @@ class Entries {
|
|
|
36
41
|
* @returns the `missingRefs` object.
|
|
37
42
|
*/
|
|
38
43
|
async run() {
|
|
44
|
+
var _a;
|
|
39
45
|
if (!(0, fs_1.existsSync)(this.folderPath)) {
|
|
40
46
|
this.log(`Skipping ${this.moduleName} audit`, 'warn');
|
|
41
47
|
this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
|
|
@@ -70,7 +76,7 @@ class Entries {
|
|
|
70
76
|
}
|
|
71
77
|
this.lookForReference([{ locale: code, uid, name: title }], ctSchema, this.entries[entryUid]);
|
|
72
78
|
const fields = this.missingMandatoryFields[uid];
|
|
73
|
-
const isPublished = entry.publish_details.length > 0;
|
|
79
|
+
const isPublished = ((_a = entry.publish_details) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
74
80
|
if ((this.fix && fields.length && isPublished) || (!this.fix && fields)) {
|
|
75
81
|
const fixStatus = this.fix ? 'Fixed' : '';
|
|
76
82
|
fields === null || fields === void 0 ? void 0 : fields.forEach((field) => {
|
|
@@ -977,21 +983,16 @@ class Entries {
|
|
|
977
983
|
for (const entryUid in entries) {
|
|
978
984
|
let { title } = entries[entryUid];
|
|
979
985
|
if (entries[entryUid].hasOwnProperty('title') && !title) {
|
|
980
|
-
this.isEntryWithoutTitleField = true;
|
|
981
986
|
this.log(`The 'title' field in Entry with UID '${entryUid}' of Content Type '${uid}' in Locale '${code}' is empty.`, `error`);
|
|
982
987
|
}
|
|
983
988
|
else if (!title) {
|
|
984
|
-
this.
|
|
985
|
-
this.log(`Entry with UID '${entryUid}' of Content Type '${uid}' in Locale '${code}' does not have a 'title' field.`, `error`);
|
|
989
|
+
this.log(`The 'title' field in Entry with UID '${entryUid}' of Content Type '${uid}' in Locale '${code}' is empty.`, `error`);
|
|
986
990
|
}
|
|
987
991
|
this.entryMetaData.push({ uid: entryUid, title });
|
|
988
992
|
}
|
|
989
993
|
}
|
|
990
994
|
}
|
|
991
995
|
}
|
|
992
|
-
if (this.isEntryWithoutTitleField) {
|
|
993
|
-
// throw Error(`Entries found with missing 'title' field! Please make the data corrections and re-run the audit.`);
|
|
994
|
-
}
|
|
995
996
|
}
|
|
996
997
|
}
|
|
997
998
|
exports.default = Entries;
|
|
@@ -14,6 +14,7 @@ export default class Extensions {
|
|
|
14
14
|
missingCts: Set<string>;
|
|
15
15
|
extensionsPath: string;
|
|
16
16
|
constructor({ log, fix, config, moduleName, ctSchema, }: ModuleConstructorParam & Pick<CtConstructorParam, 'ctSchema'>);
|
|
17
|
+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig;
|
|
17
18
|
run(): Promise<{}>;
|
|
18
19
|
fixExtensionsScope(missingCtInExtensions: Extension[]): Promise<void>;
|
|
19
20
|
writeFixContent(fixedExtensions: Record<string, Extension>): Promise<void>;
|
|
@@ -14,15 +14,22 @@ class Extensions {
|
|
|
14
14
|
this.fix = fix !== null && fix !== void 0 ? fix : false;
|
|
15
15
|
this.ctSchema = ctSchema;
|
|
16
16
|
this.extensionsSchema = [];
|
|
17
|
-
this.moduleName = moduleName
|
|
17
|
+
this.moduleName = this.validateModules(moduleName, this.config.moduleConfig);
|
|
18
18
|
this.fileName = config.moduleConfig[this.moduleName].fileName;
|
|
19
|
-
this.folderPath = (0, path_1.resolve)(config.basePath, config.moduleConfig[this.moduleName].dirName);
|
|
19
|
+
this.folderPath = (0, path_1.resolve)((0, cli_utilities_1.sanitizePath)(config.basePath), (0, cli_utilities_1.sanitizePath)(config.moduleConfig[this.moduleName].dirName));
|
|
20
20
|
this.ctUidSet = new Set(['$all']);
|
|
21
21
|
this.missingCtInExtensions = [];
|
|
22
22
|
this.missingCts = new Set();
|
|
23
23
|
this.extensionsPath = '';
|
|
24
24
|
}
|
|
25
|
+
validateModules(moduleName, moduleConfig) {
|
|
26
|
+
if (Object.keys(moduleConfig).includes(moduleName)) {
|
|
27
|
+
return moduleName;
|
|
28
|
+
}
|
|
29
|
+
return 'extensions';
|
|
30
|
+
}
|
|
25
31
|
async run() {
|
|
32
|
+
var _a;
|
|
26
33
|
if (!(0, fs_1.existsSync)(this.folderPath)) {
|
|
27
34
|
this.log(`Skipping ${this.moduleName} audit`, 'warn');
|
|
28
35
|
this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
|
|
@@ -38,8 +45,8 @@ class Extensions {
|
|
|
38
45
|
const ctNotPresent = scope === null || scope === void 0 ? void 0 : scope.content_types.filter((ct) => !this.ctUidSet.has(ct));
|
|
39
46
|
if ((ctNotPresent === null || ctNotPresent === void 0 ? void 0 : ctNotPresent.length) && ext.scope) {
|
|
40
47
|
ext.content_types = ctNotPresent;
|
|
41
|
-
ctNotPresent.forEach((ct) => this.missingCts.add(ct));
|
|
42
|
-
this.missingCtInExtensions.push((0, lodash_1.cloneDeep)(ext));
|
|
48
|
+
ctNotPresent.forEach((ct) => { var _a; return (_a = this.missingCts) === null || _a === void 0 ? void 0 : _a.add(ct); });
|
|
49
|
+
(_a = this.missingCtInExtensions) === null || _a === void 0 ? void 0 : _a.push((0, lodash_1.cloneDeep)(ext));
|
|
43
50
|
}
|
|
44
51
|
this.log((0, messages_1.$t)(messages_1.auditMsg.SCAN_EXT_SUCCESS_MSG, {
|
|
45
52
|
title,
|
|
@@ -15,6 +15,7 @@ export default class Workflows {
|
|
|
15
15
|
workflowPath: string;
|
|
16
16
|
isBranchFixDone: boolean;
|
|
17
17
|
constructor({ log, fix, config, moduleName, ctSchema, }: ModuleConstructorParam & Pick<CtConstructorParam, 'ctSchema'>);
|
|
18
|
+
validateModules(moduleName: keyof typeof auditConfig.moduleConfig, moduleConfig: Record<string, unknown>): keyof typeof auditConfig.moduleConfig;
|
|
18
19
|
/**
|
|
19
20
|
* Check whether the given path for the workflow exists or not
|
|
20
21
|
* If path exist read
|
package/lib/modules/workflows.js
CHANGED
|
@@ -13,15 +13,21 @@ class Workflows {
|
|
|
13
13
|
this.fix = fix !== null && fix !== void 0 ? fix : false;
|
|
14
14
|
this.ctSchema = ctSchema;
|
|
15
15
|
this.workflowSchema = [];
|
|
16
|
-
this.moduleName = moduleName
|
|
16
|
+
this.moduleName = this.validateModules(moduleName, this.config.moduleConfig);
|
|
17
17
|
this.fileName = config.moduleConfig[this.moduleName].fileName;
|
|
18
|
-
this.folderPath = (0, path_1.resolve)(config.basePath, config.moduleConfig[this.moduleName].dirName);
|
|
18
|
+
this.folderPath = (0, path_1.resolve)((0, cli_utilities_1.sanitizePath)(config.basePath), (0, cli_utilities_1.sanitizePath)(config.moduleConfig[this.moduleName].dirName));
|
|
19
19
|
this.ctUidSet = new Set(['$all']);
|
|
20
20
|
this.missingCtInWorkflows = [];
|
|
21
21
|
this.missingCts = new Set();
|
|
22
22
|
this.workflowPath = '';
|
|
23
23
|
this.isBranchFixDone = false;
|
|
24
24
|
}
|
|
25
|
+
validateModules(moduleName, moduleConfig) {
|
|
26
|
+
if (Object.keys(moduleConfig).includes(moduleName)) {
|
|
27
|
+
return moduleName;
|
|
28
|
+
}
|
|
29
|
+
return 'workflows';
|
|
30
|
+
}
|
|
25
31
|
/**
|
|
26
32
|
* Check whether the given path for the workflow exists or not
|
|
27
33
|
* If path exist read
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-audit",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Contentstack audit plugin",
|
|
5
5
|
"author": "Contentstack CLI",
|
|
6
6
|
"homepage": "https://github.com/contentstack/cli",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@contentstack/cli-command": "~1.2.18",
|
|
22
|
-
"@contentstack/cli-utilities": "~1.6.
|
|
22
|
+
"@contentstack/cli-utilities": "~1.6.3",
|
|
23
23
|
"@oclif/plugin-help": "^5",
|
|
24
24
|
"@oclif/plugin-plugins": "^5.0.0",
|
|
25
25
|
"chalk": "^4.1.2",
|