fix publishing scripts (#3006)

follow up to #2998 
### Change Type

- [ ] `patch` — Bug fix
- [ ] `minor` — New feature
- [ ] `major` — Breaking change
- [ ] `dependencies` — Changes to package dependencies[^1]
- [ ] `documentation` — Changes to the documentation only[^2]
- [ ] `tests` — Changes to any test code only[^2]
- [x] `internal` — Any other changes that don't affect the published
package[^2]
- [ ] I don't know

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Add a step-by-step description of how to test your PR here.
2.

- [ ] Unit Tests
- [ ] End to end tests

### Release Notes

- Add a brief release note for your PR here.
This commit is contained in:
David Sheldrick 2024-02-29 16:28:11 +00:00 committed by GitHub
parent a0628f9cb2
commit 3f5803729d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -75,8 +75,8 @@ export async function setAllVersions(version: string) {
execSync('yarn')
}
export function getLatestVersion() {
const packages = getAllPackageDetails()
export async function getLatestVersion() {
const packages = await getAllPackageDetails()
const allVersions = Object.values(packages).map((p) => parse(p.version)!)
allVersions.sort(compare)

View file

@ -6,7 +6,7 @@ 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 latestVersion = await 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

View file

@ -33,12 +33,12 @@ function getReleaseType(): ReleaseType {
throw new Error('Invalid bump argument ' + JSON.stringify(arg))
}
function getNextVersion(releaseType: ReleaseType): string {
async function getNextVersion(releaseType: ReleaseType): Promise<string> {
if (releaseType.bump === 'override') {
return releaseType.version.format()
}
const latestVersion = parse(getLatestVersion())!
const latestVersion = parse(await getLatestVersion())!
nicelog('latestVersion', latestVersion)
@ -68,7 +68,7 @@ async function main() {
}
const releaseType = getReleaseType()
const nextVersion = getNextVersion(releaseType)
const nextVersion = await getNextVersion(releaseType)
console.log('Releasing version', nextVersion)