Skip to content

Commit 700b321

Browse files
authored
Update complie.js
// 检查 tsconfig.json 是否存在 const tsconfigPath = path.resolve(cwd, 'tsconfig.json'); try { await fsp.access(tsconfigPath, fs.constants.F_OK); console.log('tsconfig.json 存在,不执行 "npm run usage" 命令。'); } catch (err) { // 如果 tsconfig.json 不存在,则执行 "npm run usage" await execCommand('npm run usage', { throwWhenStderr: false, cwd, }); }
1 parent bae5383 commit 700b321

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

script/temp/lifecycle/complie.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,19 @@ const feBuild = async (package) => {
2525
await execCommands(['npm install --force', 'npm run build'], {
2626
cwd,
2727
});
28-
await execCommand('npm run usage', {
29-
throwWhenStderr: false,
30-
cwd,
31-
});
28+
29+
// 检查 tsconfig.json 是否存在
30+
const tsconfigPath = path.resolve(cwd, 'tsconfig.json');
31+
try {
32+
await fsp.access(tsconfigPath, fs.constants.F_OK);
33+
console.log('tsconfig.json 存在,不执行 "npm run usage" 命令。');
34+
} catch (err) {
35+
// 如果 tsconfig.json 不存在,则执行 "npm run usage"
36+
await execCommand('npm run usage', {
37+
throwWhenStderr: false,
38+
cwd,
39+
});
40+
}
3241
};
3342

3443
const beBuild = async ({ cwd }) => {

0 commit comments

Comments
 (0)