(isGhAction)
| 23 | } |
| 24 | |
| 25 | async function buildGui(isGhAction) { |
| 26 | // Make sure we are in the right directory |
| 27 | if (!process.cwd().endsWith("gui")) { |
| 28 | process.chdir(path.join(continueDir, "gui")); |
| 29 | } |
| 30 | if (isGhAction) { |
| 31 | execCmdSync("npm run build"); |
| 32 | } |
| 33 | |
| 34 | // Copy over the dist folder to the JetBrains extension // |
| 35 | const intellijExtensionWebviewPath = path.join( |
| 36 | "..", |
| 37 | "extensions", |
| 38 | "intellij", |
| 39 | "src", |
| 40 | "main", |
| 41 | "resources", |
| 42 | "webview", |
| 43 | ); |
| 44 | |
| 45 | const indexHtmlPath = path.join(intellijExtensionWebviewPath, "index.html"); |
| 46 | fs.copyFileSync(indexHtmlPath, "tmp_index.html"); |
| 47 | rimrafSync(intellijExtensionWebviewPath); |
| 48 | fs.mkdirSync(intellijExtensionWebviewPath, { recursive: true }); |
| 49 | |
| 50 | await new Promise((resolve, reject) => { |
| 51 | ncp("dist", intellijExtensionWebviewPath, (error) => { |
| 52 | if (error) { |
| 53 | console.warn( |
| 54 | "[error] Error copying React app build to JetBrains extension: ", |
| 55 | error, |
| 56 | ); |
| 57 | reject(error); |
| 58 | } |
| 59 | resolve(); |
| 60 | }); |
| 61 | }); |
| 62 | |
| 63 | // Put back index.html |
| 64 | if (fs.existsSync(indexHtmlPath)) { |
| 65 | rimrafSync(indexHtmlPath); |
| 66 | } |
| 67 | fs.copyFileSync("tmp_index.html", indexHtmlPath); |
| 68 | fs.unlinkSync("tmp_index.html"); |
| 69 | |
| 70 | console.log("[info] Copied gui build to JetBrains extension"); |
| 71 | |
| 72 | // Then copy over the dist folder to the VSCode extension // |
| 73 | const vscodeGuiPath = path.join("../extensions/vscode/gui"); |
| 74 | fs.mkdirSync(vscodeGuiPath, { recursive: true }); |
| 75 | await new Promise((resolve, reject) => { |
| 76 | ncp("dist", vscodeGuiPath, (error) => { |
| 77 | if (error) { |
| 78 | console.log( |
| 79 | "Error copying React app build to VSCode extension: ", |
| 80 | error, |
| 81 | ); |
| 82 | reject(error); |
no test coverage detected