fix(nuxi): update version and vite detection (#1169)

This commit is contained in:
pooya parsa 2021-10-18 15:11:17 +02:00 committed by GitHub
parent dbbce5fcfa
commit cb912c3c0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 19 deletions

View File

@ -15,7 +15,7 @@
"@nuxt/kit": "link:../packages/kit", "@nuxt/kit": "link:../packages/kit",
"@nuxt/typescript-build": "^2.1.0", "@nuxt/typescript-build": "^2.1.0",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"jiti": "^1.12.7", "jiti": "^1.12.8",
"pathe": "^0.2.0", "pathe": "^0.2.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"scule": "^0.2.1", "scule": "^0.2.1",

View File

@ -28,7 +28,7 @@
"resolutions": { "resolutions": {
"nuxt3": "workspace:./packages/nuxt3", "nuxt3": "workspace:./packages/nuxt3",
"unbuild": "^0.5.7", "unbuild": "^0.5.7",
"jiti": "^1.12.7" "jiti": "^1.12.8"
}, },
"devDependencies": { "devDependencies": {
"@nuxtjs/eslint-config": "^6.0.1", "@nuxtjs/eslint-config": "^6.0.1",
@ -44,7 +44,7 @@
"eslint-plugin-jsdoc": "^36.1.1", "eslint-plugin-jsdoc": "^36.1.1",
"execa": "^5.1.1", "execa": "^5.1.1",
"globby": "^11.0.4", "globby": "^11.0.4",
"jiti": "^1.12.7", "jiti": "^1.12.8",
"lerna": "^4.0.0", "lerna": "^4.0.0",
"miniflare": "^1.4.1", "miniflare": "^1.4.1",
"mocha": "^9.1.3", "mocha": "^9.1.3",

View File

@ -26,7 +26,7 @@
"globby": "^11.0.4", "globby": "^11.0.4",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"hookable": "^5.0.0", "hookable": "^5.0.0",
"jiti": "^1.12.7", "jiti": "^1.12.8",
"lodash.template": "^4.5.0", "lodash.template": "^4.5.0",
"mlly": "^0.2.9", "mlly": "^0.2.9",
"pathe": "^0.2.0", "pathe": "^0.2.0",

View File

@ -47,7 +47,7 @@
"hookable": "^5.0.0", "hookable": "^5.0.0",
"http-proxy": "^1.18.1", "http-proxy": "^1.18.1",
"is-primitive": "^3.0.1", "is-primitive": "^3.0.1",
"jiti": "^1.12.7", "jiti": "^1.12.8",
"listhen": "^0.2.5", "listhen": "^0.2.5",
"mime": "^2.5.2", "mime": "^2.5.2",
"mlly": "^0.2.9", "mlly": "^0.2.9",

View File

@ -35,7 +35,7 @@
"deep-object-diff": "^1.1.0", "deep-object-diff": "^1.1.0",
"destr": "^1.1.0", "destr": "^1.1.0",
"flat": "^5.0.2", "flat": "^5.0.2",
"jiti": "^1.12.7", "jiti": "^1.12.8",
"listhen": "^0.2.5", "listhen": "^0.2.5",
"mlly": "^0.2.9", "mlly": "^0.2.9",
"mri": "^1.2.0", "mri": "^1.2.0",

View File

@ -37,12 +37,19 @@ export default defineNuxtCommand({
}) })
.join(', ') .join(', ')
// Check nuxt version
const nuxtVersion = getDepVersion('nuxt') || getDepVersion('nuxt-edge') || getDepVersion('nuxt3') || '0.0.0'
const isNuxt3 = nuxtVersion.startsWith('3')
const useVite = isNuxt3
? nuxtConfig.vite !== false
: (nuxtConfig?.buildModules?.find(m => m === 'nuxt-vite'))
const infoObj = { const infoObj = {
OperatingSystem: os.type(), OperatingSystem: os.type(),
NodeVersion: process.version, NodeVersion: process.version,
NuxtVersion: getDepVersion('nuxt') || getDepVersion('nuxt-edge') || (getDepVersion('nuxt3') ? '3-' + getDepVersion('nuxt3') : null), NuxtVersion: nuxtVersion,
PackageManager: getPackageManager(rootDir), PackageManager: getPackageManager(rootDir),
Bundler: (nuxtConfig.vite || nuxtConfig?.buildModules?.find(m => m === 'nuxt-vite')) ? 'Vite' : 'Webpack', Bundler: useVite ? 'Vite' : 'Webpack',
UserConfig: Object.keys(nuxtConfig).map(key => '`' + key + '`').join(', '), UserConfig: Object.keys(nuxtConfig).map(key => '`' + key + '`').join(', '),
RuntimeModules: listModules(nuxtConfig.modules), RuntimeModules: listModules(nuxtConfig.modules),
BuildModules: listModules(nuxtConfig.buildModules) BuildModules: listModules(nuxtConfig.buildModules)
@ -65,12 +72,12 @@ export default defineNuxtCommand({
const splitter = '------------------------------' const splitter = '------------------------------'
console.log(`Nuxt project info: ${copied ? '(copied to clipboard)' : ''}\n\n${splitter}\n${infoStr}${splitter}\n`) console.log(`Nuxt project info: ${copied ? '(copied to clipboard)' : ''}\n\n${splitter}\n${infoStr}${splitter}\n`)
const isNuxt3 = infoObj.NuxtVersion.startsWith('3') || infoObj.BuildModules.includes('bridge') const isNuxt3OrBridge = infoObj.NuxtVersion.startsWith('3') || infoObj.BuildModules.includes('bridge')
const repo = isNuxt3 ? 'nuxt/framework' : 'nuxt/nuxt.js' const repo = isNuxt3OrBridge ? 'nuxt/framework' : 'nuxt/nuxt.js'
console.log([ console.log([
`👉 Report an issue: https://github.com/${repo}/issues/new`, `👉 Report an issue: https://github.com/${repo}/issues/new`,
`👉 Suggest an improvement: https://github.com/${repo}/discussions/new`, `👉 Suggest an improvement: https://github.com/${repo}/discussions/new`,
`👉 Read documentation: ${isNuxt3 ? 'https://v3.nuxtjs.org' : 'https://nuxtjs.org'}` `👉 Read documentation: ${isNuxt3OrBridge ? 'https://v3.nuxtjs.org' : 'https://nuxtjs.org'}`
].join('\n\n') + '\n') ].join('\n\n') + '\n')
} }
}) })

