a8910e5491
Automated package publish had gotten broken because we lost all our git tags/releases. We fixed that, but also: * made releases come from huppy instead of david * swtiched from node's `execSync` to our `exec` for more debuggable output * cleaned up some of the scripts a little this diff has a lot of whitespace changes so you're best off reviewing it with whitespace changes hidden: https://github.com/tldraw/tldraw/pull/1338/files?diff=split&w=1
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { exec } from './lib/exec'
|
|
import { getLatestVersion, publish, setAllVersions } from './lib/publishing'
|
|
|
|
async function main() {
|
|
const sha = (await exec('git', ['rev-parse', 'HEAD'])).trim().slice(0, 12)
|
|
|
|
async function setCanaryVersions(bump: 'major' | 'minor' | 'patch') {
|
|
const latestVersion = getLatestVersion()
|
|
|
|
const nextVersion = latestVersion.prerelease.length
|
|
? // if the package is in prerelease mode, we want to release a canary for the current version rather than bumping
|
|
latestVersion
|
|
: latestVersion?.inc(bump)
|
|
const versionString = `${nextVersion.major}.${nextVersion.minor}.${nextVersion.patch}-canary.${sha}`
|
|
|
|
setAllVersions(versionString)
|
|
}
|
|
|
|
// module was called directly
|
|
const bumpType = (await exec('auto', ['version'])).trim() as 'major' | 'minor' | 'patch' | ''
|
|
|
|
console.log('bumpType', bumpType)
|
|
if (bumpType === '') {
|
|
console.log('nothing to do')
|
|
} else if (['major', 'minor', 'patch'].includes(bumpType)) {
|
|
console.log('setting canary versions')
|
|
setCanaryVersions(bumpType)
|
|
publish()
|
|
} else {
|
|
throw new Error('Invalid bump type provided')
|
|
}
|
|
}
|
|
|
|
main()
|