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

Add configuration to all current and future projects in workspace #425

Open
SimonKunz opened this issue Nov 24, 2022 · 6 comments
Open

Add configuration to all current and future projects in workspace #425

SimonKunz opened this issue Nov 24, 2022 · 6 comments

Comments

@SimonKunz
Copy link

Hi,

I just installed your plugin on our nx-workspace with > 120 Angular apps and libs. Is there a way to run "nx-stylelint:configuration" for every project in the corresponding angular.json file?

Also I'd be cool to automatically add the configuration to every new project that gets added to the workspace (not sure if that's possible).

Thank you for the great work!

@Phillip9587
Copy link
Owner

Phillip9587 commented Nov 24, 2022

Hi Simon,

There is currently no way to do this. I think it should be possible to implement a --all flag which adds a stylelint target to each project which does not contain a stylelint target.

It is not possible to automatically add stylelint targets to every new project that gets added to the workspace because there it is out of the scope of this project to extends other generators. But you can implement your own Local Plugin Generator which combines the App/Lib Generator you are using with the nx-stylelint:configuration Generator: https://nx.dev/recipes/generators/local-generators and https://nx.dev/recipes/generators/composing-generators

@SimonKunz
Copy link
Author

Hi Philip,

alright, maybe I'll have a look at the --all flag and give you a Pull Request.

I think for adding the stylelint targets to new projects I'll write a custom generator for our project as you suggested.

Thank you!

@jase88
Copy link

jase88 commented Nov 21, 2023

Hey @SimonKunz, how did you manage to make it work for new projects?
Thinking about a executor (for CI) that checks if a project contains a css or scss file, it needs to have a stylelint target

@Phillip9587
Copy link
Owner

Nx introduced the concept of plugins that can automatically add targets to projects if the project matches some criterias.

I'm working on a new version of nx-stylelint that adds the stylelint target when a .stylelintrc file is present at the project root.

I think it should be possible to make the plugin configurable to add a stylelint target with a default config to projects containing css or scss files.

@SimonKunz
Copy link
Author

@jase88 We solved it by implementing some custom NX-Generators. We needed them anyway for some other project specific tasks, so it was not a big deal for us.

But I really like the idea of a Nx plugin for nx-stylelint.

@jase88
Copy link

jase88 commented Feb 11, 2024

Would this be solved with #635 ?

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

No branches or pull requests

3 participants