Nx: feat(schematics/lib): add directory option for lib and app schematics

Created on 3 Nov 2017  路  6Comments  路  Source: nrwl/nx

Add an option to the lib and app schematics to provide the directory where it will be created. Example:

ng g lib myLib --directory=libs/helpers

ng g lib generalUI --directory=libs/shared-components

This would allow users to create nested folder structures for their libs and apps.

Schematic would need to use the directory value for the file locations and use it in conjunction with the sourceDir when setting the root property of the app in the .angular-cli.json file.

feature

Most helpful comment

Fixed here 013a828d1e31f55a9b3f7c69587316890ea834d4

All 6 comments

i would personally prefer ng g lib nested-dir/lib-name - less verbose and imho, more consistent with @angular/cli taxonomy.

would also make generate commands easier, ie

ng g c components/xyz --app=nested-dir/lib-name

instead of

ng g c compoents/xyz --app=lib-name --directory=nested-dir

also, need capability in tslint.json to specify nested directory names that are allowed. in using nesting manually for now, I've had to set "nx-enforce-module-boundaries": false

is it possibly necessary to support multi-level nesting? i.e.

ng g lib demo/features
ng g lib demo/features/home
ng g lib demo/features/widgets

i am currently reorganising my workspace into a more granular pattern in anticipation of you supporting nested libraries, and some feedback on your thoughts of how you expect to approach this would be nice (please). For example, will you support multiple nesting layers?

Fixed here 013a828d1e31f55a9b3f7c69587316890ea834d4

Awesome @vsavkin! Looking forward to trying it out! 馃憤馃徏

Was this page helpful?
0 / 5 - 0 ratings