MCPcopy Create free account
hub / github.com/ProNextJS/declarative-routing / buildFiles

Function buildFiles

src/shared/build-tools.ts:232–313  ·  view source on GitHub ↗
(silent: boolean = false)

Source from the content-addressed store, hash-verified

230}
231
232export async function buildFiles(silent: boolean = false) {
233 const config = getConfig();
234
235 let routePatterns: string[];
236 switch (config.mode) {
237 case "qwikcity":
238 routePatterns = [
239 "**/index.{jsx,tsx}",
240 "**/index@*.{jsx,tsx}",
241 "index.{jsx,tsx}",
242 "index@*.{jsx,tsx}"
243 ];
244 break;
245 default:
246 routePatterns = [
247 "**/page.{js,ts,jsx,tsx}",
248 "**/route.{js,ts,jsx,tsx}",
249 "page.{js,ts,jsx,tsx}",
250 "route.{js,ts,jsx,tsx}"
251 ];
252 break;
253 }
254
255 // Add new .info files to existing routes
256 const routes = await glob(routePatterns, {
257 cwd: config.src,
258 posix: true,
259 ignore
260 });
261
262 let routesAdded = 0;
263 for (const route of routes) {
264 if (await checkRouteFile(route)) {
265 routesAdded++;
266 }
267 }
268 if (!silent && routesAdded > 0) {
269 console.log(`Added ${routesAdded} new info files`);
270 }
271
272 let infoPatterns: string[];
273 switch (config.mode) {
274 case "qwikcity":
275 infoPatterns = ["**/routeInfo.{js,ts,jsx,tsx}"];
276 break;
277 default:
278 infoPatterns = [
279 "**/page.info.{js,ts,jsx,tsx}",
280 "**/route.info.{js,ts,jsx,tsx}",
281 "page.info.{js,ts,jsx,tsx}",
282 "route.info.{js,ts,jsx,tsx}"
283 ];
284 break;
285 }
286
287 // Parse all .info files
288 const infoFiles = await glob(infoPatterns, {
289 cwd: config.src,

Callers 3

setupFunction · 0.90
setupFunction · 0.90
build.tsFile · 0.90

Calls 5

getConfigFunction · 0.90
checkRouteFileFunction · 0.85
parseInfoFileFunction · 0.85
writeRoutesFunction · 0.85
writeOpenAPIFunction · 0.85

Tested by

no test coverage detected