Skip to content

Commit

Permalink
Path validation added
Browse files Browse the repository at this point in the history
  • Loading branch information
antonyagustine committed Oct 6, 2023
1 parent d868530 commit b4202f0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/contentstack-audit/src/audit-base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,16 @@ export abstract class AuditBaseCommand extends BaseCommand<typeof AuditBaseComma
}
}

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

0 comments on commit b4202f0

Please sign in to comment.