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 +}