Skip to content

Commit

Permalink
feature: add version command to CLI (#61)
Browse files Browse the repository at this point in the history
* add version command

* update pnpm version
  • Loading branch information
joshmossas authored Jun 4, 2024
1 parent 2e292f3 commit a33f5a6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9.1.3
version: 9.1.4
- name: Install Node.js
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9.1.3
version: 9.1.4
- name: Install Node.js
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9.1.3
version: 9.1.4
- name: Install Node.js
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 3 additions & 1 deletion tooling/cli/src/_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import build from "./commands/build";
import codegen from "./commands/codegen";
import dev from "./commands/dev";
import init from "./commands/init";
import version from "./commands/version";

const main = defineCommand({
subCommands: {
build,
dev,
codegen,
dev,
init,
version,
},
});

Expand Down
25 changes: 25 additions & 0 deletions tooling/cli/src/commands/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";

import { defineCommand } from "citty";
import path from "pathe";

const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

const version = defineCommand({
meta: {
name: "Version",
description: "Get the current Arri CLI version",
},
run() {
const packageJson = JSON.parse(
readFileSync(path.resolve(__dirname, "../package.json"), {
encoding: "utf8",
}),
);
console.info(`${packageJson.version}`);
},
});

export default version;

0 comments on commit a33f5a6

Please sign in to comment.