Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat() support project selection in add action #415

Merged
merged 1 commit into from
Jan 11, 2020

Conversation

johnbiundo
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[x] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

See below

Does this PR introduce a breaking change?

[ ] Yes
[x] No

But, see below

Other information

Main feature

This PR introduces a new feature for the nest add command. The command now:

  • Allows passing in a project name with -p option
  • Automatically handles multi-project selection if a project is not supplied
    • checks for whether the project structure is standard or monorepo
    • if monorepo, prompts for the project name
  • Invokes the nest-add schematic on the target library and passes in the source root via --sourceRoot

Minor changes

  • improve help messages (slight wording/grammar improvements; consistent title casing and periods, as guided by the Angular CLI conventions)
  • improve test script: run npm clean before running tests
  • refactor utils for monorepo/project selection into library functions
  • refactor generate action/command to use above utils
  • add display of CLI version to info command
  • update readme to be consistent with docs

Compatibility

  • Monorepos introduced an incompatibility with any libraries that implemented a nest-add schematic because the schematic would be unaware of a monorepo structure.
  • It's anticipated that there are very few, if any, such 3rd party libraries in the wild. Certainly, I'm not aware of any bug reports from such authors after having introduced monorepos, though it may be early.
  • There is at least one @nestjs library that implements the nest-add schematic: https://github.com/nestjs/azure-func-http. @kamilmysliwiec may know of more.
  • In order to function properly in a monorepo, with this supporting change in place, library authors implementing a nest-add schematic should accept a --sourceRoot flag and install code relative to the supplied path.

add feature to prompt for project
improve help messages
fix test script
remove hard-coded messages
refactor generate action to use utils
display CLI version for info command
clean up prompts
update readme
Make all command help consistent (Initial cap, period)
@kamilmysliwiec
Copy link
Member

There are 2 officially supported packages that implement nest-add schematic:

Would you like to create PRs for them? (in order to adjust to the current API)

@kamilmysliwiec
Copy link
Member

@kamilmysliwiec kamilmysliwiec merged commit ae386f5 into nestjs:master Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants