Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

Only allow use pnpm

ppchartbbbc1db10566
diff --git a/ui/package.json b/ui/package.json
index 069456ef..c7512460 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -15,7 +15,8 @@
"prepare": "cd .. && husky install",
"cz": "cz",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
- "prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
+ "prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
+ "preinstall": "node ./scripts/preinstall.js"
},
"config": {
"commitizen": {
@@ -109,4 +110,4 @@
"pnpm": ">=7"
},
"license": "MIT"
-}
+}
\ No newline at end of file
diff --git a/ui/scripts/preinstall.js b/ui/scripts/preinstall.js
new file mode 100644
index 00000000..076ad606
--- /dev/null
+++ b/ui/scripts/preinstall.js
@@ -0,0 +1,5 @@
+// There is a bug when using npm to install: the execution of preinstall is after install, so when this prompt is displayed, the dependent packages have already been installed.
+if (!/pnpm/.test(process.env.npm_execpath)) {
+ console.warn(`\u001b[33mThis repository requires using pnpm as the package manager for scripts to work properly.\u001b[39m\n`)
+ process.exit(1)
+}
\ No newline at end of file