Skip to content

Commit fccdbae

Browse files
committed
chore(scripts): check if install is run with npm or yarn
1 parent f8a9e17 commit fccdbae

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

npm-check.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if (process.env.npm_config_user_agent?.includes("yarn")) {
2+
console.error();
3+
console.error(
4+
"❌ Yarn is no longer supported in this repository (since December 1, 2025).",
5+
);
6+
console.error(" Use npm instead:");
7+
console.error(" - `npm install` instead of `yarn install`");
8+
console.error(" - `npm run content` instead of `yarn content`");
9+
console.error();
10+
process.exit(1);
11+
} else {
12+
console.info();
13+
console.info("🐥 This repository is now using npm (since December 1, 2025).");
14+
console.info(
15+
"🐞 Please report any issues here: https://github.com/mdn/fred/issues/new?template=bug.yml",
16+
);
17+
console.info();
18+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"lint:typos-group-by-file": "cspell --no-progress --gitignore --quiet --reporter cspell-group-by-file-reporter --config .vscode/cspell.json \"**/*.md\"",
3838
"lint:typos-words-only": "cspell --no-progress --gitignore --words-only --unique --config .vscode/cspell.json \"**/*.md\"",
3939
"lint:yml": "prettier -c \"**/*.yml\"",
40+
"prepare": "node npm-check.js",
4041
"start": "npm run --silent info:fred && npm run up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files NODE_ENV=production FRED_PLAYGROUND_LOCAL=true FRED_PLAYGROUND_PORT=5043 FRED_PORT=5042 FRED_WRITER_MODE=true fred-server",
4142
"test": "node --test",
4243
"up-to-date-check": "node scripts/up-to-date-check.js"

0 commit comments

Comments
 (0)