Skip to content

Commit

Permalink
fix: Husky automatic installation (#16206)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
  • Loading branch information
liuxingbaoyu and nicolo-ribaudo committed Jan 8, 2024
1 parent d1088dc commit 1e4777b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,11 @@ jobs:
- name: Support self-references on old Node.js
run: |
echo '{
"type": "commonjs",
"private": true,
"devDependencies": {
"@babel/runtime": "workspace:*",
"@babel/runtime-corejs3": "workspace:*"
"@babel/runtime": "workspace:^",
"@babel/runtime-corejs3": "workspace:^"
}
}' > packages/package.json
node -e "
Expand Down
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ conditions:
USE_ESM:
default: false

enableConstraintsChecks: true

enableGlobalCache: true

# Disable hardened mode. The Hardened mode will be run in the prepare-yarn-cache CI job.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"type": "commonjs",
"scripts": {
"prepare": "is-ci || husky install",
"postinstall": "node scripts/postinstall.js",
"bootstrap": "make bootstrap",
"codesandbox:build": "make build-no-bundle",
"build": "make build",
Expand Down
13 changes: 13 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { existsSync, copyFileSync } from "fs";
import isCI from "is-ci";
import husky from "husky";

if (!isCI) {
if (!existsSync(".husky/_/husky.sh")) {
husky.install();
}

if (!existsSync(".vscode/settings.json")) {
copyFileSync(".vscode/settings.example.json", ".vscode/settings.json");
}
}

0 comments on commit 1e4777b

Please sign in to comment.