Build/Test Tools: Remove the dependency on a globally installed Grunt.
The existing `"grunt": "grunt"` script in `package.json` allows for the use of `npm run grunt ...` which uses the local `grunt` binary in the project's `node_modules`. Fixes #47380 git-svn-id: https://develop.svn.wordpress.org/trunk@45445 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
68f7c2d7a5
commit
814aa7149f
@ -89,7 +89,6 @@ before_script:
|
||||
- npm --version
|
||||
- node --version
|
||||
- nvm install 10.13.0
|
||||
- npm install -g grunt-cli
|
||||
- npm install
|
||||
- npm prune
|
||||
- mysql --version
|
||||
@ -101,11 +100,10 @@ before_script:
|
||||
- which phpunit
|
||||
- phpunit --version
|
||||
- curl --version
|
||||
- grunt --version
|
||||
- git --version
|
||||
- svn --version
|
||||
- locale -a
|
||||
script: grunt $WP_TRAVISCI
|
||||
script: npm run grunt $WP_TRAVISCI
|
||||
after_script:
|
||||
- |
|
||||
if [[ "$WP_TEST_REPORTER" == "true" ]]; then
|
||||
|
@ -11,7 +11,6 @@ branches:
|
||||
install:
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
- npm install npm -g
|
||||
- npm install grunt-cli -g
|
||||
- npm install
|
||||
|
||||
before_build:
|
||||
@ -19,7 +18,7 @@ before_build:
|
||||
- npm --version
|
||||
|
||||
build_script:
|
||||
- cmd: "grunt build"
|
||||
- cmd: "npm run build"
|
||||
|
||||
test: off
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
"check-node-version": "3.2.0",
|
||||
"copy-webpack-plugin": "^4.6.0",
|
||||
"cssnano": "4.1.8",
|
||||
"grunt": "~1.0.3",
|
||||
"grunt": "1.0.4",
|
||||
"grunt-banner": "^0.6.0",
|
||||
"grunt-contrib-clean": "~2.0.0",
|
||||
"grunt-contrib-concat": "~1.0.0",
|
||||
@ -46,7 +46,7 @@
|
||||
"matchdep": "~2.0.0",
|
||||
"node-sass": "~4.12.0",
|
||||
"source-map-loader": "^0.2.4",
|
||||
"uglify-js": "^3.4.9",
|
||||
"uglify-js": "3.5.15",
|
||||
"uglifyjs-webpack-plugin": "2.1.1",
|
||||
"webpack": "4.29.2",
|
||||
"webpack-dev-server": "3.1.14",
|
||||
@ -113,6 +113,10 @@
|
||||
"whatwg-fetch": "3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "grunt build",
|
||||
"dev": "grunt build --dev",
|
||||
"test": "grunt test",
|
||||
"watch": "grunt watch",
|
||||
"grunt": "grunt"
|
||||
}
|
||||
}
|
||||
|
@ -34,24 +34,23 @@ $die = __( 'You are running WordPress without JavaScript and CSS files. These ne
|
||||
|
||||
$die .= '<p>' . sprintf(
|
||||
/* translators: %s: npm install */
|
||||
__( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running %s.' ),
|
||||
__( 'Before running any build tasks you need to make sure the dependencies are installed. You can install these by running %s.' ),
|
||||
'<code style="color: green;">npm install</code>'
|
||||
) . '</p>';
|
||||
|
||||
$die .= '<ul>';
|
||||
$die .= '<li>' . __( 'To build WordPress while developing, run:' ) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build --dev</code></li>';
|
||||
$die .= '<code style="color: green;">npm run dev</code></li>';
|
||||
$die .= '<li>' . __( 'To build files automatically when changing the source files, run:' ) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt watch</code></li>';
|
||||
$die .= '<code style="color: green;">npm run watch</code></li>';
|
||||
$die .= '<li>' . __( 'To create a production build of WordPress, run:' ) . '<br /><br />';
|
||||
$die .= '<code style="color: green;">grunt build</code></li>';
|
||||
$die .= '<code style="color: green;">npm run build</code></li>';
|
||||
$die .= '</ul>';
|
||||
|
||||
$die .= '<p>' . sprintf(
|
||||
/* translators: 1: NPM URL, 2: Grunt URL, 3: Handbook URL */
|
||||
__( 'This requires <a href="%1$s">NPM</a> and <a href="%2$s">Grunt</a>. <a href="%3$s">Read more about setting up your local development environment</a>.' ),
|
||||
/* translators: 1: NPM URL, 2: Handbook URL */
|
||||
__( 'This requires <a href="%1$s">NPM</a>. <a href="%2$s">Read more about setting up your local development environment</a>.' ),
|
||||
'https://www.npmjs.com/get-npm',
|
||||
'https://gruntjs.com/getting-started',
|
||||
__( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )
|
||||
) . '</p>';
|
||||
|
||||
|
@ -446,7 +446,7 @@ function get_post_embed_html( $width, $height, $post = null ) {
|
||||
} else {
|
||||
/*
|
||||
* If you're looking at a src version of this file, you'll see an "include"
|
||||
* statement below. This is used by the `grunt build` process to directly
|
||||
* statement below. This is used by the `npm run build` process to directly
|
||||
* include a minified version of wp-embed.js, instead of using the
|
||||
* file_get_contents() method from above.
|
||||
*
|
||||
@ -1008,7 +1008,7 @@ function print_embed_styles() {
|
||||
} else {
|
||||
/*
|
||||
* If you're looking at a src version of this file, you'll see an "include"
|
||||
* statement below. This is used by the `grunt build` process to directly
|
||||
* statement below. This is used by the `npm run build` process to directly
|
||||
* include a minified version of wp-oembed-embed.css, instead of using the
|
||||
* readfile() method from above.
|
||||
*
|
||||
@ -1039,7 +1039,7 @@ function print_embed_scripts() {
|
||||
} else {
|
||||
/*
|
||||
* If you're looking at a src version of this file, you'll see an "include"
|
||||
* statement below. This is used by the `grunt build` process to directly
|
||||
* statement below. This is used by the `npm run build` process to directly
|
||||
* include a minified version of wp-embed-template.js, instead of using the
|
||||
* readfile() method from above.
|
||||
*
|
||||
|
@ -5520,7 +5520,7 @@ function _print_emoji_detection_script() {
|
||||
|
||||
/*
|
||||
* If you're looking at a src version of this file, you'll see an "include"
|
||||
* statement below. This is used by the `grunt build` process to directly
|
||||
* statement below. This is used by the `npm run build` process to directly
|
||||
* include a minified version of wp-emoji-loader.js, instead of using the
|
||||
* readfile() method from above.
|
||||
*
|
||||
@ -5736,7 +5736,7 @@ function wp_staticize_emoji_for_email( $mail ) {
|
||||
* Returns arrays of emoji data.
|
||||
*
|
||||
* These arrays are automatically built from the regex in twemoji.js - if they need to be updated,
|
||||
* you should update the regex there, then run the `grunt precommit:emoji` job.
|
||||
* you should update the regex there, then run the `npm run grunt precommit:emoji` job.
|
||||
*
|
||||
* @since 4.9.0
|
||||
* @access private
|
||||
|
@ -47,7 +47,7 @@ if ( version_compare( tests_get_phpunit_version(), '8.0', '>=' ) ) {
|
||||
}
|
||||
|
||||
if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
|
||||
echo "ERROR: The /build/ directory is missing! Please run `grunt build` prior to running PHPUnit.\n";
|
||||
echo "ERROR: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ class Tests_Embed_Template extends WP_UnitTestCase {
|
||||
* So this test checks for ampersands in build/wp-includes/js/wp-embed.min.js.
|
||||
* In many cases, this file will not exist; in those cases, we simply skip the test.
|
||||
*
|
||||
* So when would it be run? We have Travis CI run `grunt test` which then runs, in order,
|
||||
* So when would it be run? We have Travis CI run `npm run test` which then runs, in order,
|
||||
* `qunit:compiled` (which runs the build) and then `phpunit`. Thus, this test will at least be
|
||||
* run during continuous integration.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user