feat:Support debug other source in doric project
This commit is contained in:
parent
cd74a60c9e
commit
88dc9c9334
@ -145,6 +145,7 @@ public class DoricDev {
|
||||
public void requestDebugging(DoricContext context) {
|
||||
wsClient.sendToServer("DEBUG", new JSONBuilder()
|
||||
.put("source", context.getSource())
|
||||
.put("script", context.getScript())
|
||||
.toJSONObject());
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import path from "path";
|
||||
import { glob } from "./util";
|
||||
import { Shell } from "./shell";
|
||||
import { ChildProcess, } from "child_process";
|
||||
import fs from "fs";
|
||||
|
||||
export type MSG = {
|
||||
type: "D2C" | "C2D" | "C2S" | "D2S" | "S2C" | "S2D",
|
||||
@ -72,10 +73,19 @@ export async function createServer() {
|
||||
const jsFile = await glob(`**/${source}`, {
|
||||
cwd: path.resolve(process.cwd(), "bundle")
|
||||
})
|
||||
let debuggingFile: string
|
||||
if (!!!jsFile || jsFile.length === 0) {
|
||||
console.error(`Cannot find ${source} in ${path.resolve(process.cwd(), "bundle")}`);
|
||||
let script = resultObject.payload.script as string;
|
||||
const debuggingDir = path.resolve(process.cwd(), "debug");
|
||||
if (!fs.existsSync(debuggingDir)) {
|
||||
await fs.promises.mkdir(debuggingDir);
|
||||
}
|
||||
debuggingFile = path.resolve(debuggingDir, source);
|
||||
await fs.promises.writeFile(debuggingFile, script, "utf-8");
|
||||
} else {
|
||||
debuggingFile = path.resolve(process.cwd(), "bundle", jsFile[0]);
|
||||
}
|
||||
const debuggingFile = path.resolve(process.cwd(), "bundle", jsFile[0]);
|
||||
debugProcess = await Shell.execProcess(
|
||||
"node",
|
||||
[
|
||||
|
@ -229,7 +229,8 @@ - (void)stopDebugging:(BOOL)resume {
|
||||
|
||||
- (void)requestDebugging:(DoricContext *)context {
|
||||
[self.wsClient sendToServer:@"DEBUG" payload:@{
|
||||
@"source": context.source
|
||||
@"source": context.source,
|
||||
@"script": context.script,
|
||||
}];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user