From a5a95de3fa8916f96217a2eca64895224a82bbfc Mon Sep 17 00:00:00 2001 From: Erjan Gavalji Date: Fri, 27 Mar 2015 16:01:13 +0200 Subject: [PATCH] Multi-dest the LICENCE file --- gruntfile.js | 58 ++++++++++++++++++++++++++++++++++++---------------- package.json | 1 + 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/gruntfile.js b/gruntfile.js index a0a275cad..4eef7ca85 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -58,6 +58,22 @@ module.exports = function(grunt) { return content; }; + var getSubDirs = function(dir) { + var allObjects = fs.readdirSync(dir); + var allDirs = []; + for (var i=0; i/", cwd: localCfg.srcDir }, + appLicense: { + expand: true, + src: ["./LICENSE"], + cwd: localCfg.srcAppsDir, + dest: "__dummy__" + }, definitionFiles: { src: [ localCfg.srcDir + "/**/*.d.ts", @@ -188,7 +210,7 @@ module.exports = function(grunt) { }, readyAppFiles: { expand: true, - src: ["./**/*.*", "../LICENSE"], + src: ["./**/*.*"], dest: localCfg.outAppsDir + "/", cwd: localCfg.outModulesDir + "/apps/", options: { @@ -197,7 +219,7 @@ module.exports = function(grunt) { }, readyTsAppFiles: { expand: true, - src: ["./**/*.*", "!./**/*.map", "../LICENSE"], + src: ["./**/*.*", "!./**/*.map"], dest: localCfg.outTsAppsDir + "/", cwd: localCfg.srcAppsDir }, @@ -246,6 +268,20 @@ module.exports = function(grunt) { cmd: "npm pack", cwd: "__dummy__" } + }, + multidest: { + copyLicenseFiles: { + tasks: ["copy:appLicense"], + dest: function() { + var apps = getSubDirs(localCfg.srcAppsDir); + var targetDirs = []; + apps.forEach(function(item){ + targetDirs.push(pathModule.join(localCfg.outAppsDir, item.name)); + targetDirs.push(pathModule.join(localCfg.outTsAppsDir, item.name)); + }); + return targetDirs; + }() + } } }); @@ -254,22 +290,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-contrib-copy"); grunt.loadNpmTasks("grunt-exec"); grunt.loadNpmTasks("grunt-tslint"); - - var getSubDirs = function(dir) { - var allObjects = fs.readdirSync(dir); - var allDirs = []; - for (var i=0; i