refactor!: rename nuxt3 to nuxt (#4449)

This commit is contained in:
pooya parsa 2022-04-20 10:52:39 +02:00 committed by GitHub
parent 896d1404a3
commit 4712e99411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
164 changed files with 130 additions and 132 deletions

View File

@ -27,13 +27,13 @@
{ {
"zones": [ "zones": [
{ {
"from": "packages/nuxt3/src/!(core)/**/*", "from": "packages/nuxt/src/!(core)/**/*",
"target": "packages/nuxt3/src/core", "target": "packages/nuxt/src/core",
"message": "core should not directly import from modules." "message": "core should not directly import from modules."
}, },
{ {
"from": "packages/nuxt3/src/!(app)/**/*", "from": "packages/nuxt/src/!(app)/**/*",
"target": "packages/nuxt3/src/app", "target": "packages/nuxt/src/app",
"message": "app should not directly import from modules." "message": "app should not directly import from modules."
}, },
{ {

View File

@ -42,19 +42,19 @@ Open a terminal, or from [Visual Studio Code](https://code.visualstudio.com/), o
::code-group ::code-group
```bash [npx] ```bash [npx]
npx nuxi init nuxt3-app npx nuxi init nuxt-app
``` ```
```bash [pnpm] ```bash [pnpm]
pnpm dlx nuxi init nuxt3-app pnpm dlx nuxi init nuxt-app
``` ```
:: ::
Open `nuxt3-app` folder in visual studio code: Open `nuxt-app` folder in visual studio code:
```bash ```bash
code nuxt3-app code nuxt-app
``` ```
Install the dependencies: Install the dependencies:

View File

@ -25,7 +25,7 @@ On top of this setup, Nuxt provides a [directory structure](/guide/directory-str
Nuxt is composed of different [core packages](https://github.com/nuxt/framework/tree/main/packages): Nuxt is composed of different [core packages](https://github.com/nuxt/framework/tree/main/packages):
::list{type=info} ::list{type=info}
- Core Engine: [nuxt3](https://github.com/nuxt/framework/tree/main/packages/nuxt3) - Core Engine: [nuxt](https://github.com/nuxt/framework/tree/main/packages/nuxt)
- Bundlers: [@nuxt/vite-builder](https://github.com/nuxt/framework/tree/main/packages/vite) and [@nuxt/webpack-builder](https://github.com/nuxt/framework/tree/main/packages/webpack) - Bundlers: [@nuxt/vite-builder](https://github.com/nuxt/framework/tree/main/packages/vite) and [@nuxt/webpack-builder](https://github.com/nuxt/framework/tree/main/packages/webpack)
- Command line interface: [nuxi](https://github.com/nuxt/framework/tree/main/packages/nuxi) - Command line interface: [nuxi](https://github.com/nuxt/framework/tree/main/packages/nuxi)
- Server engine: [nitro](https://github.com/unjs/nitro) - Server engine: [nitro](https://github.com/unjs/nitro)

View File

@ -9,7 +9,7 @@ head.title: Nuxt configuration file
Nuxt can be easily configured with a single `nuxt.config` file, which can have either a `.js`, `.ts` or `.mjs` extension. Nuxt can be easily configured with a single `nuxt.config` file, which can have either a `.js`, `.ts` or `.mjs` extension.
```ts ```ts
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
// My Nuxt config // My Nuxt config

View File

@ -66,8 +66,8 @@ const MyButton = resolveComponent('MyButton')
Alternatively, though not recommended, you can register all your components globally, which will create async chunks for all your components and make them available throughout your application. Alternatively, though not recommended, you can register all your components globally, which will create async chunks for all your components and make them available throughout your application.
```diff ```diff
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
components: { components: {
+ global: true, + global: true,

View File

@ -14,7 +14,7 @@ Therefore only one instance of Nuxt is allowed to run per process.
To extend the Nuxt interface and hook into different stages of the build process, we can use [Nuxt Modules](/guide/going-further/modules). To extend the Nuxt interface and hook into different stages of the build process, we can use [Nuxt Modules](/guide/going-further/modules).
For more details, check out [the source code](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/core/nuxt.ts). For more details, check out [the source code](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/core/nuxt.ts).
## The NuxtApp interface ## The NuxtApp interface
@ -38,7 +38,7 @@ const nuxtApp = {
vueApp, // the global Vue application: https://vuejs.org/api/application.html#application-api vueApp, // the global Vue application: https://vuejs.org/api/application.html#application-api
// These let you call and add runtime NuxtApp hooks // These let you call and add runtime NuxtApp hooks
// https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/app/nuxt.ts#L18 // https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/nuxt.ts#L18
hooks, hooks,
hook, hook,
callHook, callHook,
@ -63,7 +63,7 @@ const nuxtApp = {
} }
``` ```
For more details, check out [the source code](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/app/nuxt.ts). For more details, check out [the source code](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/nuxt.ts).
## Runtime Context vs. Build Context ## Runtime Context vs. Build Context

View File

@ -117,7 +117,7 @@ If you encounter these errors, the issue is almost certainly with the upstream l
In the meantime, you can tell Nuxt not to try to import these libraries by adding them to `build.transpile`: In the meantime, you can tell Nuxt not to try to import these libraries by adding them to `build.transpile`:
```js ```js
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
build: { build: {
@ -133,7 +133,7 @@ You may find that you _also_ need to add other packages that are being imported
In some cases, you may also need to manually alias the library to the CJS version, for example: In some cases, you may also need to manually alias the library to the CJS version, for example:
```js ```js
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
alias: { alias: {

View File

@ -148,7 +148,7 @@ To test the modules we create, we could set up some Nuxt apps as fixtures and te
```ts ```ts
// nuxt.config.js // nuxt.config.js
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
import MyModule from '../../src' import MyModule from '../../src'
export default defineNuxtConfig({ export default defineNuxtConfig({

View File

@ -5,7 +5,7 @@
# App Hooks (runtime) # App Hooks (runtime)
Check the [app source code](https://github.com/nuxt/framework/blob/main/packages/nuxt3/src/app/nuxt.ts#L18) for all available hooks. Check the [app source code](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/nuxt.ts#L18) for all available hooks.
Hook | Arguments | Description Hook | Arguments | Description
-----------------------|-------------------|--------------- -----------------------|-------------------|---------------

View File

@ -26,7 +26,7 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
``` ```
```ts [Nuxt 3] ```ts [Nuxt 3]
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
// ... // ...
@ -50,7 +50,7 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
``` ```
```ts [Nuxt 3] ```ts [Nuxt 3]
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
hooks: { hooks: {

View File

@ -21,7 +21,7 @@ When referencing these variables within your components, you will have to use th
::code-group ::code-group
```ts [nuxt.config.ts] ```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
runtimeConfig: { runtimeConfig: {

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
autoImports: { autoImports: {

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
extends: [ extends: [

View File

@ -3,7 +3,7 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
}, },
"scripts": { "scripts": {
"dev": "nuxi dev", "dev": "nuxi dev",

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
components: [ components: [

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
}) })

View File

@ -7,6 +7,6 @@
"start": "nuxi preview" "start": "nuxi preview"
}, },
"devDependencies": { "devDependencies": {
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
}) })

View File

@ -7,6 +7,6 @@
"start": "nuxi preview" "start": "nuxi preview"
}, },
"devDependencies": { "devDependencies": {
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
nitro: { nitro: {

View File

@ -3,7 +3,7 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
}, },
"scripts": { "scripts": {
"dev": "nuxi dev", "dev": "nuxi dev",

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -1,4 +1,4 @@
import { defineNuxtConfig } from 'nuxt3' import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({ export default defineNuxtConfig({
modules: [ modules: [

View File

@ -8,6 +8,6 @@
}, },
"devDependencies": { "devDependencies": {
"@nuxt/ui": "^0.1.0", "@nuxt/ui": "^0.1.0",
"nuxt3": "latest" "nuxt": "npm:nuxt3@latest"
} }
} }

View File

@ -32,7 +32,7 @@
"resolutions": { "resolutions": {
"jiti": "^1.13.0", "jiti": "^1.13.0",
"nitropack-dev": "link:../nitropack", "nitropack-dev": "link:../nitropack",
"nuxt3": "workspace:./packages/nuxt3", "nuxt": "workspace:./packages/nuxt",
"vite": "^2.9.5", "vite": "^2.9.5",
"unbuild": "^0.7.4" "unbuild": "^0.7.4"
}, },

View File

@ -27,7 +27,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Apply dev as config override // Apply dev as config override
opts.overrides.dev = !!opts.dev opts.overrides.dev = !!opts.dev
const nearestNuxtPkg = await Promise.all(['nuxt3', 'nuxt-edge', 'nuxt'] const nearestNuxtPkg = await Promise.all(['nuxt3', 'nuxt', 'nuxt-edge']
.map(pkg => resolvePackageJSON(pkg, { url: opts.cwd }).catch(() => null))) .map(pkg => resolvePackageJSON(pkg, { url: opts.cwd }).catch(() => null)))
.then(r => r.filter(Boolean).sort((a, b) => b.length - a.length)[0]) .then(r => r.filter(Boolean).sort((a, b) => b.length - a.length)[0])
if (!nearestNuxtPkg) { if (!nearestNuxtPkg) {
@ -38,7 +38,7 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise<Nuxt> {
// Nuxt 3 // Nuxt 3
if (majorVersion === 3) { if (majorVersion === 3) {
const { loadNuxt } = await importModule('nuxt3', resolveOpts) const { loadNuxt } = await importModule(pkg.name, resolveOpts)
const nuxt = await loadNuxt(opts) const nuxt = await loadNuxt(opts)
return nuxt return nuxt
} }
@ -61,11 +61,11 @@ export async function buildNuxt (nuxt: Nuxt): Promise<any> {
// Nuxt 3 // Nuxt 3
if (nuxt.options._majorVersion === 3) { if (nuxt.options._majorVersion === 3) {
const { build } = await importModule('nuxt3', resolveOpts) const { build } = await tryImportModule('nuxt3', resolveOpts) || await importModule('nuxt', resolveOpts)
return build(nuxt) return build(nuxt)
} }
// Nuxt 2 // Nuxt 2
const { build } = await tryImportModule('nuxt-edge', resolveOpts) || await tryImportModule('nuxt', resolveOpts) const { build } = await tryImportModule('nuxt-edge', resolveOpts) || await importModule('nuxt', resolveOpts)
return build(nuxt) return build(nuxt)
} }

View File

@ -7,10 +7,10 @@ import { getPackageManager, packageManagerLocks } from '../utils/packageManagers
import { defineNuxtCommand } from './index' import { defineNuxtCommand } from './index'
async function getNuxtVersion (paths: string | string[]) { async function getNuxtVersion (paths: string | string[]) {
const pkgJson = resolveModule('nuxt3/package.json', paths) const pkgJson = resolveModule('nuxt/package.json', paths)
const pkg = pkgJson && JSON.parse(await fsp.readFile(pkgJson, 'utf8')) const pkg = pkgJson && JSON.parse(await fsp.readFile(pkgJson, 'utf8'))
if (!pkg.version) { if (!pkg.version) {
consola.warn('Cannot find any installed nuxt3 versions in ', paths) consola.warn('Cannot find any installed nuxt versions in ', paths)
} }
return pkg.version || '0.0.0' return pkg.version || '0.0.0'
} }
@ -19,7 +19,7 @@ export default defineNuxtCommand({
meta: { meta: {
name: 'upgrade', name: 'upgrade',
usage: 'npx nuxi upgrade [--force|-f]', usage: 'npx nuxi upgrade [--force|-f]',
description: 'Upgrade nuxt3' description: 'Upgrade nuxt'
}, },
async invoke (args) { async invoke (args) {
const rootDir = resolve(args._[0] || '.') const rootDir = resolve(args._[0] || '.')
@ -47,14 +47,14 @@ export default defineNuxtCommand({
await Promise.all(['node_modules/.cache', resolve(rootDir, '.nuxt'), 'node_modules/.vite'].map((path) => { await Promise.all(['node_modules/.cache', resolve(rootDir, '.nuxt'), 'node_modules/.vite'].map((path) => {
return existsSync(path) ? fsp.rm(path, { recursive: true }) : undefined return existsSync(path) ? fsp.rm(path, { recursive: true }) : undefined
})) }))
execSync(`${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} -D nuxt3@latest`, { stdio: 'inherit' }) execSync(`${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} -D nuxt@latest`, { stdio: 'inherit' })
} }
const upgradedVersion = await getNuxtVersion(rootDir) const upgradedVersion = await getNuxtVersion(rootDir)
consola.info('Upgraded nuxt version:', upgradedVersion) consola.info('Upgraded nuxt version:', upgradedVersion)
if (upgradedVersion === currentVersion) { if (upgradedVersion === currentVersion) {
consola.success('You\'re already using the latest version of nuxt3.') consola.success('You\'re already using the latest version of nuxt.')
} else { } else {
consola.success('Successfully upgraded nuxt from', currentVersion, 'to', upgradedVersion) consola.success('Successfully upgraded nuxt from', currentVersion, 'to', upgradedVersion)
const commitA = currentVersion.split('.').pop() const commitA = currentVersion.split('.').pop()

View File

@ -1,5 +1,5 @@
{ {
"name": "nuxt3", "name": "nuxt",
"version": "3.0.0", "version": "3.0.0",
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",

Some files were not shown because too many files have changed in this diff Show More