Skip to content

Commit 9662ef4

Browse files
authored
chore: add preinstall script to skip init submodule in common repo(Tencent#5214)
* ci: disable run pnpm:devPreinstall * chore: compatible windows * chore: rename pnpm-dev-preinstall.js
1 parent ff317bc commit 9662ef4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"node": ">= 18"
1515
},
1616
"scripts": {
17-
"pnpm:devPreinstall": "pnpm run init",
17+
"pnpm:devPreinstall": "node script/pnpm-dev-preinstall.js",
1818
"postinstall": "husky install && pnpm -C internal/utils prebuild",
1919
"init": "git submodule init && git submodule update",
2020
"start": "pnpm dev",

script/pnpm-dev-preinstall.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const child_process = require('child_process');
2+
3+
function initSubmodule() {
4+
if (process.env.CI) {
5+
return;
6+
}
7+
try {
8+
child_process.execSync('git submodule update --init', { stdio: 'inherit' });
9+
console.log('子模块初始化成功');
10+
} catch (error) {
11+
console.error(`子模块初始化失败: ${error.message}`);
12+
}
13+
}
14+
15+
initSubmodule();

0 commit comments

Comments
 (0)