Skip to content

Commit 9161c48

Browse files
authored
Fix TS issues in writeGitVersion (#375)
1 parent 58c45ac commit 9161c48

File tree

5 files changed

+432
-149
lines changed

5 files changed

+432
-149
lines changed

Diff for: .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
# Read existing version, reuse that, add a Git short hash
2727
- name: Set build version to Git commit
28-
run: node scripts/writeGitVersion.mjs $(git rev-parse --short HEAD)
28+
run: yarn tsx scripts/writeGitVersion.mts $(git rev-parse --short HEAD)
2929

3030
- name: Check updated version
3131
run: jq .version package.json

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"redux": "^5.0.0"
4949
},
5050
"devDependencies": {
51-
"@types/node": "^20.11.20",
51+
"@types/node": "^22.7.5",
5252
"@typescript-eslint/eslint-plugin": "^5.1.0",
5353
"@typescript-eslint/parser": "^5.1.0",
5454
"cross-env": "^7.0.3",
@@ -58,6 +58,7 @@
5858
"redux": "^5",
5959
"rimraf": "^3.0.2",
6060
"tsup": "7.0.0",
61+
"tsx": "^4.19.1",
6162
"typescript": "^5.5.4",
6263
"vitest": "^1.6.0"
6364
},

Diff for: scripts/writeGitVersion.mjs

-14
This file was deleted.

Diff for: scripts/writeGitVersion.mts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env node --import=tsx
2+
3+
import * as fs from 'node:fs'
4+
import * as path from 'node:path'
5+
6+
const gitRev = process.argv[2]
7+
8+
const packagePath = path.join(import.meta.dirname, '../package.json')
9+
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
10+
11+
pkg.version = `${pkg.version}-${gitRev}`
12+
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2))

0 commit comments

Comments
 (0)