chore(build): remove obsolete html.js, copy.js, srcFolderInsertion.
This commit is contained in:
parent
db97d73c3b
commit
ef6e0d8eb8
63
gulpfile.js
63
gulpfile.js
@ -10,7 +10,6 @@ var path = require('path');
|
|||||||
var gulpTraceur = require('./tools/transpiler/gulp-traceur');
|
var gulpTraceur = require('./tools/transpiler/gulp-traceur');
|
||||||
var clean = require('./tools/build/clean');
|
var clean = require('./tools/build/clean');
|
||||||
var transpile = require('./tools/build/transpile');
|
var transpile = require('./tools/build/transpile');
|
||||||
var html = require('./tools/build/html');
|
|
||||||
var pubget = require('./tools/build/pubget');
|
var pubget = require('./tools/build/pubget');
|
||||||
var linknodemodules = require('./tools/build/linknodemodules');
|
var linknodemodules = require('./tools/build/linknodemodules');
|
||||||
var pubbuild = require('./tools/build/pubbuild');
|
var pubbuild = require('./tools/build/pubbuild');
|
||||||
@ -18,7 +17,6 @@ var dartanalyzer = require('./tools/build/dartanalyzer');
|
|||||||
var jsserve = require('./tools/build/jsserve');
|
var jsserve = require('./tools/build/jsserve');
|
||||||
var pubserve = require('./tools/build/pubserve');
|
var pubserve = require('./tools/build/pubserve');
|
||||||
var rundartpackage = require('./tools/build/rundartpackage');
|
var rundartpackage = require('./tools/build/rundartpackage');
|
||||||
var copy = require('./tools/build/copy');
|
|
||||||
var file2moduleName = require('./tools/build/file2modulename');
|
var file2moduleName = require('./tools/build/file2modulename');
|
||||||
var karma = require('karma').server;
|
var karma = require('karma').server;
|
||||||
var minimist = require('minimist');
|
var minimist = require('minimist');
|
||||||
@ -94,22 +92,6 @@ var COMMON_PACKAGE_JSON = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var SRC_FOLDER_INSERTION = {
|
|
||||||
js: {
|
|
||||||
'**': ''
|
|
||||||
},
|
|
||||||
dart: {
|
|
||||||
'**': 'lib',
|
|
||||||
'*/test/**': '',
|
|
||||||
'benchmarks/**': 'web',
|
|
||||||
'benchmarks/test/**': '',
|
|
||||||
'benchmarks_external/**': 'web',
|
|
||||||
'benchmarks_external/test/**': '',
|
|
||||||
'example*/**': 'web',
|
|
||||||
'example*/test/**': ''
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var CONFIG = {
|
var CONFIG = {
|
||||||
dest: {
|
dest: {
|
||||||
js: {
|
js: {
|
||||||
@ -128,7 +110,6 @@ var CONFIG = {
|
|||||||
dart: 'dist/dart',
|
dart: 'dist/dart',
|
||||||
docs: 'dist/docs'
|
docs: 'dist/docs'
|
||||||
},
|
},
|
||||||
srcFolderInsertion: SRC_FOLDER_INSERTION,
|
|
||||||
transpile: {
|
transpile: {
|
||||||
src: {
|
src: {
|
||||||
js: ['modules/**/*.js', 'modules/**/*.es6'],
|
js: ['modules/**/*.js', 'modules/**/*.es6'],
|
||||||
@ -178,19 +159,6 @@ var CONFIG = {
|
|||||||
pipes: {}
|
pipes: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dart: {
|
|
||||||
src: [
|
|
||||||
'modules/**/*.md', '!modules/**/*.js.md', 'modules/**/*.png', 'modules/**/*.html',
|
|
||||||
'modules/**/*.dart', 'modules/*/pubspec.yaml', 'modules/**/*.css', '!modules/**/e2e_test/**'
|
|
||||||
],
|
|
||||||
pipes: {
|
|
||||||
'**/*.dart': util.insertSrcFolder(gulpPlugins, SRC_FOLDER_INSERTION.dart),
|
|
||||||
'**/*.dart.md': gulpPlugins.rename(function(file) {
|
|
||||||
file.basename = file.basename.substring(0, file.basename.lastIndexOf('.'));
|
|
||||||
}),
|
|
||||||
'**/pubspec.yaml': gulpPlugins.template({ 'packageJson': COMMON_PACKAGE_JSON })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
multicopy: {
|
multicopy: {
|
||||||
js: {
|
js: {
|
||||||
@ -298,36 +266,6 @@ gulp.task('build/tree.dart', ['build.broccoli.tools'], function() {
|
|||||||
return getBroccoli().forDartTree().buildOnce();
|
return getBroccoli().forDartTree().buildOnce();
|
||||||
});
|
});
|
||||||
|
|
||||||
// ------------
|
|
||||||
// html
|
|
||||||
|
|
||||||
gulp.task('build/html.dart', html(gulp, gulpPlugins, {
|
|
||||||
src: CONFIG.html.src.dart,
|
|
||||||
dest: CONFIG.dest.dart,
|
|
||||||
srcFolderInsertion: CONFIG.srcFolderInsertion.dart,
|
|
||||||
scriptsPerFolder: CONFIG.html.scriptsPerFolder.dart
|
|
||||||
}));
|
|
||||||
|
|
||||||
// ------------
|
|
||||||
// copy
|
|
||||||
|
|
||||||
gulp.task('build/copy.dart', copy.copy(gulp, gulpPlugins, {
|
|
||||||
src: CONFIG.copy.dart.src,
|
|
||||||
pipes: CONFIG.copy.dart.pipes,
|
|
||||||
dest: CONFIG.dest.dart
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
// ------------
|
|
||||||
// multicopy
|
|
||||||
|
|
||||||
gulp.task('build/multicopy.dart', copy.multicopy(gulp, gulpPlugins, {
|
|
||||||
src: CONFIG.multicopy.dart.src,
|
|
||||||
pipes: CONFIG.multicopy.dart.pipes,
|
|
||||||
exclude: CONFIG.multicopy.dart.exclude,
|
|
||||||
dest: CONFIG.dest.dart
|
|
||||||
}));
|
|
||||||
|
|
||||||
// ------------
|
// ------------
|
||||||
// pubspec
|
// pubspec
|
||||||
|
|
||||||
@ -577,7 +515,6 @@ gulp.task('test.unit.cjs', ['build.js.cjs'], function () {
|
|||||||
var relPath = path.relative(__dirname, event.path).replace(/\\/g, "/");
|
var relPath = path.relative(__dirname, event.path).replace(/\\/g, "/");
|
||||||
gulp.src(relPath)
|
gulp.src(relPath)
|
||||||
.pipe(gulpPlugins.rename({extname: '.'+ 'js'}))
|
.pipe(gulpPlugins.rename({extname: '.'+ 'js'}))
|
||||||
.pipe(util.insertSrcFolder(gulpPlugins, CONFIG.srcFolderInsertion.js))
|
|
||||||
.pipe(gulpTraceur(CONFIG.transpile.options.js.cjs, file2moduleName))
|
.pipe(gulpTraceur(CONFIG.transpile.options.js.cjs, file2moduleName))
|
||||||
.pipe(transformCJSTests())
|
.pipe(transformCJSTests())
|
||||||
.pipe(gulp.dest(CONFIG.dest.js.cjs + path.dirname(relPath.replace("modules", ""))));
|
.pipe(gulp.dest(CONFIG.dest.js.cjs + path.dirname(relPath.replace("modules", ""))));
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* A utility that allows copying one file to multiple directories, such
|
|
||||||
* as the LICENSE file.
|
|
||||||
*/
|
|
||||||
var path = require('path');
|
|
||||||
var util = require('./util');
|
|
||||||
var ternaryStream = require('ternary-stream');
|
|
||||||
var minimatch = require('minimatch');
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
multicopy: multicopy,
|
|
||||||
copy: copy
|
|
||||||
};
|
|
||||||
|
|
||||||
function createCopyPipe(gulp, plugins, config) {
|
|
||||||
var pipe = gulp.src(config.src);
|
|
||||||
Object.keys(config.pipes).forEach(function(pattern) {
|
|
||||||
pipe = pipe.pipe(ternaryStream(function(file) {
|
|
||||||
return minimatch(file.relative, pattern);
|
|
||||||
}, config.pipes[pattern]));
|
|
||||||
});
|
|
||||||
return pipe;
|
|
||||||
}
|
|
||||||
|
|
||||||
function copy(gulp, plugins, config) {
|
|
||||||
return function() {
|
|
||||||
return createCopyPipe(gulp, plugins, config)
|
|
||||||
.pipe(gulp.dest(config.dest));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function multicopy(gulp, plugins, config) {
|
|
||||||
return function() {
|
|
||||||
var pipe = createCopyPipe(gulp, plugins, config);
|
|
||||||
var modules = util.subDirs('modules');
|
|
||||||
if (config.exclude) {
|
|
||||||
modules = modules.filter(function(module) {
|
|
||||||
return config.exclude.indexOf(module) === -1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
modules.map(function(module) {
|
|
||||||
pipe = pipe.pipe(gulp.dest(path.join(config.dest, module)));
|
|
||||||
});
|
|
||||||
return pipe;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
var util = require('./util');
|
|
||||||
var file2moduleName = require('./file2modulename');
|
|
||||||
var through2 = require('through2');
|
|
||||||
var path = require('path');
|
|
||||||
var fs = require('fs');
|
|
||||||
var VinylFile = require('vinyl');
|
|
||||||
|
|
||||||
// used for generating html files and bootstrapping benchmarks and examples
|
|
||||||
module.exports = function(gulp, plugins, config) {
|
|
||||||
return function() {
|
|
||||||
return gulp.src(config.src)
|
|
||||||
.pipe(util.insertSrcFolder(plugins, config.srcFolderInsertion, config.modulesFolder))
|
|
||||||
.pipe(through2.obj(function(file, enc, done) {
|
|
||||||
var fileName = file.relative;
|
|
||||||
var moduleName = file2moduleName(fileName);
|
|
||||||
var moduleNameWithoutPath = path.basename(moduleName);
|
|
||||||
var self = this;
|
|
||||||
var scripts = util.filterByFile(config.scriptsPerFolder, fileName).map(function(script) {
|
|
||||||
var scriptTag;
|
|
||||||
var scriptSrc = script.src;
|
|
||||||
if (script.copy || script.copyOnly) {
|
|
||||||
scriptSrc = path.basename(script.src);
|
|
||||||
self.push(new VinylFile({
|
|
||||||
cwd: file.cwd,
|
|
||||||
base: file.base,
|
|
||||||
path: path.join(path.dirname(file.path), scriptSrc),
|
|
||||||
contents: fs.readFileSync(script.src)
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
if (script.copyOnly) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
if (scriptSrc) {
|
|
||||||
scriptTag = '<script src="'+scriptSrc+'" type="'+script.mimeType+'"></script>';
|
|
||||||
} else {
|
|
||||||
scriptTag = '<script type="'+script.mimeType+'">'+script.inline+'</script>';
|
|
||||||
}
|
|
||||||
return scriptTag
|
|
||||||
.replace('$MODULENAME_WITHOUT_PATH$', moduleNameWithoutPath)
|
|
||||||
.replace('$MODULENAME$', moduleName)
|
|
||||||
}).join('\n');
|
|
||||||
file.contents = new Buffer(file.contents.toString().replace('$SCRIPTS$', scripts));
|
|
||||||
this.push(file);
|
|
||||||
done();
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest(config.dest));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
@ -7,7 +7,6 @@ var Q = require('q');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
processToPromise: processToPromise,
|
processToPromise: processToPromise,
|
||||||
streamToPromise: streamToPromise,
|
streamToPromise: streamToPromise,
|
||||||
insertSrcFolder: insertSrcFolder,
|
|
||||||
filterByFile: filterByFile,
|
filterByFile: filterByFile,
|
||||||
subDirs: subDirs,
|
subDirs: subDirs,
|
||||||
forEachSubDir: forEachSubDir,
|
forEachSubDir: forEachSubDir,
|
||||||
@ -79,15 +78,3 @@ function filterByFile(pathMapping, folder) {
|
|||||||
throw new Error('No entry for folder '+folder+' found in '+JSON.stringify(pathMapping));
|
throw new Error('No entry for folder '+folder+' found in '+JSON.stringify(pathMapping));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertSrcFolder(plugins, srcFolderInsertion) {
|
|
||||||
return plugins.rename(function(file) {
|
|
||||||
var folder = file.dirname;
|
|
||||||
var srcDir = filterByFile(srcFolderInsertion, path.join(folder, file.basename));
|
|
||||||
if (srcDir) {
|
|
||||||
var folderParts = file.dirname.split(path.sep);
|
|
||||||
folder = [folderParts[0], srcDir].concat(folderParts.slice(1)).join(path.sep);
|
|
||||||
}
|
|
||||||
file.dirname = folder;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user