@contentstack/cli-audit 1.3.4 → 1.3.5

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 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.3.4 linux-x64 node-v18.19.0
22
+ @contentstack/cli-audit/1.3.5 linux-x64 node-v18.19.0
23
23
  $ csdx --help [COMMAND]
24
24
  USAGE
25
25
  $ csdx COMMAND
@@ -143,19 +143,8 @@ class AuditBaseCommand extends base_command_1.BaseCommand {
143
143
  * `gfSchema`. The values of these properties are the parsed JSON data from two different files.
144
144
  */
145
145
  getCtAndGfSchema() {
146
- const modules = this.sharedConfig.flags.modules || this.sharedConfig.modules;
147
146
  const ctPath = (0, path_1.join)(this.sharedConfig.basePath, this.sharedConfig.moduleConfig['content-types'].dirName, this.sharedConfig.moduleConfig['content-types'].fileName);
148
147
  const gfPath = (0, path_1.join)(this.sharedConfig.basePath, this.sharedConfig.moduleConfig['global-fields'].dirName, this.sharedConfig.moduleConfig['global-fields'].fileName);
149
- if (modules.includes('content-types')) {
150
- if (!(0, fs_1.existsSync)(ctPath)) {
151
- this.log(this.$t(messages_1.auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
152
- }
153
- }
154
- if (modules.includes('global-fields')) {
155
- if (!(0, fs_1.existsSync)(gfPath)) {
156
- this.log(this.$t(messages_1.auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
157
- }
158
- }
159
148
  const gfSchema = (0, fs_1.existsSync)(gfPath) ? JSON.parse((0, fs_1.readFileSync)(gfPath, 'utf8')) : [];
160
149
  const ctSchema = (0, fs_1.existsSync)(ctPath) ? JSON.parse((0, fs_1.readFileSync)(ctPath, 'utf8')) : [];
161
150
  return { ctSchema, gfSchema };
@@ -32,7 +32,9 @@ class ContentType {
32
32
  var _a;
33
33
  this.inMemoryFix = returnFixSchema;
34
34
  if (!(0, fs_1.existsSync)(this.folderPath)) {
35
- throw new Error((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }));
35
+ this.log(`Skipping ${this.moduleName} audit`, 'warn');
36
+ this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
37
+ return returnFixSchema ? [] : {};
36
38
  }
37
39
  this.schema = this.moduleName === 'content-types' ? this.ctSchema : this.gfSchema;
38
40
  for (const schema of (_a = this.schema) !== null && _a !== void 0 ? _a : []) {
@@ -31,7 +31,9 @@ class Entries {
31
31
  */
32
32
  async run() {
33
33
  if (!(0, fs_1.existsSync)(this.folderPath)) {
34
- throw new Error((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }));
34
+ this.log(`Skipping ${this.moduleName} audit`, 'warn');
35
+ this.log((0, messages_1.$t)(messages_1.auditMsg.NOT_VALID_PATH, { path: this.folderPath }), { color: 'yellow' });
36
+ return {};
35
37
  }
36
38
  await this.prepareEntryMetaData();
37
39
  await this.fixPrerequisiteData();
@@ -589,8 +591,10 @@ class Entries {
589
591
  const localesFolderPath = (0, path_1.resolve)(this.config.basePath, this.config.moduleConfig.locales.dirName);
590
592
  const localesPath = (0, path_1.join)(localesFolderPath, this.config.moduleConfig.locales.fileName);
591
593
  const masterLocalesPath = (0, path_1.join)(localesFolderPath, 'master-locale.json');
592
- this.locales = (0, values_1.default)(JSON.parse((0, fs_1.readFileSync)(masterLocalesPath, 'utf8')));
593
- this.locales.push(...(0, values_1.default)(JSON.parse((0, fs_1.readFileSync)(localesPath, 'utf8'))));
594
+ this.locales = (0, fs_1.existsSync)(masterLocalesPath) ? (0, values_1.default)(JSON.parse((0, fs_1.readFileSync)(masterLocalesPath, 'utf8'))) : [];
595
+ if ((0, fs_1.existsSync)(localesPath)) {
596
+ this.locales.push(...(0, values_1.default)(JSON.parse((0, fs_1.readFileSync)(localesPath, 'utf8'))));
597
+ }
594
598
  for (const { code } of this.locales) {
595
599
  for (const { uid } of this.ctSchema) {
596
600
  let basePath = (0, path_1.join)(this.folderPath, uid, code);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.4",
2
+ "version": "1.3.5",
3
3
  "commands": {
4
4
  "cm:stacks:audit:fix": {
5
5
  "id": "cm:stacks:audit:fix",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/cli-audit",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "Contentstack audit plugin",
5
5
  "author": "Contentstack CLI",
6
6
  "homepage": "https://github.com/contentstack/cli",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@contentstack/cli-dev-dependencies": "^1.2.4",
34
- "@oclif/test": "^2.0.3",
34
+ "@oclif/test": "^2.5.6",
35
35
  "@types/chai": "^4.3.5",
36
36
  "@types/fs-extra": "^11.0.2",
37
37
  "@types/mocha": "^10.0.6",