From 994c8c16e7d3ce4da8e2f8bcc7546ce9608e239f Mon Sep 17 00:00:00 2001 From: Uiolee <22849383+uiolee@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:09:42 +0800 Subject: [PATCH] bump Node.js version of netlify (#2240) * bump Node.js version of netlify.toml * Skip Husky install in production and CI * use node-lts --------- Signed-off-by: Uiolee <22849383+uiolee@users.noreply.github.com> --- .husky/install.mjs | 7 +++++++ netlify.toml | 2 +- package.json | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .husky/install.mjs diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 0000000000..6544df985c --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,7 @@ +// Skip Husky install in production and CI +if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') { + console.warn('Skip Husky install in production and CI.') + process.exit(0) +} +const husky = (await import('husky')).default +console.log(husky()) \ No newline at end of file diff --git a/netlify.toml b/netlify.toml index 5996d26c2c..d32ddca8d7 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,7 +1,7 @@ [build] command = "npm run build" publish = "/public" - environment = { NODE_VERSION = "14", NODE_ENV = "production" } + environment = { NODE_VERSION = "lts/*", NODE_ENV = "production" } [[redirects]] from = "/" diff --git a/package.json b/package.json index 0672e8bd1f..696df842cf 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "hexo generate", "eslint": "eslint .", "format:md": "prettier --write */**/docs/*.md */**/api/*.md", - "prepare": "husky" + "prepare": "node .husky/install.mjs" }, "dependencies": { "cheerio": "^0.22.0", @@ -46,4 +46,4 @@ "engines": { "node": ">=14" } -} \ No newline at end of file +}