|
|
@@ -1,5 +1,3 @@
|
|
|
-// 执行脚本 taro build --type h5 ,并且把环境变量 TARO_API_URL 传递过去
|
|
|
-
|
|
|
const { execSync } = require('child_process');
|
|
|
const fs = require('fs');
|
|
|
const path = require('path');
|
|
|
@@ -29,8 +27,7 @@ function getGhToken() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const TARO_API_URL = 'http://localhost:6001'; // 远程地址,这里写死,要做成部署后可配置
|
|
|
-const TARO_MQTT_URL = 'ws://localhost:8083/mqtt';
|
|
|
+
|
|
|
const rootDir = path.join(__dirname, '..'); // 项目根目录
|
|
|
try {
|
|
|
console.log(`复制arm平台必须构建文件taro.linux-arm64-gnu.node到目标位置`);
|
|
|
@@ -44,7 +41,7 @@ try {
|
|
|
process.exit(1);
|
|
|
}
|
|
|
|
|
|
-execSync(`npm run build:h5`, { cwd: rootDir, stdio: 'inherit', env: { ...process.env, TARO_API_URL, TARO_MQTT_URL } }, (error, stdout, stderr) => {
|
|
|
+execSync(`npm run build:h5`, { cwd: rootDir, stdio: 'inherit', env: { ...process.env } }, (error, stdout, stderr) => {
|
|
|
if (error) {
|
|
|
console.error(`Error executing command: ${error.message}`);
|
|
|
return;
|
|
|
@@ -56,22 +53,10 @@ execSync(`npm run build:h5`, { cwd: rootDir, stdio: 'inherit', env: { ...process
|
|
|
console.log(`Command stdout: ${stdout}`);
|
|
|
});
|
|
|
|
|
|
-function run(cmd, env = {}) {
|
|
|
- console.log(`\n>>> ${cmd}`);
|
|
|
- try {
|
|
|
- execSync(cmd, { stdio: 'inherit', cwd: process.cwd(), env: env });
|
|
|
- } catch (e) {
|
|
|
- console.error(`命令失败: ${cmd}`, e.message);
|
|
|
- exit(1);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
try {
|
|
|
- // run('npm run build:h5');
|
|
|
- // run('npm run prebuild:arm:linux');
|
|
|
|
|
|
const GH_TOKEN = getGhToken(); // CI/本地 都能拿到合适值
|
|
|
- // run('npm run build:electron:win');
|
|
|
+
|
|
|
//ci 环境才使用 publish
|
|
|
const cmd = isCI()
|
|
|
? 'npx electron-builder --config electron-builder.json --linux --publish always'
|