mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
add timestamp script to generate vsix with timestamp added
This commit is contained in:
parent
7d248cf29c
commit
a4c9b732f3
2 changed files with 42 additions and 0 deletions
|
|
@ -18,8 +18,10 @@
|
|||
"bundle:nightly": "turbo bundle:nightly --log-order grouped --output-logs new-only",
|
||||
"vsix": "turbo vsix --log-order grouped --output-logs new-only",
|
||||
"vsix:nightly": "turbo vsix:nightly --log-order grouped --output-logs new-only",
|
||||
"vsix:timestamp": "node scripts/update-version-timestamp.js && turbo vsix --log-order grouped --output-logs new-only",
|
||||
"clean": "turbo clean --log-order grouped --output-logs new-only && rimraf dist out bin .vite-port .turbo",
|
||||
"install:vsix": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix && node scripts/install-vsix.js",
|
||||
"install:vsix:timestamp": "pnpm install --frozen-lockfile && pnpm clean && pnpm vsix:timestamp && node scripts/install-vsix.js",
|
||||
"changeset:version": "cp CHANGELOG.md src/CHANGELOG.md && changeset version && cp -vf src/CHANGELOG.md .",
|
||||
"knip": "knip --include files",
|
||||
"update-contributors": "node scripts/update-contributors.js",
|
||||
|
|
|
|||
40
scripts/update-version-timestamp.js
Executable file
40
scripts/update-version-timestamp.js
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
/**
|
||||
* Updates the version in package.json with a timestamp suffix
|
||||
*/
|
||||
function updateVersionWithTimestamp() {
|
||||
const packageJsonPath = path.join(__dirname, "../src/package.json")
|
||||
|
||||
try {
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"))
|
||||
const currentVersion = packageJson.version
|
||||
const versionMatch = currentVersion.match(/^(\d+\.\d+\.\d+)/)
|
||||
const baseVersion = versionMatch ? versionMatch[1] : currentVersion
|
||||
const now = new Date()
|
||||
const month = String(now.getMonth() + 1).padStart(2, "0")
|
||||
const day = String(now.getDate()).padStart(2, "0")
|
||||
const year = now.getFullYear()
|
||||
const hours = String(now.getHours()).padStart(2, "0")
|
||||
const minutes = String(now.getMinutes()).padStart(2, "0")
|
||||
const seconds = String(now.getSeconds()).padStart(2, "0")
|
||||
const timestamp = `${month}${day}${year}-${hours}${minutes}${seconds}`
|
||||
const newVersion = `${baseVersion}-${timestamp}`
|
||||
packageJson.version = newVersion
|
||||
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, "\t"))
|
||||
console.log(`Version updated from ${currentVersion} to ${newVersion}`)
|
||||
return newVersion
|
||||
} catch (error) {
|
||||
console.error("Error updating version with timestamp:", error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
updateVersionWithTimestamp()
|
||||
}
|
||||
|
||||
module.exports = { updateVersionWithTimestamp }
|
||||
Loading…
Add table
Reference in a new issue