Skip to content

Commit d94a56c

Browse files
jwfingclaude
andcommitted
Publish as the 'insta' npm package
- name insta-cli → insta; drop private:true (was blocking publish) - files → dist/**/*.js so the ~440MB bun binaries in dist/bin are not shipped - add engines(node>=18), prepublishOnly build, repo/homepage/bugs/keywords, publishConfig.access=public, license - --version now reads the installed package.json (npm/node) instead of reporting 0.0.0; standalone binary still uses INSTA_CLI_VERSION Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent afe8c15 commit d94a56c

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
{
2-
"name": "insta-cli",
3-
"version": "0.0.1",
4-
"private": true,
2+
"name": "insta",
3+
"version": "0.0.2",
54
"type": "module",
65
"description": "InstaCloud CLI — a thin client of the platform control-plane API.",
6+
"keywords": ["insta", "insforge", "cli", "backend", "baas", "platform"],
7+
"license": "MIT",
8+
"homepage": "https://github.com/InsForge/insta-cli#readme",
9+
"repository": { "type": "git", "url": "git+https://github.com/InsForge/insta-cli.git" },
10+
"bugs": { "url": "https://github.com/InsForge/insta-cli/issues" },
711
"bin": { "insta": "dist/index.js" },
8-
"files": ["dist"],
12+
"files": ["dist/**/*.js"],
13+
"engines": { "node": ">=18" },
14+
"publishConfig": { "access": "public" },
915
"scripts": {
1016
"build": "tsc -p tsconfig.json",
1117
"typecheck": "tsc -p tsconfig.json --noEmit",
1218
"dev": "tsx src/index.ts",
1319
"test": "vitest run",
1420
"compile": "bun build ./src/index.ts --compile --minify --outfile dist/bin/insta",
15-
"build:binaries": "bash scripts/build-binaries.sh"
21+
"build:binaries": "bash scripts/build-binaries.sh",
22+
"prepublishOnly": "npm run build"
1623
},
1724
"dependencies": {
1825
"commander": "^12.1.0"

src/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env node
2+
import { readFileSync } from 'node:fs'
23
import { Command } from 'commander'
34
import { ApiError } from './api.js'
45
import { die } from './util.js'
@@ -26,10 +27,15 @@ const guard = (fn: (...a: any[]) => Promise<unknown>) => (...a: any[]): Promise<
2627
fn(...a).then(() => undefined).catch(onError)
2728

2829
const program = new Command()
29-
// Baked in at compile time for the standalone binary (bun build --define); falls back to 0.0.0 for
30-
// the plain node/npm build.
31-
const VERSION = process.env.INSTA_CLI_VERSION ?? '0.0.0'
32-
program.name('insta').description('InstaCloud CLI — manage projects, branches, secrets, deploys').version(VERSION)
30+
// Version resolution: INSTA_CLI_VERSION (baked into the standalone binary via bun build --define) →
31+
// the installed package.json (npm/node — ../package.json sits beside dist/) → 0.0.0.
32+
function resolveVersion(): string {
33+
if (process.env.INSTA_CLI_VERSION) return process.env.INSTA_CLI_VERSION
34+
try {
35+
return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version as string
36+
} catch { return '0.0.0' }
37+
}
38+
program.name('insta').description('InstaCloud CLI — manage projects, branches, secrets, deploys').version(resolveVersion())
3339

3440
// ---- auth ----
3541
program.command('login').description('Log in with email + password, or --oauth <github|google> (browser)')

0 commit comments

Comments
 (0)