Make WordPress Core

Changeset 45445


Ignore:
Timestamp:
05/26/2019 07:34:24 PM (7 years ago)
Author:
johnbillion
Message:

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

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/.travis.yml

    r45058 r45445  
    9090- node --version
    9191- nvm install 10.13.0
    92 - npm install -g grunt-cli
    9392- npm install
    9493- npm prune
    … …  
    102101- phpunit --version
    103102- curl --version
    104 - grunt --version
    105103- git --version
    106104- svn --version
    107105- locale -a
    108 script: grunt $WP_TRAVISCI
     106script: npm run grunt $WP_TRAVISCI
    109107after_script:
    110108- |
  • trunk/appveyor.yml

    r44599 r45445  
    1212  - ps: Install-Product node $env:nodejs_version
    1313  - npm install npm -g
    14   - npm install grunt-cli -g
    1514  - npm install
    1615
    … …  
    2019
    2120build_script:
    22   - cmd: "grunt build"
     21  - cmd: "npm run build"
    2322
    2423test: off
  • trunk/package.json

    r45342 r45445  
    2020                "copy-webpack-plugin": "^4.6.0",
    2121                "cssnano": "4.1.8",
    22                 "grunt": "~1.0.3",
     22                "grunt": "1.0.4",
    2323                "grunt-banner": "^0.6.0",
    2424                "grunt-contrib-clean": "~2.0.0",
    … …  
    4747                "node-sass": "~4.12.0",
    4848                "source-map-loader": "^0.2.4",
    49                 "uglify-js": "^3.4.9",
     49                "uglify-js": "3.5.15",
    5050                "uglifyjs-webpack-plugin": "2.1.1",
    5151                "webpack": "4.29.2",
    … …  
    114114        },
    115115        "scripts": {
     116                "build": "grunt build",
     117                "dev": "grunt build --dev",
     118                "test": "grunt test",
     119                "watch": "grunt watch",
    116120                "grunt": "grunt"
    117121        }
  • trunk/src/index.php

    r45190 r45445  
    3535$die .= '<p>' . sprintf(
    3636        /* translators: %s: npm install */
    37         __( 'Before running any grunt tasks you need to make sure the dependencies are installed. You can install these by running %s.' ),
     37        __( 'Before running any build tasks you need to make sure the dependencies are installed. You can install these by running %s.' ),
    3838        '<code style="color: green;">npm install</code>'
    3939) . '</p>';
    … …  
    4141$die .= '<ul>';
    4242$die .= '<li>' . __( 'To build WordPress while developing, run:' ) . '<br /><br />';
    43 $die .= '<code style="color: green;">grunt build --dev</code></li>';
     43$die .= '<code style="color: green;">npm run dev</code></li>';
    4444$die .= '<li>' . __( 'To build files automatically when changing the source files, run:' ) . '<br /><br />';
    45 $die .= '<code style="color: green;">grunt watch</code></li>';
     45$die .= '<code style="color: green;">npm run watch</code></li>';
    4646$die .= '<li>' . __( 'To create a production build of WordPress, run:' ) . '<br /><br />';
    47 $die .= '<code style="color: green;">grunt build</code></li>';
     47$die .= '<code style="color: green;">npm run build</code></li>';
    4848$die .= '</ul>';
    4949
    5050$die .= '<p>' . sprintf(
    51         /* translators: 1: NPM URL, 2: Grunt URL, 3: Handbook URL */
    52         __( '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>.' ),
     51        /* translators: 1: NPM URL, 2: Handbook URL */
     52        __( 'This requires <a href="%1$s">NPM</a>. <a href="%2$s">Read more about setting up your local development environment</a>.' ),
    5353        'https://www.npmjs.com/get-npm',
    54         'https://gruntjs.com/getting-started',
    5554        __( 'https://make.wordpress.org/core/handbook/tutorials/installing-wordpress-locally/' )
    5655) . '</p>';
  • trunk/src/wp-includes/embed.php

    r45037 r45445  
    447447                /*
    448448                 * If you're looking at a src version of this file, you'll see an "include"
    449                  * statement below. This is used by the `grunt build` process to directly
     449                 * statement below. This is used by the `npm run build` process to directly
    450450                 * include a minified version of wp-embed.js, instead of using the
    451451                 * file_get_contents() method from above.
    … …  
    10091009                /*
    10101010                 * If you're looking at a src version of this file, you'll see an "include"
    1011                  * statement below. This is used by the `grunt build` process to directly
     1011                 * statement below. This is used by the `npm run build` process to directly
    10121012                 * include a minified version of wp-oembed-embed.css, instead of using the
    10131013                 * readfile() method from above.
    … …  
    10401040                /*
    10411041                 * If you're looking at a src version of this file, you'll see an "include"
    1042                  * statement below. This is used by the `grunt build` process to directly
     1042                 * statement below. This is used by the `npm run build` process to directly
    10431043                 * include a minified version of wp-embed-template.js, instead of using the
    10441044                 * readfile() method from above.
  • trunk/src/wp-includes/formatting.php

    r45424 r45445  
    55215521                /*
    55225522                 * If you're looking at a src version of this file, you'll see an "include"
    5523                  * statement below. This is used by the `grunt build` process to directly
     5523                 * statement below. This is used by the `npm run build` process to directly
    55245524                 * include a minified version of wp-emoji-loader.js, instead of using the
    55255525                 * readfile() method from above.
    … …  
    57375737 *
    57385738 * These arrays are automatically built from the regex in twemoji.js - if they need to be updated,
    5739  * you should update the regex there, then run the `grunt precommit:emoji` job.
     5739 * you should update the regex there, then run the `npm run grunt precommit:emoji` job.
    57405740 *
    57415741 * @since 4.9.0
  • trunk/tests/phpunit/includes/bootstrap.php

    r45020 r45445  
    4848
    4949if ( defined( 'WP_RUN_CORE_TESTS' ) && WP_RUN_CORE_TESTS && ! is_dir( ABSPATH ) ) {
    50         echo "ERROR: The /build/ directory is missing! Please run `grunt build` prior to running PHPUnit.\n";
     50        echo "ERROR: The /build/ directory is missing! Please run `npm run build` prior to running PHPUnit.\n";
    5151        exit( 1 );
    5252}
  • trunk/tests/phpunit/tests/oembed/template.php

    r43571 r45445  
    310310         * In many cases, this file will not exist; in those cases, we simply skip the test.
    311311         *
    312          * So when would it be run? We have Travis CI run `grunt test` which then runs, in order,
     312         * So when would it be run? We have Travis CI run `npm run test` which then runs, in order,
    313313         * `qunit:compiled` (which runs the build) and then `phpunit`. Thus, this test will at least be
    314314         * run during continuous integration.
Note: See TracChangeset for help on using the changeset viewer.