-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Packages: Extract @wordpress/scripts-utils package #21503
Conversation
be8c816
to
c804aa1
Compare
Size Change: 0 B Total Size: 845 kB ℹ️ View Unchanged
|
c804aa1
to
66ac342
Compare
I'm typically not opposed to breaking down shared code to small shared libraries. I do feel the use-cases are pretty limited and solving very specific problems. There's probably not much usability outside these modules? I could see it being more useful if the methods (and the package itself) were targeted toward more generic "does X file exist in the project directory", "is X given as a CLI argument". Even these are pretty unique / distinct. Some of them exist here, but then there are others which are very specific like Also, I've been trying unsuccessfully to kill off |
Well, I can’t counter argument this 😃
The one mentioned is the most important one.
As noted, it plays its role in a few places for better or worse 😅 |
da2a9f0
to
ba42a81
Compare
ba42a81
to
c4da841
Compare
Something still isn't sitting quite well with me about this. I think it's my dislike of the term "utils", which to me almost always may as well be substituted with "stuff" as assorted miscellany. And I don't think assorted miscellany makes for a good package. For me, I'd prefer if we'd do one of:
As an extension of previous conversations, I think I can see how it could be organized in a way where we could have one (or even more) packages for:
|
I have to agree with you. In the past, I disbanded I like your proposal of how those utilities could be divided. I guess it’s find to wait until we really want to reuse this functionality in Gutenberg. Thank you for all the feedback, let’s close this PR. I merged 2 PRs regardless with your help that solve some of the issues that triggered this exploration 😃 |
Description
New npm package
@wordpress/scripts-utils
that exposed general-purpose utilities to use with other packages. Methods included:fromProjectRoot
getArgFromCLI
getArgsFromCLI
getFileArgsFromCLI
hasArgInCLI
hasFileArgInCLI
hasPackageProp
hasProjectFile
I plan to document all those methods separately together with TypeScript in JSDoc integration.
How has this been tested?
Travis should be green and all existing
wp-scripts
should work as before.In fact, we use almost all features included in
wp-scripts
so it self-tests :)Checklist: