-
Notifications
You must be signed in to change notification settings - Fork 22.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: convert 'suggest yarn install' script from Shell to JS (#32356)
fix: convert suggest yarn install script from Shell to JS
- Loading branch information
1 parent
20ee91c
commit 3dcf0a3
Showing
3 changed files
with
17 additions
and
10 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* This script stores the 'main' branch's HEAD commit hash in .husky/_/history | ||
* The stored commit hash is used by the post-merge script .husky/post-merge | ||
*/ | ||
|
||
import fs from "node:fs"; | ||
import { execGit } from "./utils.js"; | ||
|
||
const HUSKY_ROOT = ".husky/_/"; | ||
const HISTORY_FILE = HUSKY_ROOT + "history"; | ||
|
||
const branch = execGit(["rev-parse", "--abbrev-ref", "HEAD"], { cwd: "." }); | ||
if (branch === "main" && fs.existsSync(HUSKY_ROOT)) { | ||
const hash = execGit(["rev-parse", "HEAD"], { cwd: "." }); | ||
fs.writeFileSync(HISTORY_FILE, hash); | ||
} |