Skip to content

Commit

Permalink
Add --version flag to component-manifest command (#302)
Browse files Browse the repository at this point in the history
* Add --version flag to component-manifest command

* Switch from reading package.json as a file to a require()
  • Loading branch information
taylorreece authored Jan 30, 2025
1 parent 8258a82 commit 997f0e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/spectral/src/generators/componentManifest/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const runMain = async (process: NodeJS.Process) => {
description:
"This skips the signature verification process, always returning a component signature in the component manifest.",
},
version: {
flag: ["--version"],
value: getFlagsBooleanValue({ args, flags: ["--version"] }),
description:
"Display the version of @prismatic-io/spectral this component manifest generator uses.",
},
help: {
flag: ["--help", "-h"],
value: getFlagsBooleanValue({
Expand All @@ -79,6 +85,12 @@ export const runMain = async (process: NodeJS.Process) => {
},
};

if (flags.version.value) {
const { version } = require("../../../package.json");
console.log(version);
process.exit(0);
}

if (flags.help.value) {
createFlagHelpText({
command: "component-manifest",
Expand Down

0 comments on commit 997f0e4

Please sign in to comment.