From cb912c3c0cf6dc117287451952587c84f3d306ab Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Mon, 18 Oct 2021 15:11:17 +0200 Subject: [PATCH] fix(nuxi): update version and vite detection (#1169) --- docs/package.json | 2 +- package.json | 4 ++-- packages/kit/package.json | 2 +- packages/nitro/package.json | 2 +- packages/nuxi/package.json | 2 +- packages/nuxi/src/commands/info.ts | 17 ++++++++++++----- yarn.lock | 16 ++++++++-------- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/docs/package.json b/docs/package.json index d45d598ab2..66fde23a1a 100644 --- a/docs/package.json +++ b/docs/package.json @@ -15,7 +15,7 @@ "@nuxt/kit": "link:../packages/kit", "@nuxt/typescript-build": "^2.1.0", "fs-extra": "^10.0.0", - "jiti": "^1.12.7", + "jiti": "^1.12.8", "pathe": "^0.2.0", "rimraf": "^3.0.2", "scule": "^0.2.1", diff --git a/package.json b/package.json index c97ee31e3c..6dadd8b620 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "resolutions": { "nuxt3": "workspace:./packages/nuxt3", "unbuild": "^0.5.7", - "jiti": "^1.12.7" + "jiti": "^1.12.8" }, "devDependencies": { "@nuxtjs/eslint-config": "^6.0.1", @@ -44,7 +44,7 @@ "eslint-plugin-jsdoc": "^36.1.1", "execa": "^5.1.1", "globby": "^11.0.4", - "jiti": "^1.12.7", + "jiti": "^1.12.8", "lerna": "^4.0.0", "miniflare": "^1.4.1", "mocha": "^9.1.3", diff --git a/packages/kit/package.json b/packages/kit/package.json index f850bf7138..49d3cfa8f9 100644 --- a/packages/kit/package.json +++ b/packages/kit/package.json @@ -26,7 +26,7 @@ "globby": "^11.0.4", "hash-sum": "^2.0.0", "hookable": "^5.0.0", - "jiti": "^1.12.7", + "jiti": "^1.12.8", "lodash.template": "^4.5.0", "mlly": "^0.2.9", "pathe": "^0.2.0", diff --git a/packages/nitro/package.json b/packages/nitro/package.json index 9d8f6bb0b8..641fd79d6c 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -47,7 +47,7 @@ "hookable": "^5.0.0", "http-proxy": "^1.18.1", "is-primitive": "^3.0.1", - "jiti": "^1.12.7", + "jiti": "^1.12.8", "listhen": "^0.2.5", "mime": "^2.5.2", "mlly": "^0.2.9", diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index b6959c0a2e..69665392ae 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -35,7 +35,7 @@ "deep-object-diff": "^1.1.0", "destr": "^1.1.0", "flat": "^5.0.2", - "jiti": "^1.12.7", + "jiti": "^1.12.8", "listhen": "^0.2.5", "mlly": "^0.2.9", "mri": "^1.2.0", diff --git a/packages/nuxi/src/commands/info.ts b/packages/nuxi/src/commands/info.ts index 7cb2bb686b..a958c30276 100644 --- a/packages/nuxi/src/commands/info.ts +++ b/packages/nuxi/src/commands/info.ts @@ -37,12 +37,19 @@ export default defineNuxtCommand({ }) .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 = { OperatingSystem: os.type(), NodeVersion: process.version, - NuxtVersion: getDepVersion('nuxt') || getDepVersion('nuxt-edge') || (getDepVersion('nuxt3') ? '3-' + getDepVersion('nuxt3') : null), + NuxtVersion: nuxtVersion, 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(', '), RuntimeModules: listModules(nuxtConfig.modules), BuildModules: listModules(nuxtConfig.buildModules) @@ -65,12 +72,12 @@ export default defineNuxtCommand({ const splitter = '------------------------------' 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 repo = isNuxt3 ? 'nuxt/framework' : 'nuxt/nuxt.js' + const isNuxt3OrBridge = infoObj.NuxtVersion.startsWith('3') || infoObj.BuildModules.includes('bridge') + const repo = isNuxt3OrBridge ? 'nuxt/framework' : 'nuxt/nuxt.js' console.log([ `👉 Report an issue: https://github.com/${repo}/issues/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') } }) diff --git a/yarn.lock b/yarn.lock index 58bac4f80a..5390c153ef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2589,7 +2589,7 @@ __metadata: globby: ^11.0.4 hash-sum: ^2.0.0 hookable: ^5.0.0 - jiti: ^1.12.7 + jiti: ^1.12.8 lodash.template: ^4.5.0 mlly: ^0.2.9 pathe: ^0.2.0 @@ -2660,7 +2660,7 @@ __metadata: hookable: ^5.0.0 http-proxy: ^1.18.1 is-primitive: ^3.0.1 - jiti: ^1.12.7 + jiti: ^1.12.8 listhen: ^0.2.5 mime: ^2.5.2 mlly: ^0.2.9 @@ -11616,12 +11616,12 @@ fsevents@~2.3.2: languageName: node linkType: hard -"jiti@npm:^1.12.7": - version: 1.12.7 - resolution: "jiti@npm:1.12.7" +"jiti@npm:^1.12.8": + version: 1.12.8 + resolution: "jiti@npm:1.12.8" bin: jiti: bin/jiti.js - checksum: e5a16f0245db6e12912b2aa16b739d699630005e376345311a745253ce74cf4f7ac0b19dfe88edd42e93b7322355921fa7460aaa5c32348ed69e3428557e2a52 + checksum: 86c130f6f0609c316d831498a34433d17692172d9237e903b3d0844465a8b782b9424f4d4c445050e048d9934fcc6013416a0f24c614f74dbb89506222730171 languageName: node linkType: hard @@ -13685,7 +13685,7 @@ fsevents@~2.3.2: destr: ^1.1.0 flat: ^5.0.2 fsevents: ~2.3.2 - jiti: ^1.12.7 + jiti: ^1.12.8 listhen: ^0.2.5 mlly: ^0.2.9 mri: ^1.2.0 @@ -13722,7 +13722,7 @@ fsevents@~2.3.2: eslint-plugin-jsdoc: ^36.1.1 execa: ^5.1.1 globby: ^11.0.4 - jiti: ^1.12.7 + jiti: ^1.12.8 lerna: ^4.0.0 miniflare: ^1.4.1 mocha: ^9.1.3