[wp-trac] [WordPress Trac] #51966: npm/grunt watch/build task names are inconsistent and unintuitive
WordPress Trac
noreply at wordpress.org
Fri Dec 11 18:40:24 UTC 2020
#51966: npm/grunt watch/build task names are inconsistent and unintuitive
-----------------------------------+-------------------------------
Reporter: iandunn | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version: 5.1
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses: javascript, docs
-----------------------------------+-------------------------------
Comment (by iandunn):
That's really insightful, thanks! I hadn't heard about Zero Installs
before, but I think that's a really interesting idea. I'm wondering if
something like this would work:
* Remove the `build/` folder entirely.
* All `.php` files in `src/` stay the same. There's no longer a need to
copy them over to `build/`.
* Keep `src/js` the way it is
* (optionally) create a `src/sass` folder (cc @helen, @melchoyce)
* `src/js` files that don't require any preprocessing -- like
`dashboard.js` -- could be removed from `src/js`. Then changes to them
could be made directly to `src/wp-admin/js/bashboard.js` without having to
worry about a build step.
* We'd add built files like `src/wp-admin/js/foo.js` to `.gitignore`, so
that devs don't have to locally manage duplicate `git add`'s etc.
* We'd setup a A GitHub action to automatically compile & commit the built
files to the repo on a `post-push` hook, like @ryelle
[https://github.com/WordPress/twentytwentyone/blob/8508233/.github/workflows/build.yml
did for TwentyTwentyOne].
So the typical dev workflow would be:
1. If you're making changes to processed JS or SASS files, then you `npm
run watch`. Otherwise, you don't have to run any watch task at all.
1. Make changes to the files
1. If they're processed JS/SASS files, `watch` would compile them from
`src/js` into `src/wp-admin/js`, `src/wp-includes/js` etc.
1. `git add` the PHP, `src/js` , or `src/sass` files. The built files
won't be tracked locally, so you won't get bugged by them.
1. `git push`
1. If any `src/js` or `src/sass` files were pushed, the GH action would
compile and commit them to the PR.
Committers could `wget {PR URL}.diff`, and commit that. It'd include both
`src/js` and `src/wp-admin/js` files.
The release process would bundle up all of `src/` but ignore `src/js` and
`src/sass`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51966#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list