mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
It didn't work in CI: https://github.com/transloadit/uppy/actions/runs/16771298008/job/47486827416#step:16:1 Instead of trying to hack in an extra commit, now a script runs on the `version` command, which resolves the versions based on changesets, which is ran before `publish` so it should become part of the changeset commit (hopefully)
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { execSync } from 'node:child_process'
|
|
import { readFileSync, writeFileSync } from 'node:fs'
|
|
|
|
// Get the current uppy version
|
|
const packageJsonOutput = execSync(
|
|
'yarn workspace uppy exec npm pkg get version',
|
|
{ encoding: 'utf8' },
|
|
)
|
|
const versionMatch = packageJsonOutput.match(/"([0-9]+\.[0-9]+\.[0-9]+)"/)
|
|
|
|
if (!versionMatch) {
|
|
console.log('Could not extract version from package.json')
|
|
process.exit(1)
|
|
}
|
|
|
|
const version = versionMatch[1]
|
|
|
|
// Update README.md
|
|
const readme = readFileSync('README.md', 'utf8')
|
|
const updatedReadme = readme.replace(
|
|
/https:\/\/releases\.transloadit\.com\/uppy\/v[0-9]+\.[0-9]+\.[0-9]+\//g,
|
|
`https://releases.transloadit.com/uppy/v${version}/`,
|
|
)
|
|
|
|
if (readme !== updatedReadme) {
|
|
writeFileSync('README.md', updatedReadme)
|
|
console.log('Updated README.md')
|
|
} else {
|
|
console.log('README.md already up to date')
|
|
}
|
|
|
|
// Update BUNDLE-README.md
|
|
const bundleReadme = readFileSync('BUNDLE-README.md', 'utf8')
|
|
const updatedBundleReadme = bundleReadme.replace(
|
|
/https:\/\/releases\.transloadit\.com\/uppy\/v[0-9]+\.[0-9]+\.[0-9]+\//g,
|
|
`https://releases.transloadit.com/uppy/v${version}/`,
|
|
)
|
|
|
|
if (bundleReadme !== updatedBundleReadme) {
|
|
writeFileSync('BUNDLE-README.md', updatedBundleReadme)
|
|
console.log('Updated BUNDLE-README.md')
|
|
} else {
|
|
console.log('BUNDLE-README.md already up to date')
|
|
}
|