Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 487cead

Browse files
committed
Hardcode cli version on compile-time
1 parent f3c2615 commit 487cead

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"homepage": "https://axelrindle.github.io/github-version-checker/",
2222
"scripts": {
2323
"clean": "rm -rf .nyc_output coverage dist pkg",
24-
"build": "tsc",
24+
"build": "tsc && scripts/*.sh",
2525
"test": "nyc --reporter=lcov --reporter=text-summary ava test/test-*",
2626
"start": "tsx src/index.ts",
2727
"package": "rm -rf pkg && pkg . --compress gzip --output pkg/version-checker --targets node18-linux-x64,node18-win-x64,node18-macos-x64,node18-linux-arm64,node18-win-arm64,node18-macos-arm64",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
VERSION=$(jq -r .version < ../../lerna.json)
4+
5+
find dist -type f -exec sed -i "s/%VERSION%/$VERSION/g" {} \;
6+
7+
echo "Replaced %VERSION% tokens with $VERSION"

packages/cli/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env node
2-
import { readFileSync } from 'fs'
32
import sade from 'sade'
43
import action from './action'
54

6-
const { version } = JSON.parse(readFileSync('./package.json').toString())
5+
const version = 'v%VERSION%'
76
const program = sade('version-checker', true)
87

98
program

0 commit comments

Comments
 (0)