Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TS issues in writeGitVersion #735

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-types.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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@reduxjs/toolkit": "^2.0.1",
"@testing-library/react": "^14.1.2",
"@types/lodash": "^4.14.175",
"@types/node": "^22.7.7",
"@types/react": "^18.2.38",
"@types/react-dom": "^18.2.17",
"@types/shelljs": "^0.8.11",
Expand All @@ -81,6 +82,7 @@
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
"tsup": "^8.2.4",
"tsx": "^4.19.1",
"typescript": "^5.4.2",
"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, 'utf-8'))

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