|
|
@@ -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,12 +27,11 @@ function getGhToken() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const TARO_API_URL = 'http://192.168.110.245:6001'; // 远程地址,这里写死,要做成部署后可配置
|
|
|
-const TARO_MQTT_URL ='ws://192.168.110.245:8083/mqtt';
|
|
|
+
|
|
|
const rootDir = path.join(__dirname, '..'); // 项目根目录
|
|
|
|
|
|
|
|
|
-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;
|
|
|
@@ -46,16 +43,6 @@ 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 {
|
|
|
const GH_TOKEN = getGhToken(); // CI/本地 都能拿到合适值
|
|
|
const cmd = isCI()
|