forked from transloadit/uppy
/
interactive.js
executable file
·28 lines (24 loc) · 1.27 KB
/
interactive.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env node
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import pickSemverness from './choose-semverness.js'
import commit from './commit-and-open-pr.js'
import formatChangeLog from './formatChangeLog.js'
import { validateGitStatus, rewindGitHistory } from './getUpToDateRefsFromGitHub.js'
const ROOT = new URL('../../', import.meta.url)
const spawnOptions = { cwd: fileURLToPath(ROOT) }
const deferredReleaseFile = new URL('./.yarn/versions/next.yml', ROOT)
const temporaryChangeLog = new URL('./CHANGELOG.next.md', ROOT)
console.log('Validating local repo status and get previous release info...')
const [LAST_RELEASE_COMMIT, LOCAL_HEAD, MERGE_BASE, STABLE_HEAD] = await validateGitStatus(spawnOptions)
try {
console.log('Local git repository is ready, starting release process...')
await pickSemverness(spawnOptions, LAST_RELEASE_COMMIT, MERGE_BASE, deferredReleaseFile, process.env.PACKAGES.split(' '))
console.log('Working on the changelog...')
await formatChangeLog(spawnOptions, LAST_RELEASE_COMMIT, temporaryChangeLog)
console.log('Final step...')
await commit(spawnOptions, STABLE_HEAD, deferredReleaseFile, temporaryChangeLog)
} finally {
console.log('Rewinding git history...')
await rewindGitHistory(spawnOptions, LOCAL_HEAD)
}