diff --git a/.gitignore b/.gitignore index 2f4d4eb9d2..01757f7a0b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ wp-tests-config.php /src/wp-includes/css/dist /src/wp-includes/css/*.min.css /src/wp-includes/css/*-rtl.css +/packagehash.txt # Files and folders that get created in wp-content /src/wp-content/blogs.dir diff --git a/Gruntfile.js b/Gruntfile.js index a490af6b4b..cb263c8bd8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,6 +2,7 @@ /* jshint esversion: 6 */ /* globals Set */ var webpackConfig = require( './webpack.config' ); +var installChanged = require( 'install-changed' ); module.exports = function(grunt) { var path = require('path'), @@ -41,6 +42,9 @@ module.exports = function(grunt) { ); } + // First do `npm install` if package.json has changed. + installChanged.watchPackage(); + // Load tasks. require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks ); // Load legacy utils. diff --git a/package-lock.json b/package-lock.json index f5d5ef6880..f575ae788e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11784,6 +11784,12 @@ } } }, + "install-changed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/install-changed/-/install-changed-1.1.0.tgz", + "integrity": "sha512-APUWMdQnwGcyv9bmuvgxCcrR6qtD996+hofEEAPGSjsvGIZuBpBF0yrYAKOl9tmhm2AzxJC4EXUbxZ/SId4NIA==", + "dev": true + }, "internal-ip": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", diff --git a/package.json b/package.json index 4913df6ac8..f7156cd3c1 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "grunt-sass": "~3.1.0", "grunt-webpack": "^3.1.3", "ink-docstrap": "1.3.2", + "install-changed": "1.1.0", "jquery-migrate": "1.4.1", "matchdep": "~2.0.0", "node-sass": "~4.13.1",