-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Cleanup package scripts #15497
Comments
@eps1lon I wish we could write comments in a JSON file. It would make it clearer. Each npm run command fits for a specific use case. So far, we have been partially documenting the commands in Do you have a specific pain point in mind, e.g. what changes do you refer to? |
Let me know if you need help or would like a PR to see what an nps setup looks like? There are a few options to consider:
Also, the nps init process replaces script name characters : and - with . and an uppercase, next occurring, letter (i.e. size-why => sizeWhy). The resulting scripts end up looking like below. There are ways around this, by wrapping the key's in quotes, but that seems like a dirty approach:
All that said, nps provides added functionality but also adds an additional cli. I am not sure if this makes the process any easier for a first time contributor. It would be nice if yarn supported a js filename input for the package.json scripts field as an alternative to the standard object hash of script commands. This would at least allow comments. |
@cvanem This issue is totally up for grabs. This is what the "help wanted" issue is for. The important part is that I don't want the create churn for maintainers. The old workflows shouldn't change. It's mainly directed at new contributors so that they don't feel overwhelmed when looking at the package.json and can have a single entry point. Some points ordered by importance. They are up for debate starting with point 3 and can be implemented in separate PRs:
|
For removing babel node, can you take a look at this example PR and confirm this is what you are looking for? Note the relative import paths. Also, the docs:api script links into the material-ui and material-ui-styles packages so I am not sure what the best path is for removing babel-node with that script. Can you advise? |
I was wondering how much code is shared between client and server. Seems like we only need it for component source execution. Maybe we can switch to static analysis later. PR is a good starter though. |
@eps1on For items 1-3, I like the idea of using something like nps but I don't like the extra cli. I submitted a PR to yarn for importable scripts. We will see if it gains any traction. |
I wouldn't expect to see much manual calling of |
@eps1lon I couldn't find a way to hide the nps cli without adding a bunch of aliases in the packages.json file. Is there a better way? |
For new workflows yes but
stands above all. |
Can we instead just add a new section in our documentation & document what each script does along with all it's relevant information? 🤔 💭 |
It's part of the issue, yes. The problem is that documentation becomes easily outdated. Even putting it right next to the script won't prevent it. A separate file (or gh wikis) would be even worse. Since I want to enhance the scripts anyway (+debug, +watch) it's a good opportunity to explore solutions that solve both issues (docs and better scripts). |
We currently leverage the
scripts
entry in our package.json. As of right now this includes around 34 scripts that aren't really documented. Any addition, change etc. has to be followed by contributors to be understood.It would be nice if we could consolidate those into a single place that also adds documentation. This should put emphasis on common tasks as well as guiding contributors: What script can I use to perform X task?
https://github.com/kentcdodds/nps looks very close to what I have in mind (task + description + watch mode in a single place).
Maybe there are other solutions for large monorepos. In any case it would be nice if we could improve the first contributor experience.
The text was updated successfully, but these errors were encountered: