Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert 'suggest yarn install' script from Shell to JS #32356

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .husky/update-history

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"type": "module",
"scripts": {
"postinstall": "sh ./.husky/update-history",
"postinstall": "node scripts/update-history.js",
"build": "env-cmd --silent cross-env CONTENT_ROOT=files BUILD_OUT_ROOT=build yari-build",
"content": "env-cmd --silent cross-env CONTENT_ROOT=files yari-tool",
"filecheck": "env-cmd --silent cross-env CONTENT_ROOT=files yari-filecheck --cwd=.",
Expand Down
16 changes: 16 additions & 0 deletions scripts/update-history.js
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);
}
Loading