Skip to content

Commit

Permalink
feat: add version to skott cli
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-coulon committed Oct 21, 2022
1 parent c8c9449 commit 885d69a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions packages/skott/bin/cli.ts
@@ -1,10 +1,33 @@
#!/usr/bin/env node

import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

import sade from "sade";

import { displaySkott } from "./main.js";

function readManifestVersion(): string {
try {
const pathToManifest = path.join(
path.dirname(fileURLToPath(import.meta.url)),
"..",
"..",
"package.json"
);
// eslint-disable-next-line no-sync
const manifestContent = fs.readFileSync(path.join(pathToManifest), "utf-8");
const { version } = JSON.parse(manifestContent);

return version;
} catch {
return "0.0.0";
}
}

const cli = sade("skott <entrypoint>", true)
.version(readManifestVersion())
.describe("Start the Skott analysis to fully build the graph")

.option(
Expand Down

0 comments on commit 885d69a

Please sign in to comment.