GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — t3code/scripts/prepare-server-compile-cache.cjs at main · VitaCodez/t3code Expand file tree/ Copy pathprepare-server-compile-cache.cjsMore file actions 72 lines (71 loc) · 3.06 KB / Copy pathprepare-server-compile-cache.cjsFile metadata and controls72 lines (71 loc) · 3.06 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 /* oxlint-disable t3code/no-global-process-runtime -- Packaging must compare the build host with the executable target. */ const { spawnSync } = require("node:child_process"); const path = require("node:path"); const fs = require("node:fs"); const os = require("node:os"); // afterPack runs before signing and installer creation, against the final ASAR layout. module.exports = async ({ appOutDir, electronPlatformName, arch, packager }) => { if (!["darwin", "win32", "linux"].includes(electronPlatformName)) { console.log(`[server-compile-cache] Skipping unsupported target ${electronPlatformName}`); return; } // Generating the cache runs the bundle, and a PR preview's bundle must never run next to signing secrets. if (process.env.T3CODE_DESKTOP_UNTRUSTED_BUNDLE === "true") { console.log("[server-compile-cache] Skipping untrusted bundle"); return; } const targetArch = ["ia32", "x64", "armv7l", "arm64", "universal"][arch]; const runsWithRosetta = electronPlatformName === "darwin" && process.platform === "darwin" && process.arch === "arm64" && targetArch === "x64"; if ( electronPlatformName !== process.platform || (targetArch !== process.arch && !runsWithRosetta) ) { console.log( `[server-compile-cache] Skipping unexecutable target ${electronPlatformName}/${targetArch}`, ); return; } const product = packager.appInfo.productFilename; const resources = electronPlatformName === "darwin" ? path.join(appOutDir, `${product}.app`, "Contents", "Resources") : path.join(appOutDir, "resources"); const executable = electronPlatformName === "darwin" ? path.join(appOutDir, `${product}.app`, "Contents", "MacOS", product) : path.join( appOutDir, electronPlatformName === "win32" ? `${product}.exe` : packager.executableName, ); const helper = path.join( resources, "app.asar", "apps/desktop/dist-electron/serverCompileCache.cjs", ); const env = { ...process.env, ELECTRON_RUN_AS_NODE: "1" }; for (const name of Object.keys(env)) { if (name.startsWith("NODE_") || name.startsWith("T3CODE_")) delete env[name]; } const state = fs.mkdtempSync(path.join(os.tmpdir(), "t3-release-cache-")); env.T3CODE_HOME = state; let result; try { // Run a script file, not -e: -e defines a global __filename of "[eval]", which // @effect/platform-node passes to createRequire and fails on. const runner = path.join(state, "prepare-server-compile-cache-runner.cjs"); fs.writeFileSync( runner, `require(${JSON.stringify(helper)}).generatePreparedServerCache(${JSON.stringify(resources)}).then(()=>process.exit(0),e=>{console.error(e);process.exit(1)})`, ); result = spawnSync(executable, [runner], { env, encoding: "utf8", timeout: 120000 }); } finally { fs.rmSync(state, { recursive: true, force: true }); } if (result.status !== 0) throw new Error(`Server compile cache generation failed: ${result.error || result.stderr}`); console.log("[server-compile-cache] Prepared server bytecode with packaged Electron"); }; |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |