silgi 0.36.12 → 0.36.14
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/dist/cli/build.mjs +24 -22
- package/dist/cli/index.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/build.mjs
CHANGED
|
@@ -256,31 +256,33 @@ async function nextJS(silgi, skip = false) {
|
|
|
256
256
|
write: true,
|
|
257
257
|
getContents: () => template.join("\n")
|
|
258
258
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
routerPrefixs.
|
|
259
|
+
silgi.hook("scanFiles:done", async (silgi2) => {
|
|
260
|
+
const routerPrefixs = [];
|
|
261
|
+
for (const route in silgi2.services) {
|
|
262
|
+
const routeParts = route.split("/").filter(Boolean);
|
|
263
|
+
if (routeParts.length > 0) {
|
|
264
|
+
const prefix = `/${routeParts[0]}`;
|
|
265
|
+
if (!routerPrefixs.includes(prefix)) {
|
|
266
|
+
routerPrefixs.push(prefix);
|
|
267
|
+
}
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
270
|
+
for (const prefix of routerPrefixs) {
|
|
271
|
+
const file = join(silgi2.options.srcDir, "app", prefix, "[...all]", "route.ts");
|
|
272
|
+
const fileExists = existsSync(file);
|
|
273
|
+
if (!fileExists) {
|
|
274
|
+
const serverDirName = `@/${silgi2.options.silgi.serverDir.split("/src/")[1]}/core`;
|
|
275
|
+
const template2 = `import { toNextJsHandler } from 'silgi/runtime/internal/next'
|
|
276
|
+
import { buildSilgi } from '${serverDirName}'
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
const silgi = await buildSilgi()
|
|
280
|
+
|
|
281
|
+
export const { GET, POST, PUT, DELETE, PATCH } = toNextJsHandler()`;
|
|
282
|
+
await writeFile(file, template2, true);
|
|
283
|
+
}
|
|
282
284
|
}
|
|
283
|
-
}
|
|
285
|
+
});
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
async function nitroFramework(silgi, skip = false) {
|
package/dist/cli/index.mjs
CHANGED