Replies: 2 comments 2 replies
-
We can add this in prog
.command("routes").describe("print routes")
.action(async ({config: configFile, open, port, root, host, inspect}) => {
root = root || process.cwd();
const config = await resolveConfig({ mode: "production", configFile, root, command: "build" });
const { Router } = await import("./fs-router/router.js");
const router = new Router({
baseDir: path.posix.join(config.solidOptions.appRoot, config.solidOptions.routesDir),
pageExtensions: config.solidOptions.pageExtensions,
ignore: config.solidOptions.routesIgnore,
cwd: config.solidOptions.root
});
await router.init();
console.log(JSON.stringify(router.getFlattenedPageRoutes(), null, 2));
}); to get the desired output. Running solid-start routes
[
{
"id": "/(a)",
"path": "",
"componentPath": "src/routes/(a).tsx"
},
{
"id": "/[...404]",
"path": "/*404",
"componentPath": "src/routes/[...404].tsx"
},
{
"id": "/[param]",
"path": "/:param",
"componentPath": "src/routes/[param].tsx"
},
{
"id": "/index",
"path": "/",
"componentPath": "src/routes/index.tsx"
}
]
Running remix routes --json`> remix routes --json` ```json[
|
Beta Was this translation helpful? Give feedback.
-
Yeah if this gets what you are looking for seems reasonable to me. |
Beta Was this translation helpful? Give feedback.
-
Hi
I want to create a small adapter for solid-start in routes-gen.
This will allow using type-safe routes for solid-start.
I could replicate the solid routes resolution manually, but after looking at the remix adapter - it seems that in order to get the routes we just need to run
remix routes --json
. From there it's easy to parse them.In solid-start we have the
/dev/print-routes.js
that print the routes in dev & build, and log to the terminal output, but we don't know when it finishesrouter.getFlattenedApiRoutes(showPageRoutes: boolean)
.solid/inspect/route-manifest.json
which we can infer the page routes from it keys (I could build in a temp folder and take it but I don't have a way to do it without config change and its not efficient)What should be the best way to handle it? Can we expose
solid-start routes --json
too?, or its better that I will handle it manually (which is ok for me too)Beta Was this translation helpful? Give feedback.
All reactions