Skip to content

Commit

Permalink
feat(kit,nuxt,vite,webpack): support -nightly extension (#23508)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 12, 2023
1 parent 2e02e2c commit eb40409
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-pr.yml
Expand Up @@ -61,5 +61,5 @@ jobs:
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `:rocket: Release triggered! You can now install [nuxt@npm:nuxt3@pr-${{ github.event.issue.number }}](https://www.npmjs.com/package/nuxt3/v/pr-${{ github.event.issue.number }})`
body: `:rocket: Release triggered! You can now install [nuxt@npm:nuxt-nightly@pr-${{ github.event.issue.number }}](https://www.npmjs.com/package/nuxt-nightly/v/pr-${{ github.event.issue.number }})`
})
28 changes: 14 additions & 14 deletions docs/2.guide/3.going-further/11.edge-channel.md
@@ -1,56 +1,56 @@
---
title: "Edge Channel"
description: "Edge channel allows to use latest commits from the repository."
title: "Nightly Release Channel"
description: "The nightly release channel allows using Nuxt built directly from the latest commits to the repository."
---

# Edge Release Channel
# Nightly Release Channel

Nuxt 3 is landing commits, improvements, and bug fixes every day. You can opt-in to test them earlier before the next release.
Nuxt lands commits, improvements, and bug fixes every day. You can opt in to test them earlier before the next release.

