@userland.fun/cli 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +9 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,12 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
- import { promises as fs } from "node:fs";
3
+ import { promises as fs, readFileSync } from "node:fs";
4
4
  import os from "node:os";
5
5
  import path from "node:path";
6
6
  import { createInterface } from "node:readline/promises";
7
7
  const DEFAULT_API_BASE_URL = "https://api.userland.fun";
8
8
  const DEFAULT_CONSOLE_BASE_URL = "https://console.userland.fun";
9
- const CLI_VERSION = "0.0.0";
9
+ const CLI_VERSION = readCliVersion();
10
+ function readCliVersion() {
11
+ const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
12
+ if (typeof packageJson.version !== "string" || packageJson.version.length === 0) {
13
+ throw new Error("Unable to read CLI package version");
14
+ }
15
+ return packageJson.version;
16
+ }
10
17
  async function main() {
11
18
  const [command, ...args] = process.argv.slice(2);
12
19
  if (isHelpCommand(command)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@userland.fun/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Userland command-line tools for publishing and operating apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",