Skip to content

Commit

Permalink
Fix TS issues in writeGitVersion (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 authored Oct 10, 2024
1 parent 58c45ac commit 9161c48
Show file tree
Hide file tree
Showing 5 changed files with 432 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

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

- name: Check updated version
run: jq .version package.json
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"redux": "^5.0.0"
},
"devDependencies": {
"@types/node": "^20.11.20",
"@types/node": "^22.7.5",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"cross-env": "^7.0.3",
Expand All @@ -58,6 +58,7 @@
"redux": "^5",
"rimraf": "^3.0.2",
"tsup": "7.0.0",
"tsx": "^4.19.1",
"typescript": "^5.5.4",
"vitest": "^1.6.0"
},
Expand Down
14 changes: 0 additions & 14 deletions scripts/writeGitVersion.mjs

This file was deleted.

12 changes: 12 additions & 0 deletions scripts/writeGitVersion.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node --import=tsx

import * as fs from 'node:fs'
import * as path from 'node:path'

const gitRev = process.argv[2]

const packagePath = path.join(import.meta.dirname, '../package.json')
const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8'))

pkg.version = `${pkg.version}-${gitRev}`
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2))
Loading

0 comments on commit 9161c48

Please sign in to comment.