fix(Tools): Moves files out of dart2js/**/web.

Fixes bug that only allowed src and packages to be moved out of dart2js/**/web. Globs all files in dart2js/**/web and moves them one directory up.
This commit is contained in:
Ian Riley 2015-06-02 10:37:56 -07:00 committed by Tobias Bosch
parent 1d24e2cf23
commit 40150379ae
1 changed files with 5 additions and 2 deletions

View File

@ -19,6 +19,7 @@ module.exports = function(gulp, plugins, config) {
var destFolder = path.resolve(path.join(config.dest, path.basename(folder))); var destFolder = path.resolve(path.join(config.dest, path.basename(folder)));
var pubMode = config.mode || 'release'; var pubMode = config.mode || 'release';
var pubArgs = ['build', '--mode', pubMode, '-o', destFolder]; var pubArgs = ['build', '--mode', pubMode, '-o', destFolder];
return util.processToPromise(spawn(config.command, pubArgs, { return util.processToPromise(spawn(config.command, pubArgs, {
stdio: 'inherit', stdio: 'inherit',
cwd: folder cwd: folder
@ -45,8 +46,10 @@ function replaceDartWithJsScripts(gulp, folder) {
} }
function removeWebFolder(gulp, folder) { function removeWebFolder(gulp, folder) {
fs.renameSync(path.join(folder, 'web', 'src'), path.join(folder, 'src')); var folders = [].slice.call(glob.sync(path.join(folder, 'web', '*')));
fs.renameSync(path.join(folder, 'web', 'packages'), path.join(folder, 'packages')); folders.forEach(function(subFolder) {
fs.renameSync(subFolder, subFolder.replace(path.sep + 'web' + path.sep, path.sep));
});
fs.rmdirSync(path.join(folder, 'web')); fs.rmdirSync(path.join(folder, 'web'));
return Q.resolve(); return Q.resolve();
} }