feat!: bump minimum node version to 18 (#14030)

This commit is contained in:
Bjorn Lu 2023-08-15 21:28:17 +08:00 committed by GitHub
parent 63a4451113
commit 2c1a45c86c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 27 additions and 30 deletions

View File

@ -1,6 +1,7 @@
// @ts-check
const { builtinModules } = require('node:module')
const { defineConfig } = require('eslint-define-config')
const pkg = require('./package.json')
module.exports = defineConfig({
root: true,
@ -16,7 +17,7 @@ module.exports = defineConfig({
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
ecmaVersion: 2022,
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
@ -173,13 +174,13 @@ module.exports = defineConfig({
'n/no-unsupported-features/es-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
version: pkg.engines.node,
},
],
'n/no-unsupported-features/node-builtins': [
'error',
{
version: '^14.18.0 || >=16.0.0',
version: pkg.engines.node,
},
],
'@typescript-eslint/explicit-module-boundary-types': 'off',

View File

@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node_version: [14, 16, 18, 20]
node_version: [18, 20]
include:
# Active LTS + other OS
- os: macos-latest
@ -67,14 +67,8 @@ jobs:
packages/create-vite/template**
**.md
- name: Install pnpm (node 14, pnpm 7)
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version == 14
uses: pnpm/action-setup@v2.4.0
with:
version: 7
- name: Install pnpm
if: steps.changed-files.outputs.only_changed != 'true' && matrix.node_version != 14
if: steps.changed-files.outputs.only_changed != 'true'
uses: pnpm/action-setup@v2.4.0
- name: Set node version to ${{ matrix.node_version }}

View File

@ -23,10 +23,10 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v2.4.0
- name: Set node version to 16.x
- name: Set node version to 18
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18
registry-url: https://registry.npmjs.org/
cache: "pnpm"

View File

@ -42,7 +42,7 @@ The supported template presets are:
## Scaffolding Your First Vite Project
::: tip Compatibility Note
Vite requires [Node.js](https://nodejs.org/en/) version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
Vite requires [Node.js](https://nodejs.org/en/) version 18+. 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
:::
::: code-group

View File

@ -1,5 +1,5 @@
[build.environment]
NODE_VERSION = "16"
NODE_VERSION = "18"
# don't need playwright for docs build
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"
[build]

View File

@ -3,7 +3,7 @@
"private": true,
"type": "module",
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"homepage": "https://vitejs.dev/",
"repository": {

View File

@ -3,7 +3,7 @@
## Scaffolding Your First Vite Project
> **Compatibility Note:**
> Vite requires [Node.js](https://nodejs.org/en/) version 14.18+, 16+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
> Vite requires [Node.js](https://nodejs.org/en/) version 18+, 20+. However, some templates require a higher Node.js version to work, please upgrade if your package manager warns about it.
With NPM:

View File

@ -11,11 +11,12 @@ export default defineBuildConfig({
rollup: {
inlineDependencies: true,
esbuild: {
target: 'node18',
minify: true,
},
},
alias: {
// we can always use non-transpiled code since we support 14.18.0+
// we can always use non-transpiled code since we support node 18+
prompts: 'prompts/lib/index.js',
},
hooks: {

View File

@ -20,7 +20,7 @@
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",

View File

@ -2,7 +2,7 @@
"include": ["build.config.ts", "src", "__tests__"],
"compilerOptions": {
"outDir": "dist",
"target": "ES2020",
"target": "ES2022",
"module": "ES2020",
"moduleResolution": "bundler",
"strict": true,

View File

@ -7,5 +7,8 @@ export default defineBuildConfig({
rollup: {
emitCJS: true,
inlineDependencies: true,
esbuild: {
target: 'node18',
},
},
})

View File

@ -29,7 +29,7 @@
"prepublishOnly": "npm run build"
},
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",

View File

@ -38,7 +38,7 @@
"types"
],
"engines": {
"node": "^14.18.0 || >=16.0.0"
"node": "^18.0.0 || >=20.0.0"
},
"repository": {
"type": "git",

View File

@ -1017,7 +1017,7 @@ async function bundleConfigFile(
entryPoints: [fileName],
outfile: 'out.js',
write: false,
target: ['node14.18', 'node16'],
target: ['node18'],
platform: 'node',
bundle: true,
format: isESM ? 'esm' : 'cjs',

View File

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,

View File

@ -3,7 +3,7 @@
"exclude": ["**/dist/**"],
"compilerOptions": {
"checkJs": true,
"target": "ES2020",
"target": "ES2022",
"module": "ESNext",
"outDir": "dist",
"baseUrl": ".",

View File

@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"include": ["."],
"compilerOptions": {
"module": "ES2020",
"module": "ES2022",
"target": "ES2020",
"moduleResolution": "Node",
"strict": true,

View File

@ -26,6 +26,6 @@ export default defineConfig({
},
},
esbuild: {
target: 'node14',
target: 'node18',
},
})

View File

@ -10,10 +10,8 @@ export default defineConfig({
'./playground-temp/**/*.*',
],
testTimeout: 20000,
// node14 segfaults often with threads
threads: !process.versions.node.startsWith('14'),
},
esbuild: {
target: 'node14',
target: 'node18',
},
})