Skip to content

Commit

Permalink
Error logs added, Readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
antonyagustine committed Oct 6, 2023
1 parent c4ca3e1 commit f2095f3
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 142 deletions.
6 changes: 3 additions & 3 deletions packages/contentstack-audit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ npm install -g @contentstack/cli-audit
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-audit/0.0.0-alpha darwin-arm64 node-v16.19.0
@contentstack/cli-audit/0.0.0-alpha darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down Expand Up @@ -127,7 +127,7 @@ EXAMPLES
$ csdx audit:fix --report-path=<path> --filter="name=<filter-value>"
$ csdx audit:fix --report-path=<path> --modules=content-types --filter="name="<filter-value>"
$ csdx audit:fix --report-path=<path> --modules=content-types --filter="name="<filter-value>" --copy-dir --backup-dir=<path>
```

## `csdx cm:stacks:audit`
Expand Down Expand Up @@ -214,7 +214,7 @@ EXAMPLES
$ csdx cm:stacks:audit:fix --report-path=<path> --filter="name=<filter-value>"
$ csdx cm:stacks:audit:fix --report-path=<path> --modules=content-types --filter="name="<filter-value>"
$ csdx cm:stacks:audit:fix --report-path=<path> --modules=content-types --filter="name="<filter-value>" --copy-dir --backup-dir=<path>
```

_See code: [src/commands/cm/stacks/audit/fix.ts](https://github.com/contentstack/audit/blob/main/packages/contentstack-audit/src/commands/cm/stacks/audit/fix.ts)_
Expand Down
20 changes: 12 additions & 8 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,26 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma

if (modules.includes('content-types')) {
if (!existsSync(ctPath)) {
throw new Error(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }));
this.log(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
}
}

if (modules.includes('global-fields')) {
if (!existsSync(gfPath)) {
throw new Error(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }));
this.log(this.$t(auditMsg.NOT_VALID_PATH, { path: ctPath }), 'error');
}
}

let gfSchema = JSON.parse(
readFileSync(join(gfPath, this.sharedConfig.moduleConfig['global-fields'].fileName), 'utf-8'),
) as ContentTypeStruct[];
let ctSchema = JSON.parse(
readFileSync(join(ctPath, this.sharedConfig.moduleConfig['content-types'].fileName), 'utf-8'),
) as ContentTypeStruct[];
let gfSchema = existsSync(gfPath)
? (JSON.parse(
readFileSync(join(gfPath, this.sharedConfig.moduleConfig['global-fields'].fileName), 'utf-8'),
) as ContentTypeStruct[])
: [];
let ctSchema = existsSync(ctPath)
? (JSON.parse(
readFileSync(join(ctPath, this.sharedConfig.moduleConfig['content-types'].fileName), 'utf-8'),
) as ContentTypeStruct[])
: [];

return { ctSchema, gfSchema };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class AuditFix extends AuditBaseCommand {
'$ <%= config.bin %> <%= command.id %> --report-path=<path> --copy-dir',
'$ <%= config.bin %> <%= command.id %> --report-path=<path> --copy-dir --csv',
'$ <%= config.bin %> <%= command.id %> --report-path=<path> --filter="name=<filter-value>"',
'$ <%= config.bin %> <%= command.id %> --report-path=<path> --modules=content-types --filter="name="<filter-value>"',
'$ <%= config.bin %> <%= command.id %> --report-path=<path> --modules=content-types --filter="name="<filter-value>" --copy-dir --backup-dir=<path>',
];

static flags: FlagInput = {
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-auth
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-auth/1.3.14 darwin-x64 node-v20.8.0
@contentstack/cli-auth/1.3.14 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-bootstrap
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bootstrap/1.5.1 darwin-x64 node-v20.8.0
@contentstack/cli-cm-bootstrap/1.5.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-branches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-branches/1.0.14 darwin-x64 node-v20.8.0
@contentstack/cli-cm-branches/1.0.14 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-bulk-publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-cm-bulk-publish
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-bulk-publish/1.3.12 darwin-x64 node-v20.8.0
@contentstack/cli-cm-bulk-publish/1.3.12 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-clone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-clone/1.5.1 darwin-x64 node-v20.8.0
@contentstack/cli-cm-clone/1.5.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @contentstack/cli-config
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-config/1.4.12 darwin-x64 node-v20.8.0
@contentstack/cli-config/1.4.12 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-export/1.9.1 darwin-x64 node-v20.8.0
@contentstack/cli-cm-export/1.9.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-import/1.9.1 darwin-x64 node-v20.8.0
@contentstack/cli-cm-import/1.9.1 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-launch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ npm install -g @contentstack/cli-launch
$ csdx COMMAND
running command...
$ csdx (--version|-v)
@contentstack/cli-launch/1.0.12 darwin-x64 node-v20.8.0
@contentstack/cli-launch/1.0.12 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-migrate-rte/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-migrate-rte
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-cm-migrate-rte/1.4.12 darwin-x64 node-v20.8.0
@contentstack/cli-cm-migrate-rte/1.4.12 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-migration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ npm install -g @contentstack/cli-migration
$ csdx COMMAND
running command...
$ csdx (--version)
@contentstack/cli-migration/1.3.13 darwin-x64 node-v20.8.0
@contentstack/cli-migration/1.3.13 darwin-arm64 node-v20.8.0
$ csdx --help [COMMAND]
USAGE
$ csdx COMMAND
Expand Down
Loading

0 comments on commit f2095f3

Please sign in to comment.