Browse Source

check deps

Gregg Tavares 5 years ago
parent
commit
15aace692d
1 changed files with 10 additions and 0 deletions
  1. 10 0
      Gruntfile.js

+ 10 - 0
Gruntfile.js

@@ -8,6 +8,16 @@ const semver = require('semver');
 const liveEditor = require('@gfxfundamentals/live-editor');
 const liveEditorPath = path.dirname(require.resolve('@gfxfundamentals/live-editor'));
 
+function dependenciesNeedUpdating() {
+  const childProcess = require('child_process');
+  const result = JSON.parse(childProcess.execSync('npm install --dry-run --json').toString());
+  return result.added.length > 0 || result.updated.length > 0 || result.removed > 0;
+}
+
+if (dependenciesNeedUpdating()) {
+  throw new Error('dependencies need updating. Please run `npm install`');
+}
+
 module.exports = function(grunt) {
 
   require('load-grunt-tasks')(grunt);