diff --git a/doric-cli/src/actions.ts b/doric-cli/src/actions.ts index 16d59d1d..2dbb7e9a 100644 --- a/doric-cli/src/actions.ts +++ b/doric-cli/src/actions.ts @@ -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); diff --git a/doric-cli/src/dev.ts b/doric-cli/src/dev.ts index 3d26b586..72368696 100644 --- a/doric-cli/src/dev.ts +++ b/doric-cli/src/dev.ts @@ -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) => { diff --git a/doric-cli/src/index.ts b/doric-cli/src/index.ts index 4d5eff86..20a18c0c 100644 --- a/doric-cli/src/index.ts +++ b/doric-cli/src/index.ts @@ -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 ') .action(async function (name, cmd) { diff --git a/doric-cli/src/run.ts b/doric-cli/src/run.ts index f8957014..fb8b78c6 100644 --- a/doric-cli/src/run.ts +++ b/doric-cli/src/run.ts @@ -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", {