From 7c794d24dc45a594497ff63edf8366286278fde1 Mon Sep 17 00:00:00 2001 From: Brendon Boshell Date: Thu, 9 Mar 2017 12:37:04 +0000 Subject: [PATCH] Make grunt build compatible with latest version of npm --- Gruntfile.js | 5 ++--- package.json | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 0253599a2..1ea312672 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,6 @@ var path = require("path"), fs = require("fs"), + parentFolderName = path.basename(path.resolve('..')), mxClientContent, deps; @@ -88,9 +89,7 @@ module.exports = function (grunt) { }, }); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-webpack'); - grunt.loadNpmTasks('grunt-contrib-concat'); + require(parentFolderName === "node_modules" ? "load-grunt-parent-tasks" : "load-grunt-tasks")(grunt); grunt.registerTask("default", [ "copy", "concat", diff --git a/package.json b/package.json index 36d635dec..e0625bbed 100644 --- a/package.json +++ b/package.json @@ -3,13 +3,15 @@ "version": "3.7.1", "main": "./javascript/dist/build.js", "scripts": { - "install": "grunt build" + "postinstall": "grunt build" }, "dependencies": { "grunt": "^1.0.1", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", "grunt-webpack": "^2.0.1", + "load-grunt-parent-tasks": "^0.1.1", + "load-grunt-tasks": "^3.5.2", "webpack": "^2.2.1" } }