gencow 0.1.53 → 0.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/gencow.mjs +8 -10
- package/core/index.js +1828 -0
- package/core/package.json +6 -0
- package/package.json +2 -1
- package/scripts/bundle-server.mjs +29 -0
package/bin/gencow.mjs
CHANGED
|
@@ -284,8 +284,14 @@ function generateApiTs(config) {
|
|
|
284
284
|
const apiTsPath = resolve(absoluteFunctions, "api.ts");
|
|
285
285
|
const extractTsPath = resolve(serverRoot, ".gencow-extract.ts");
|
|
286
286
|
|
|
287
|
+
// Resolve @gencow/core — bundled core is at ../core/ relative to server/
|
|
288
|
+
const bundledCorePath = resolve(serverRoot, "../core/index.js");
|
|
289
|
+
const coreImport = existsSync(bundledCorePath)
|
|
290
|
+
? bundledCorePath.replace(/\\/g, "/") // Windows 호환
|
|
291
|
+
: "@gencow/core"; // 모노레포 등 이미 resolve 가능한 경우
|
|
292
|
+
|
|
287
293
|
const script = `
|
|
288
|
-
import { getRegisteredQueries, getRegisteredMutations } from "
|
|
294
|
+
import { getRegisteredQueries, getRegisteredMutations } from "${coreImport}";
|
|
289
295
|
import "${absoluteFunctions}/index.ts";
|
|
290
296
|
console.log("GENCOW_API_JSON=" + JSON.stringify({
|
|
291
297
|
queries: getRegisteredQueries(),
|
|
@@ -297,15 +303,7 @@ process.exit(0);
|
|
|
297
303
|
try {
|
|
298
304
|
writeFileSync(extractTsPath, script);
|
|
299
305
|
|
|
300
|
-
|
|
301
|
-
let tsRunner = "bun";
|
|
302
|
-
try { execSync("bun --version", { stdio: "ignore" }); }
|
|
303
|
-
catch {
|
|
304
|
-
try { execSync("npx tsx --version", { stdio: "ignore" }); tsRunner = "npx tsx"; }
|
|
305
|
-
catch { throw new Error("bun 또는 tsx가 필요합니다. npm i -g tsx 로 설치하세요."); }
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
const outStr = execSync(`${tsRunner} .gencow-extract.ts`, {
|
|
306
|
+
const outStr = execSync(`bun .gencow-extract.ts`, {
|
|
309
307
|
cwd: serverRoot,
|
|
310
308
|
stdio: ["pipe", "pipe", "ignore"]
|
|
311
309
|
}).toString();
|