编译 domain 判断mac

This commit is contained in:
Wang Kejun 2022-05-17 11:13:13 +08:00
parent 36759d3ff2
commit e2e5e6924f
2 changed files with 46 additions and 1 deletions

View File

@ -12,6 +12,7 @@
"devDependencies": {
"@babel/cli": "^7.12.13",
"@babel/core": "^7.12.13",
"@types/cross-spawn": "^6.0.2",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/preset-env": "^7.12.13",
"@babel/preset-typescript": "^7.12.13",
@ -24,7 +25,10 @@
"@types/react": "^17.0.2",
"@types/uuid": "^8.3.0",
"assert": "^2.0.0",
"chalk": "^4.1.0",
"cross-env": "^7.0.2",
"cross-spawn": "^6.0.5",
"fs-extra": "^10.0.0",
"isomorphic-fetch": "^3.0.0",
"miniprogram-api-typings": "^3.4.6",
@ -33,7 +37,7 @@
"typescript": "^4.5.2"
},
"scripts": {
"prebuild": "ts-node ./scripts/buildBaseEntityDict && npm link ./src/base-app-domain",
"prebuild": "ts-node ./scripts/make.ts",
"build": "tsc",
"get:area": "ts-node ./scripts/getAmapArea.ts",
"clean:mp": "ts-node ./scripts/cleanDtsInWechatMp"

41
scripts/make.ts Normal file
View File

@ -0,0 +1,41 @@
import chalk from 'chalk';
import spawn from 'cross-spawn';
// ts-node scripts/build-app-domain & npm link ./app-domain
console.log(`${chalk.greenBright(`build oak-app-domain`)}`);
const result = spawn.sync(
'ts-node',
[require.resolve('./buildBaseEntityDict.ts')],
{
stdio: 'inherit',
shell: true,
}
);
// const result2 = spawn.sync('npm -v', [], { stdio: 'inherit', shell: true });
if (result.status === 0) {
console.log(`${chalk.greenBright(`build 执行完成`)}`);
} else {
Error(`${chalk.redBright(`build 执行失败`)}`);
process.exit(1);
}
console.log(`${chalk.greenBright(`npm link oak-app-domain`)}`);
const isMac = process.platform === 'darwin';
const result2 = spawn.sync(
`${isMac ? 'sudo' : ''}`,
[`npm link ${process.cwd()}/src/base-app-domain`],
{
stdio: 'inherit',
shell: true,
}
);
if (result2.status === 0) {
console.log(`${chalk.greenBright(`link 执行完成`)}`);
} else {
Error(`${chalk.redBright(`link 执行失败`)}`);
process.exit(1);
}