After each commit is merged into the `main` branch of [nuxt/nuxt](https://github.com/nuxt/nuxt) and **passing all tests**, we trigger an automated npm release using GitHub Actions publishing Nuxt 3 packages.
After a commit is merged into the `main` branch of [nuxt/nuxt](https://github.com/nuxt/nuxt) and **passes all tests**, we trigger an automated npm release, using GitHub Actions.

You can opt in to use this release channel and avoid waiting for the next release and helping Nuxt by beta testing changes.
You can use these 'nightly' releases to beta test new features and changes.

The build and publishing method and quality of edge releases are the same as stable ones. The only difference is that you should often check the GitHub repository for updates. There is a slight chance of regressions not being caught during the review process and by the automated tests. Therefore, we internally use this channel to double-check everything before each release.
The build and publishing method and quality of these 'nightly' releases are the same as stable ones. The only difference is that you should often check the GitHub repository for updates. There is a slight chance of regressions not being caught during the review process and by the automated tests. Therefore, we internally use this channel to double-check everything before each release.

:::Alert
Features only available on the edge channel are marked with an alert in the documentation.
Features that are only available on the nightly release channel are marked with an alert in the documentation.
:::

## Opting Into the Edge Channel
## Opting Into the Nightly Release Channel

Update `nuxt` dependency inside `package.json`:

```diff [package.json]
{
"devDependencies": {
-- "nuxt": "^3.0.0"
++ "nuxt": "npm:nuxt3@latest"
++ "nuxt": "npm:nuxt-nightly@latest"
}
}
```

Remove lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`) and reinstall dependencies.

## Opting Out From the Edge Channel
## Opting Out From the Nightly Release Channel

Update `nuxt` dependency inside `package.json`:

```diff [package.json]
{
"devDependencies": {
-- "nuxt": "npm:nuxt3@latest"
-- "nuxt": "npm:nuxt-nightly@latest"
++ "nuxt": "^3.0.0"
}
}
```

Remove lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb`) and reinstall dependencies.

## Using Latest `nuxi` CLI From Edge
## Using Latest `nuxi` CLI From Nightly Release

:::Alert
All cli dependencies are bundled because of the building method for reducing `nuxi` package size. You can get dependency updates and CLI improvements using the edge channel.
All cli dependencies are bundled because of the building method for reducing `nuxi` package size. You can get dependency updates and CLI improvements using the nightly release channel.
:::

You can use `npx nuxi-edge@latest [command]` to try the latest version of the nuxi CLI.
4 changes: 2 additions & 2 deletions packages/kit/src/loader/nuxt.ts
Expand Up @@ -26,7 +26,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Apply dev as config override
opts.overrides.dev = !!opts.dev

const nearestNuxtPkg = await Promise.all(['nuxt3', 'nuxt', 'nuxt-edge']
const nearestNuxtPkg = await Promise.all(['nuxt-nightly', 'nuxt3', 'nuxt', 'nuxt-edge']
.map(pkg => resolvePackageJSON(pkg, { url: opts.cwd }).catch(() => null)))
.then(r => (r.filter(Boolean) as string[]).sort((a, b) => b.length - a.length)[0])
if (!nearestNuxtPkg) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export async function buildNuxt (nuxt: Nuxt): Promise<any> {

// Nuxt 3
if (nuxt.options._majorVersion === 3) {
const { build } = await tryImportModule('nuxt3', rootDir) || await importModule('nuxt', rootDir)
const { build } = await tryImportModule('nuxt-nightly', rootDir) || await tryImportModule('nuxt3', rootDir) || await importModule('nuxt', rootDir)
return build(nuxt)
}

Expand Down
1 change: 1 addition & 0 deletions packages/nuxt/src/core/nitro.ts
Expand Up @@ -155,6 +155,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
...nuxt.options.build.transpile.filter((i): i is string => typeof i === 'string'),
'nuxt/dist',
'nuxt3/dist',
'nuxt-nightly/dist',
distDir
],
traceInclude: [
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/src/core/plugins/import-protection.ts
Expand Up @@ -14,7 +14,7 @@ interface ImportProtectionOptions {
}

export const vueAppPatterns = (nuxt: Nuxt) => [
[/^(nuxt3|nuxt)$/, '`nuxt3`/`nuxt` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
[/^(nuxt|nuxt3|nuxt-nightly)$/, '`nuxt`/`nuxt3`/`nuxt-nightly` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
[/^((|~|~~|@|@@)\/)?nuxt\.config(\.|$)/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'],
[/(^|node_modules\/)@vue\/composition-api/],
...nuxt.options.modules.filter(m => typeof m === 'string').map((m: any) =>
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt/test/import-protection.test.ts
Expand Up @@ -11,6 +11,7 @@ const testsToTriggerOn = [
['.nuxt/nuxt.config', 'app.vue', false],
['nuxt', 'components/Component.vue', true],
['nuxt3', 'components/Component.vue', true],
['nuxt-nightly', 'components/Component.vue', true],
['/root/node_modules/@vue/composition-api', 'components/Component.vue', true],
['@vue/composition-api', 'components/Component.vue', true],
['@nuxt/kit', 'components/Component.vue', true],
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/plugins/composable-keys.ts
Expand Up @@ -18,7 +18,7 @@ interface ComposableKeysOptions {
}

const stringTypes = ['Literal', 'TemplateLiteral']
const NUXT_LIB_RE = /node_modules\/nuxt3?\//
const NUXT_LIB_RE = /node_modules\/(nuxt|nuxt3|nuxt-nightly)\//
const SUPPORTED_EXT_RE = /\.(m?[jt]sx?|vue)/

export const composableKeysPlugin = createUnplugin((options: ComposableKeysOptions) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/server.ts
Expand Up @@ -68,7 +68,7 @@ export async function buildServer (ctx: ViteBuildContext) {
'/__vue-jsx',
'#app',
/^nuxt(\/|$)/,
/(nuxt|nuxt3)\/(dist|src|app)/
/(nuxt|nuxt3|nuxt-nightly)\/(dist|src|app)/
]
},
cacheDir: resolve(ctx.nuxt.options.rootDir, 'node_modules/.cache/vite', 'server'),
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/vite-node.ts
Expand Up @@ -118,7 +118,7 @@ function createViteNodeApp (ctx: ViteBuildContext, invalidates: Set<string> = ne
const node: ViteNodeServer = new ViteNodeServer(viteServer, {
deps: {
inline: [
/\/node_modules\/(.*\/)?(nuxt|nuxt3)\//,
/\/node_modules\/(.*\/)?(nuxt|nuxt3|nuxt-nightly)\//,
/^#/,
...transpile({ isServer: true, isDev: ctx.nuxt.options.dev })
]
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/src/configs/server.ts
Expand Up @@ -47,6 +47,7 @@ function serverStandalone (ctx: WebpackConfigContext) {
'#app',
'nuxt',
'nuxt3',
'nuxt-nightly',
'!',
'-!',
'~',
Expand Down
4 changes: 2 additions & 2 deletions scripts/bump-edge.ts
Expand Up @@ -6,7 +6,7 @@ import { determineBumpType, loadWorkspace } from './_utils'
const nightlyPackages = {
nitropack: 'nitropack-edge',
h3: 'h3-nightly',
nuxi: 'nuxi-edge'
nuxi: 'nuxi-nightly'
}

async function main () {
Expand All @@ -27,7 +27,7 @@ async function main () {
pkg.data.dependencies[name] = `npm:${nightlyName}@latest`
}
}
const newname = pkg.data.name === 'nuxt' ? 'nuxt3' : (pkg.data.name + '-edge')
const newname = pkg.data.name + '-nightly'
workspace.rename(pkg.data.name, newname)
}

Expand Down

0 comments on commit eb40409

Please sign in to comment.