From 3f5803729d1ea11f53af4d2e9deb0b792bc2e0de Mon Sep 17 00:00:00 2001 From: David Sheldrick Date: Thu, 29 Feb 2024 16:28:11 +0000 Subject: [PATCH] fix publishing scripts (#3006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- scripts/lib/publishing.ts | 4 ++-- scripts/publish-canary.ts | 2 +- scripts/publish-new.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/lib/publishing.ts b/scripts/lib/publishing.ts index a7e63824f..eafe855eb 100644 --- a/scripts/lib/publishing.ts +++ b/scripts/lib/publishing.ts @@ -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) diff --git a/scripts/publish-canary.ts b/scripts/publish-canary.ts index 2f494dd09..99a12f3a8 100644 --- a/scripts/publish-canary.ts +++ b/scripts/publish-canary.ts @@ -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 diff --git a/scripts/publish-new.ts b/scripts/publish-new.ts index f47e3151e..0e3eadc84 100644 --- a/scripts/publish-new.ts +++ b/scripts/publish-new.ts @@ -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 { 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)