Skip to content

Commit

Permalink
Merge pull request #599 from willosborne/multimodule-fixes
Browse files Browse the repository at this point in the history
Fix CLI
  • Loading branch information
Thels authored Nov 18, 2024
2 parents 8dca432 + 462a146 commit acca69b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ program
.option(OUTPUT_OPTION, 'Path location at which to output the generated file.')
.option(VERBOSE_OPTION, 'Enable verbose logging.', false)
.action(async (options) => {
const outcome = await validate(options.instantiation, options.pattern, options.metaSchemasLocation, options.verbose);
const outcome = await validate(options.instantiation, options.pattern, options.schemaDirectory, options.verbose);
const content = getFormattedOutput(outcome, options.format, options.instantiation, options.pattern);
writeOutputFile(options.output, content);
exitBasedOffOfValidationOutcome(outcome, options.strict);
Expand Down
4 changes: 2 additions & 2 deletions shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"test": "jest --verbose",
"lint": "eslint src --config ./.eslintrc.json",
"lint-fix": "eslint src -- --fix",
"copy-calm-schema": "copyfiles ../calm/draft/2024-04/meta/* dist/calm/",
"copy-spectral-rules": "copyfiles ../spectral/**/* dist/spectral/",
"copy-calm-schema": "copyfiles \"../calm/draft/2024-04/meta/*\" dist/calm/",
"copy-spectral-rules": "copyfiles \"../spectral/**/*\" dist/spectral/",
"copy-calm-schema-old": "mkdir -p dist/calm && cp -r ../calm/draft/2024-04/meta dist/calm/",
"dependency-check": "dependency-check --project 'calm-shared' --scan . --out ./dependency-check-report --format ALL --suppression ../.github/node-cve-ignore-list.xml"
},
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/schema-directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class SchemaDirectory {
this.logger.info(`Loaded ${this.schemas.size} schemas.`);
} catch (err) {
if (err.code === 'ENOENT') {
this.logger.error('Schema Path not found!');
this.logger.error('Schema Path not found: ', dir, ', error: ', err);
} else {
this.logger.error(err);
}
Expand Down
11 changes: 10 additions & 1 deletion shared/src/commands/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ export function initLogger(debug: boolean): winston.Logger {
new winston.transports.Console()
],
level: level,
format: winston.format.cli(),
format: winston.format.combine(
winston.format.cli(),
winston.format.errors({ stack: true }),
winston.format.printf(({ level, message, stack }) => {
if (stack) {
return `${level}: ${message} - ${stack}`;
}
return `${level}: ${message}`;
}),
)
});
}
2 changes: 1 addition & 1 deletion shared/src/commands/validate/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export async function validate(

return new ValidationOutcome(jsonSchemaValidations, spectralResult.spectralIssues, errors, warnings);
} catch (error) {
logger.error(`An error occured: ${error}`);
logger.error('An error occured:', error);
process.exit(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion shared/src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const CALM_META_SCHEMA_DIRECTORY = __dirname + '/calm/meta';
export const CALM_META_SCHEMA_DIRECTORY = __dirname + '/calm/draft';
export const CALM_SPECTRAL_RULES_DIRECTORY = __dirname + '/spectral';

0 comments on commit acca69b

Please sign in to comment.