Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-inline-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@satoshai/abi-cli": patch
---

Inline version at build time via tsup define instead of runtime createRequire
6 changes: 2 additions & 4 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { createRequire } from 'node:module';
import { defineCommand, runMain } from 'citty';
import { fetchCommand } from './commands/fetch.js';

const require = createRequire(import.meta.url);
const { version } = require('../package.json') as { version: string };
declare const __VERSION__: string;

const main = defineCommand({
meta: {
name: 'abi-cli',
version,
version: __VERSION__,
description: 'Fetch Stacks contract ABIs and generate TypeScript definitions',
},
subCommands: {
Expand Down
2 changes: 2 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'tsup';
import pkg from './package.json';

export default defineConfig([
{
Expand All @@ -14,6 +15,7 @@ export default defineConfig([
{
entry: ['src/cli.ts'],
format: ['esm'],
define: { __VERSION__: JSON.stringify(pkg.version) },
banner: { js: '#!/usr/bin/env node' },
sourcemap: true,
splitting: false,
Expand Down