diff --git a/Gruntfile.js b/Gruntfile.js index 0c90ee35763..b41ffd7283a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -347,6 +347,7 @@ module.exports = function (grunt) { /*'cssmin',*/ /*'uglify',*/ 'copy', + 'npm-install', 'cleanempty', 'usemin', 'build-config' diff --git a/src/config.json b/src/config.json index d770f6f108c..1d84d0ef8b8 100644 --- a/src/config.json +++ b/src/config.json @@ -35,6 +35,10 @@ "branch": "", "SHA": "" }, + "dependencies": { + "anymatch": "1.3.0", + "chokidar": "1.6.0" + }, "devDependencies": { "grunt": "0.4.5", "jasmine-node": "1.11.0", diff --git a/tasks/npm-install.js b/tasks/npm-install.js new file mode 100644 index 00000000000..504704fb008 --- /dev/null +++ b/tasks/npm-install.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 - present Adobe Systems Incorporated. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +/*jslint node: true */ + +module.exports = function (grunt) { + "use strict"; + + var common = require("./lib/common")(grunt), + build = require("./build")(grunt); + + // task: write-config + grunt.registerTask("npm-install", "Install node_modules to the dist folder so it gets bundled with release", function () { + var packageJSON = grunt.file.readJSON("package.json"); + delete packageJSON.devDependencies; + delete packageJSON.scripts; // we don't want to run post-install scripts in dist folder + common.writeJSON(grunt, "dist/package.json", packageJSON); + + var exec = require('child_process').exec; + var done = this.async(); + exec('npm install --production', { cwd: './dist' }, function(err, stdout, stderr) { + if (err) { + grunt.log.error(stderr); + done(false); + } else { + grunt.log.writeln(stdout); + done(); + } + }); + }); + +};