View File

@ -2589,7 +2589,7 @@ __metadata:
globby: ^11.0.4 globby: ^11.0.4
hash-sum: ^2.0.0 hash-sum: ^2.0.0
hookable: ^5.0.0 hookable: ^5.0.0
jiti: ^1.12.7 jiti: ^1.12.8
lodash.template: ^4.5.0 lodash.template: ^4.5.0
mlly: ^0.2.9 mlly: ^0.2.9
pathe: ^0.2.0 pathe: ^0.2.0
@ -2660,7 +2660,7 @@ __metadata:
hookable: ^5.0.0 hookable: ^5.0.0
http-proxy: ^1.18.1 http-proxy: ^1.18.1
is-primitive: ^3.0.1 is-primitive: ^3.0.1
jiti: ^1.12.7 jiti: ^1.12.8
listhen: ^0.2.5 listhen: ^0.2.5
mime: ^2.5.2 mime: ^2.5.2
mlly: ^0.2.9 mlly: ^0.2.9
@ -11616,12 +11616,12 @@ fsevents@~2.3.2:
languageName: node languageName: node
linkType: hard linkType: hard
"jiti@npm:^1.12.7": "jiti@npm:^1.12.8":
version: 1.12.7 version: 1.12.8
resolution: "jiti@npm:1.12.7" resolution: "jiti@npm:1.12.8"
bin: bin:
jiti: bin/jiti.js jiti: bin/jiti.js
checksum: e5a16f0245db6e12912b2aa16b739d699630005e376345311a745253ce74cf4f7ac0b19dfe88edd42e93b7322355921fa7460aaa5c32348ed69e3428557e2a52 checksum: 86c130f6f0609c316d831498a34433d17692172d9237e903b3d0844465a8b782b9424f4d4c445050e048d9934fcc6013416a0f24c614f74dbb89506222730171
languageName: node languageName: node
linkType: hard linkType: hard
@ -13685,7 +13685,7 @@ fsevents@~2.3.2:
destr: ^1.1.0 destr: ^1.1.0
flat: ^5.0.2 flat: ^5.0.2
fsevents: ~2.3.2 fsevents: ~2.3.2
jiti: ^1.12.7 jiti: ^1.12.8
listhen: ^0.2.5 listhen: ^0.2.5
mlly: ^0.2.9 mlly: ^0.2.9
mri: ^1.2.0 mri: ^1.2.0
@ -13722,7 +13722,7 @@ fsevents@~2.3.2:
eslint-plugin-jsdoc: ^36.1.1 eslint-plugin-jsdoc: ^36.1.1
execa: ^5.1.1 execa: ^5.1.1
globby: ^11.0.4 globby: ^11.0.4
jiti: ^1.12.7 jiti: ^1.12.8
lerna: ^4.0.0 lerna: ^4.0.0
miniflare: ^1.4.1 miniflare: ^1.4.1
mocha: ^9.1.3 mocha: ^9.1.3