Skip to content

Commit

Permalink
fix: support -nightly nuxt releases and publish nuxi-nightly (#248)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Oct 12, 2023
1 parent 6268e86 commit 393b07e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default defineCommand({
// Check nuxt version
const nuxtVersion =
getDepVersion('nuxt') ||
getDepVersion('nuxt-nightly') ||
getDepVersion('nuxt-edge') ||
getDepVersion('nuxt3') ||
'-'
Expand Down
8 changes: 6 additions & 2 deletions src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export default defineCommand({
// @ts-ignore TODO
async function importTestUtils(): Promise<typeof import('@nuxt/test-utils')> {
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
Expand All @@ -56,6 +60,6 @@ async function importTestUtils(): Promise<typeof import('@nuxt/test-utils')> {
}
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.',
)
}
9 changes: 7 additions & 2 deletions src/utils/banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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-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)}`) +
Expand Down
2 changes: 1 addition & 1 deletion src/utils/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 393b07e

Please sign in to comment.