tatethurston / nextjs-routes

Type safe routing for Next.js
MIT License
571 stars 23 forks source link

Allow nextjs-routes cli configuration via nextjs-routes.config.js file #136

Open tatethurston opened 1 year ago

tatethurston commented 1 year ago

nextjs-routes can be invoked via cli: npx nextjs-routes. Presently, no configuration options are passed to the cli execution.

  1. Read a nextjs-routes.config.js if present.
  2. Log the location of the found config file
  3. Validate the config file has the expected shape (no unknown keys).
  4. Pass the config file values to the invocation of writeNextjsRoutes in src/cli.
tatethurston commented 1 year ago

Alternatively, read next.config.js to derive the configuration. This seems preferable, but is more difficult because of the configuration under the webpack key. We could add a custom webpack key or use globals to pass configuration.

airtonix commented 1 year ago

i wouldn't.

just make them cli args.

tatethurston commented 1 year ago

Yeah, also happy with a cli args approach.

trevoro commented 1 year ago

@tatethurston Did the CLI get removed in the latest npm published package? I cannot find any concept of a CLI or executable in there but this issue references one existing.

EDIT NVM I am blind.

tatethurston commented 1 week ago

Published 2.2.4-rc.1 which reads in next.config.js. Support for cwd and outDir to follow in a subsequent rc.