fix(nuxi): forward nuxi generate to nuxt on nuxt 2 (#1571)

This commit is contained in:
Anthony Fu 2021-10-29 18:42:55 +08:00 committed by GitHub
parent 495aeffd74
commit c420e46efe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -11,15 +11,12 @@
"bin": {
"nuxi": "./bin/nuxi.mjs"
},
"scripts": {
"prepack": "unbuild"
},
"files": [
"bin",
"dist"
],
"optionalDependencies": {
"fsevents": "~2.3.2"
"scripts": {
"prepack": "unbuild"
},
"devDependencies": {
"@nuxt/design": "0.1.4",
@ -35,6 +32,7 @@
"consola": "^2.15.3",
"deep-object-diff": "^1.1.0",
"destr": "^1.1.0",
"execa": "^5.1.1",
"flat": "^5.0.2",
"jiti": "^1.12.9",
"listhen": "^0.2.5",
@ -45,14 +43,15 @@
"pkg-types": "^0.3.1",
"rimraf": "^3.0.2",
"scule": "^0.2.1",
"semver": "^7.3.5",
"superb": "^4.0.0",
"tiged": "^2.12.0",
"unbuild": "latest"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
},
"engines": {
"node": "^14.16.0 || ^16.11.0 || ^17.0.0"
},
"dependencies": {
"semver": "^7.3.5"
}
}

View File

@ -1,3 +1,4 @@
import execa from 'execa'
import { resolve } from 'pathe'
import { isNuxt3 } from '@nuxt/kit'
@ -20,7 +21,8 @@ export default defineNuxtCommand({
if (isNuxt3(nuxt)) {
throw new Error('`nuxt generate` is not supported in Nuxt 3. Please follow this RFC: https://git.io/JKfvx')
} else {
throw new Error('Please use `nuxt generate` for Nuxt 2 instead of `nuxi generate`')
// Forwards argv to `nuxt generate`
await execa('npx nuxt', process.argv.slice(2), { stdio: 'inherit' })
}
}
})

View File

@ -14343,6 +14343,7 @@ fsevents@~2.3.2:
consola: ^2.15.3
deep-object-diff: ^1.1.0
destr: ^1.1.0
execa: ^5.1.1
flat: ^5.0.2
fsevents: ~2.3.2
jiti: ^1.12.9