[ ] Regression
[ ] Bug report
[ X ] Feature request
[ ] Documentation issue or request
nest start runs the project using src/main as the entry-point file.
Refs:
nest start --entry-point cli runs the project using src/cli as the entry-point file.
Thanks to NestFactory.createApplicationContext is really easy to build custom CLIs for Nestjs projects.
Prior to nest v6, We used ts-node -r tsconfig-paths/register src/cli.ts to run our CLI in dev machines, now we would like to move to nest start.
You can simply set entryFile configuration option in your nest-cli.json ("entryFile": "cli")
Hi @kamilmysliwiec,
We have both main.ts (the entry-point of our backend app) and cli.ts.
It's not possible to specify a different nest-cli config file via env vars. The config filename is static according to https://github.com/nestjs/nest-cli/blob/6eabf61faa5c0e4d34edf2140a113ac259eddc83/lib/configuration/nest-configuration.loader.ts#L11.
I'm thinking to create a new nest-cli config file for our cli.ts, and then pass it via envvar.
nest-cli.cli.config.js (horrible name, I know...):
{
"language": "ts",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"entryFile": "cli"
}
And then in package.json:
"cli": "NEST_CLI_CONFIG=nest-cli.cli.config.js nest start",
"cli:prod": "node dist/cli",
What do you think?
Perhaps we should just allow passing --config option to nest to let the CLI know we want to use either nest.json or, for instance, nest.prod.json. Then, you could simply create 2 separate scripts for building for dev and prod.
That would be great!
Would you be interested in creating a PR? :)
Yes, I or one of my teammates can do it and open a pr. 馃憤
Great! That would be awesome
@kamilmysliwiec done!
Added in the latest release :)
Do we also have an extend option in nest-cli.json like tsconfig has?
I have 2 nest-cli.json files, 1 for production and 1 for development.
Whenever I added a nest library, I've to add it to both the config files, it'll be great if I can add all the libs to a single json file and then extend from that file the other 2 config files.
Most helpful comment
Added in the latest release :)