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 { glob } from "./util";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
export async function build() {
|
export async function build() {
|
||||||
await Shell.exec("node", ["node_modules/.bin/tsc", "-p", "."]);
|
let ret = await Shell.exec("node", ["node_modules/.bin/tsc", "-p", "."], {
|
||||||
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;
|
||||||
|
}
|
||||||
|
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");
|
const bundleFiles = await glob("bundle/**/*.js");
|
||||||
for (let bundleFile of bundleFiles) {
|
for (let bundleFile of bundleFiles) {
|
||||||
await doMerge(bundleFile);
|
await doMerge(bundleFile);
|
||||||
|
@ -31,8 +31,21 @@ function getIPAdress() {
|
|||||||
|
|
||||||
export default async function dev() {
|
export default async function dev() {
|
||||||
const server = await createServer()
|
const server = await createServer()
|
||||||
const tscProcess = exec("node node_modules/.bin/tsc -w -p .");
|
const tscProcess = exec("node node_modules/.bin/tsc -w -p .", {
|
||||||
const rollupProcess = exec("node node_modules/.bin/rollup -c -w");
|
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 ...");
|
console.warn("Waiting ...");
|
||||||
const ips = getIPAdress();
|
const ips = getIPAdress();
|
||||||
ips.forEach((e) => {
|
ips.forEach((e) => {
|
||||||
|
@ -5,6 +5,9 @@ import { build, clean } from "./actions";
|
|||||||
import create from "./create"
|
import create from "./create"
|
||||||
import dev from "./dev"
|
import dev from "./dev"
|
||||||
import { run } from "./run";
|
import { run } from "./run";
|
||||||
|
|
||||||
|
(process.env.FORCE_COLOR as any) = true
|
||||||
|
|
||||||
commander
|
commander
|
||||||
.command('create <name>')
|
.command('create <name>')
|
||||||
.action(async function (name, cmd) {
|
.action(async function (name, cmd) {
|
||||||
|
@ -34,6 +34,7 @@ async function runAndroid() {
|
|||||||
console.log("====================");
|
console.log("====================");
|
||||||
await Shell.exec("sh", ["gradlew", "assembleDebug"], {
|
await Shell.exec("sh", ["gradlew", "assembleDebug"], {
|
||||||
cwd: androidDir,
|
cwd: androidDir,
|
||||||
|
env: process.env,
|
||||||
consoleHandler: (info) => console.log(info)
|
consoleHandler: (info) => console.log(info)
|
||||||
});
|
});
|
||||||
const apkFiles = await glob("**/outputs/apk/debug/*.apk", {
|
const apkFiles = await glob("**/outputs/apk/debug/*.apk", {
|
||||||
|
Reference in New Issue
Block a user