mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Multi-dest the LICENCE file
This commit is contained in:
58
gruntfile.js
58
gruntfile.js
@ -58,6 +58,22 @@ module.exports = function(grunt) {
|
|||||||
return content;
|
return content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var getSubDirs = function(dir) {
|
||||||
|
var allObjects = fs.readdirSync(dir);
|
||||||
|
var allDirs = [];
|
||||||
|
for (var i=0; i<allObjects.length; i++)
|
||||||
|
{
|
||||||
|
var currentObjName = allObjects[i];
|
||||||
|
var currentObjPath = pathModule.join(dir, currentObjName);
|
||||||
|
var stats = fs.statSync(currentObjPath);
|
||||||
|
if (stats.isDirectory())
|
||||||
|
{
|
||||||
|
allDirs.push({name: currentObjName, path: currentObjPath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allDirs;
|
||||||
|
}
|
||||||
|
|
||||||
var localCfg = {
|
var localCfg = {
|
||||||
srcDir: ".",
|
srcDir: ".",
|
||||||
srcAppsDir: "./apps",
|
srcAppsDir: "./apps",
|
||||||
@ -129,6 +145,12 @@ module.exports = function(grunt) {
|
|||||||
dest: "<%= localCfg.outModulesDir %>/",
|
dest: "<%= localCfg.outModulesDir %>/",
|
||||||
cwd: localCfg.srcDir
|
cwd: localCfg.srcDir
|
||||||
},
|
},
|
||||||
|
appLicense: {
|
||||||
|
expand: true,
|
||||||
|
src: ["./LICENSE"],
|
||||||
|
cwd: localCfg.srcAppsDir,
|
||||||
|
dest: "__dummy__"
|
||||||
|
},
|
||||||
definitionFiles: {
|
definitionFiles: {
|
||||||
src: [
|
src: [
|
||||||
localCfg.srcDir + "/**/*.d.ts",
|
localCfg.srcDir + "/**/*.d.ts",
|
||||||
@ -188,7 +210,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
readyAppFiles: {
|
readyAppFiles: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: ["./**/*.*", "../LICENSE"],
|
src: ["./**/*.*"],
|
||||||
dest: localCfg.outAppsDir + "/",
|
dest: localCfg.outAppsDir + "/",
|
||||||
cwd: localCfg.outModulesDir + "/apps/",
|
cwd: localCfg.outModulesDir + "/apps/",
|
||||||
options: {
|
options: {
|
||||||
@ -197,7 +219,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
readyTsAppFiles: {
|
readyTsAppFiles: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: ["./**/*.*", "!./**/*.map", "../LICENSE"],
|
src: ["./**/*.*", "!./**/*.map"],
|
||||||
dest: localCfg.outTsAppsDir + "/",
|
dest: localCfg.outTsAppsDir + "/",
|
||||||
cwd: localCfg.srcAppsDir
|
cwd: localCfg.srcAppsDir
|
||||||
},
|
},
|
||||||
@ -246,6 +268,20 @@ module.exports = function(grunt) {
|
|||||||
cmd: "npm pack",
|
cmd: "npm pack",
|
||||||
cwd: "__dummy__"
|
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-contrib-copy");
|
||||||
grunt.loadNpmTasks("grunt-exec");
|
grunt.loadNpmTasks("grunt-exec");
|
||||||
grunt.loadNpmTasks("grunt-tslint");
|
grunt.loadNpmTasks("grunt-tslint");
|
||||||
|
grunt.loadNpmTasks("grunt-multi-dest");
|
||||||
var getSubDirs = function(dir) {
|
|
||||||
var allObjects = fs.readdirSync(dir);
|
|
||||||
var allDirs = [];
|
|
||||||
for (var i=0; i<allObjects.length; i++)
|
|
||||||
{
|
|
||||||
var currentObjName = allObjects[i];
|
|
||||||
var currentObjPath = pathModule.join(dir, currentObjName);
|
|
||||||
var stats = fs.statSync(currentObjPath);
|
|
||||||
if (stats.isDirectory())
|
|
||||||
{
|
|
||||||
allDirs.push({name: currentObjName, path: currentObjPath});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return allDirs;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cloneTasks = function(originalTasks, taskNameSuffix)
|
var cloneTasks = function(originalTasks, taskNameSuffix)
|
||||||
{
|
{
|
||||||
@ -333,6 +354,7 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
grunt.registerTask("collect-apps-raw-files", [
|
grunt.registerTask("collect-apps-raw-files", [
|
||||||
"copy:rawAppsFiles",
|
"copy:rawAppsFiles",
|
||||||
|
"multidest:copyLicenseFiles"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Does nothing to avoid copying the same files twice. Instead,
|
// Does nothing to avoid copying the same files twice. Instead,
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
"grunt-contrib-clean": "0.5.0",
|
"grunt-contrib-clean": "0.5.0",
|
||||||
"grunt-contrib-copy": "0.5.0",
|
"grunt-contrib-copy": "0.5.0",
|
||||||
"grunt-exec": "0.4.5",
|
"grunt-exec": "0.4.5",
|
||||||
|
"grunt-multi-dest": "1.0.0",
|
||||||
"grunt-ts": "1.12.1",
|
"grunt-ts": "1.12.1",
|
||||||
"grunt-tslint": "0.4.2",
|
"grunt-tslint": "0.4.2",
|
||||||
"typescript": "1.4.1"
|
"typescript": "1.4.1"
|
||||||
|
Reference in New Issue
Block a user