From 9a217bf77c61b0d67d40cb1dab035f78181db2bd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 12 Oct 2023 13:29:12 +0100 Subject: [PATCH 1/2] chore: support `-nightly` nuxt releases and publish `nuxi-nightly` --- .github/workflows/ci.yml | 2 +- src/commands/info.ts | 1 + src/commands/test.ts | 4 ++-- src/utils/banner.ts | 4 ++-- src/utils/kit.ts | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4782e113..f7022600 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: !contains(github.event.head_commit.message, 'docs') run: | echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc && - pnpm changelogen --canary edge --publish + pnpm changelogen --canary nightly --publish env: NPM_TOKEN: ${{secrets.NPM_TOKEN}} NPM_CONFIG_PROVENANCE: false diff --git a/src/commands/info.ts b/src/commands/info.ts index e4335a37..66b7578e 100644 --- a/src/commands/info.ts +++ b/src/commands/info.ts @@ -56,6 +56,7 @@ export default defineCommand({ // Check nuxt version const nuxtVersion = getDepVersion('nuxt') || + getDepVersion('nuxt-nightly') || getDepVersion('nuxt-edge') || getDepVersion('nuxt3') || '-' diff --git a/src/commands/test.ts b/src/commands/test.ts index ac9d73ee..47a2f08e 100644 --- a/src/commands/test.ts +++ b/src/commands/test.ts @@ -42,7 +42,7 @@ export default defineCommand({ // @ts-ignore TODO async function importTestUtils(): Promise { let err - for (const pkg of ['@nuxt/test-utils-edge', '@nuxt/test-utils']) { + for (const pkg of ['@nuxt/test-utils-nightly', '@nuxt/test-utils-edge', '@nuxt/test-utils']) { try { const exports = await import(pkg) // Detect old @nuxt/test-utils @@ -56,6 +56,6 @@ async function importTestUtils(): Promise { } console.error(err) throw new Error( - '`@nuxt/test-utils-edge` seems missing. Run `npm i -D @nuxt/test-utils-edge` or `yarn add -D @nuxt/test-utils-edge` to install.', + '`@nuxt/test-utils` seems missing. Run `npm i -D @nuxt/test-utils` or `yarn add -D @nuxt/test-utils` to install.', ) } diff --git a/src/utils/banner.ts b/src/utils/banner.ts index 2efecf79..102e0232 100644 --- a/src/utils/banner.ts +++ b/src/utils/banner.ts @@ -5,8 +5,8 @@ export function showVersions(cwd: string) { const getPkgVersion = (pkg: string) => { return tryRequireModule(`${pkg}/package.json`, cwd)?.version || '' } - const nuxtVersion = getPkgVersion('nuxt') || getPkgVersion('nuxt-edge') - const nitroVersion = getPkgVersion('nitropack') + const nuxtVersion = getPkgVersion('nuxt') || getPkgVersion('nuxt-nightly') || getPkgVersion('nuxt3') || getPkgVersion('nuxt-edge') + const nitroVersion = getPkgVersion('nitropack') || getPkgVersion('nitropack-edge') console.log( gray( green(`Nuxt ${bold(nuxtVersion)}`) + diff --git a/src/utils/kit.ts b/src/utils/kit.ts index e511af5b..7cddcd7c 100644 --- a/src/utils/kit.ts +++ b/src/utils/kit.ts @@ -31,7 +31,7 @@ export const loadKit = async ( } async function tryResolveNuxt() { - for (const pkg of ['nuxt3', 'nuxt', 'nuxt-edge']) { + for (const pkg of ['nuxt-nightly', 'nuxt3', 'nuxt', 'nuxt-edge']) { const path = await tryResolveModule(pkg) if (path) { return path From 57e07fe1021488421fe36e7bf931e3003b197197 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Thu, 12 Oct 2023 12:30:24 +0000 Subject: [PATCH 2/2] [autofix.ci] apply automated fixes --- src/commands/test.ts | 6 +++++- src/utils/banner.ts | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/commands/test.ts b/src/commands/test.ts index 47a2f08e..2b4460c7 100644 --- a/src/commands/test.ts +++ b/src/commands/test.ts @@ -42,7 +42,11 @@ export default defineCommand({ // @ts-ignore TODO async function importTestUtils(): Promise { let err - for (const pkg of ['@nuxt/test-utils-nightly', '@nuxt/test-utils-edge', '@nuxt/test-utils']) { + for (const pkg of [ + '@nuxt/test-utils-nightly', + '@nuxt/test-utils-edge', + '@nuxt/test-utils', + ]) { try { const exports = await import(pkg) // Detect old @nuxt/test-utils diff --git a/src/utils/banner.ts b/src/utils/banner.ts index 102e0232..4ab4c141 100644 --- a/src/utils/banner.ts +++ b/src/utils/banner.ts @@ -5,8 +5,13 @@ export function showVersions(cwd: string) { const getPkgVersion = (pkg: string) => { return tryRequireModule(`${pkg}/package.json`, cwd)?.version || '' } - const nuxtVersion = getPkgVersion('nuxt') || getPkgVersion('nuxt-nightly') || getPkgVersion('nuxt3') || getPkgVersion('nuxt-edge') - const nitroVersion = getPkgVersion('nitropack') || getPkgVersion('nitropack-edge') + const nuxtVersion = + getPkgVersion('nuxt') || + getPkgVersion('nuxt-nightly') || + getPkgVersion('nuxt3') || + getPkgVersion('nuxt-edge') + const nitroVersion = + getPkgVersion('nitropack') || getPkgVersion('nitropack-edge') console.log( gray( green(`Nuxt ${bold(nuxtVersion)}`) +