feat:fix doric-cli cannot output compile errors
This commit is contained in:
parent
be1514e830
commit
1887e1e322
@ -4,8 +4,26 @@ import fs from "fs";
|
||||
import { glob } from "./util";
|
||||
import path from "path";
|
||||
export async function build() {
|
||||
await Shell.exec("node", ["node_modules/.bin/tsc", "-p", "."]);
|
||||
await Shell.exec("node", ["node_modules/.bin/rollup", "-c"]);
|
||||
let ret = await Shell.exec("node", ["node_modules/.bin/tsc", "-p", "."], {
|
||||
env: process.env,
|
||||
consoleHandler: (info) => {
|
||||
console.log(info);
|
||||
}
|
||||
});
|
||||
if (ret !== 0) {
|
||||
console.log("Compile error".red);
|
||||
return;
|
||||
}
|
||||
ret = await Shell.exec("node", ["node_modules/.bin/rollup", "-c",], {
|
||||
env: process.env,
|
||||
consoleHandler: (info) => {
|
||||
console.log(info);
|
||||
}
|
||||
});
|
||||
if (ret !== 0) {
|
||||
console.log("Compile error".red);
|
||||
return;
|
||||
}
|
||||
const bundleFiles = await glob("bundle/**/*.js");
|
||||
for (let bundleFile of bundleFiles) {
|
||||
await doMerge(bundleFile);
|
||||
|
@ -31,8 +31,21 @@ function getIPAdress() {
|
||||
|
||||
export default async function dev() {
|
||||
const server = await createServer()
|
||||
const tscProcess = exec("node node_modules/.bin/tsc -w -p .");
|
||||
const rollupProcess = exec("node node_modules/.bin/rollup -c -w");
|
||||
const tscProcess = exec("node node_modules/.bin/tsc -w -p .", {
|
||||
env: process.env,
|
||||
});
|
||||
const rollupProcess = exec("node node_modules/.bin/rollup -c -w", {
|
||||
env: process.env,
|
||||
});
|
||||
[tscProcess, rollupProcess].forEach(e => {
|
||||
e.stdout?.on("data", (data) => {
|
||||
console.log(data.toString());
|
||||
});
|
||||
e.stderr?.on("data", (data) => {
|
||||
console.log(data.toString());
|
||||
});
|
||||
})
|
||||
|
||||
console.warn("Waiting ...");
|
||||
const ips = getIPAdress();
|
||||
ips.forEach((e) => {
|
||||
|
@ -5,6 +5,9 @@ import { build, clean } from "./actions";
|
||||
import create from "./create"
|
||||
import dev from "./dev"
|
||||
import { run } from "./run";
|
||||
|
||||
(process.env.FORCE_COLOR as any) = true
|
||||
|
||||
commander
|
||||
.command('create <name>')
|
||||
.action(async function (name, cmd) {
|
||||
|
@ -34,6 +34,7 @@ async function runAndroid() {
|
||||
console.log("====================");
|
||||
await Shell.exec("sh", ["gradlew", "assembleDebug"], {
|
||||
cwd: androidDir,
|
||||
env: process.env,
|
||||
consoleHandler: (info) => console.log(info)
|
||||
});
|
||||
const apkFiles = await glob("**/outputs/apk/debug/*.apk", {
|
||||
|
Reference in New Issue
Block a user