refactor: add license header to JS files & format files (#12035)

This commit is contained in:
Victor Berchet
2016-10-04 13:15:49 -07:00
committed by Chuck Jazdzewski
parent b64b5ece65
commit 8310c91823
73 changed files with 1174 additions and 948 deletions

View File

@ -1,3 +1,11 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var fs = require('fs');
var path = require('path');
@ -8,8 +16,7 @@ module.exports = function(gulp, plugins, config) {
console.log('creating link', linkDir, sourceDir);
try {
fs.symlinkSync(sourceDir, linkDir, 'dir');
}
catch(e) {
} catch (e) {
var sourceDir = path.join(config.dir, relativeFolder);
console.log('linking failed: trying to hard copy', linkDir, sourceDir);
copyRecursiveSync(sourceDir, linkDir);
@ -35,14 +42,13 @@ module.exports = function(gulp, plugins, config) {
};
};
function copyRecursiveSync (src, dest) {
function copyRecursiveSync(src, dest) {
if (fs.existsSync(src)) {
var stats = fs.statSync(src);
if (stats.isDirectory()) {
fs.mkdirSync(dest);
fs.readdirSync(src).forEach(function(childItemName) {
copyRecursiveSync(path.join(src, childItemName),
path.join(dest, childItemName));
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
});
} else {
fs.writeFileSync(dest, fs.readFileSync(src));