Opened 6 years ago
Closed 6 years ago
#45214 closed enhancement (fixed)
Add a build npm script
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.0 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Build/Test Tools | Keywords: | has-patch fixed-5.0 |
Focuses: | Cc: |
Description
Currently, in order to run the build step for WordPress core files, Grunt must be installed globally. This requirement can be removed by making use of npm scripts to run
grunt build
as npm scripts adds executables to the PATH. In addition to not requiring Grunt to be installed globally, this has the added benefit of ensuring the version of Grunt run is consistent as the version in node_modules
is managed with npm whereas users likely have a different version installed globally.
Attachments (1)
Change History (9)
#1
@
6 years ago
The attached patch file adds a build
npm script that maps to grunt
. This allows npm run build
to be used to build WordPress core files without requiring Grunt to be installed globally, assuming npm install
has been run.
#3
@
6 years ago
- Milestone changed from Awaiting Review to 5.0
- Owner set to pento
- Status changed from new to assigned
Thank you for the suggestion, @andrew.taylor!
This is a useful shortcut to using Grunt, I don't think we need to shortcuts for every grunt task now, as npm
defaults to passing any extra parameters to the script.
With that in mind, I'm going to tweak your patch slightly to rename it to grunt
, so npm run grunt ...
is effectively the same as running grunt ...
.
#6
@
6 years ago
Thank you @pento for getting this in. Is there anything I can do to help update documentation? There seem to be quite a few handbook pages referencing Grunt. Testing a patch specifically comes to mind as something new contributors will be looking at that suggests installing Grunt globally. The goal here is to make that unnecessary.
Patch file to add a "build" npm script