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(core): handling sub directory annotation in the feature name parameter #276

Merged
merged 3 commits into from
Aug 11, 2021

Conversation

csimpi
Copy link
Contributor

@csimpi csimpi commented Jul 13, 2021

feat(core): Handling sub directory annotation in the feature name parameter

nx generate @nstudio/angular:feature --name=dashboard/settings/base-config --platforms=web places the feature files into dashboard/settings subfolders.

@NathanWalker NathanWalker changed the title Handling sub directory annotation in the feature name parameter feat(core): handling sub directory annotation in the feature name parameter Jul 13, 2021
@NathanWalker
Copy link
Member

@csimpi really appreciate this - several flows I'm putting this through and I wanted to mention that this repo was created prior to introduction of nx-plugin's (an official way of creating Nx plugins: https://nx.dev/latest/angular/nx-plugin/overview) - xplat has been around almost as long as Nx itself. Sometime this summer I may refactor xplat into an nx-plugin structure and simplify the source a bit in the process just to streamline more of it's setup.

@csimpi
Copy link
Contributor Author

csimpi commented Jul 14, 2021

@NathanWalker Thank you. Following NX Plugin patterns seems the best way to do this.
Yesterday night I realized the imports are not following the directory pattern, I've found how to fix it, testing it now, and will push a commit if it looks good.

@NathanWalker NathanWalker self-assigned this Jul 19, 2021
@NathanWalker NathanWalker changed the base branch from master to release-prep August 11, 2021 04:29
@NathanWalker NathanWalker merged commit 551edef into nstudio:release-prep Aug 11, 2021
@NathanWalker
Copy link
Member

@csimpi thanks again for this - I was able to add some additional things on top with this commit:
c635f98

That provides a new directory option to appear in Nx Console with the feature generator which allows you to specify the name of a directory in features where you want it organized under. Additionally it allows the component generator to then target features created in directories as follows...

For example after generating a feature using a directory:

nx generate @nstudio/angular:feature --name=profile --directory=dashboard/settings --platforms=web=

CREATE libs/xplat/features/src/lib/dashboard/settings/profile/profile.module.ts
CREATE libs/xplat/features/src/lib/dashboard/settings/profile/index.ts
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/profile.module.ts
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/index.ts
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/index.ts
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/profile/profile.component.html
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/profile/profile.component.ts
UPDATE libs/xplat/features/src/lib/index.ts
UPDATE libs/xplat/web/features/src/lib/index.ts

Screen Shot 2021-08-11 at 3 06 11 PM

You can then create components attached to that nested feature module with:

nx generate @nstudio/angular:component --name=networks --feature=dashboard/settings/profile --platforms=web

CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/networks/networks.component.html
CREATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/networks/networks.component.ts
UPDATE libs/xplat/web/features/src/lib/dashboard/settings/profile/components/index.ts

Screen Shot 2021-08-11 at 3 08 42 PM

Published with v12.7.0 now.
https://github.com/nstudio/xplat/releases/tag/12.7.0

@csimpi
Copy link
Contributor Author

csimpi commented Aug 13, 2021

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants