feat(seed): unpack/repack properly handles paragraph breaks

This commit is contained in:
Alex Chaffee
2018-03-23 15:53:59 -04:00
committed by Mrugesh Mohapatra
parent 590f646263
commit 14c9ed8974
4 changed files with 79 additions and 56 deletions

View File

@@ -17,21 +17,29 @@ import {UnpackedChallenge, ChallengeFile} from './unpackedChallenge';
// bundle up the test-running JS
function createUnpackedBundle() {
let unpackedFile = path.join(__dirname, 'unpacked.js');
let b = browserify(unpackedFile).bundle();
b.on('error', console.error);
let unpackedBundleFile =
path.join(__dirname, 'unpacked', 'unpacked-bundle.js');
const bundleFileStream = fs.createWriteStream(unpackedBundleFile);
bundleFileStream.on('finish', () => {
console.log('Wrote bundled JS into ' + unpackedBundleFile);
let unpackedDir = path.join(__dirname, 'unpacked');
fs.mkdirp(unpackedDir, (err) => {
if (err && err.code !== 'EEXIST') {
console.log(err);
throw err;
}
let unpackedFile = path.join(__dirname, 'unpacked.js');
let b = browserify(unpackedFile).bundle();
b.on('error', console.error);
let unpackedBundleFile =
path.join(unpackedDir, 'unpacked-bundle.js');
const bundleFileStream = fs.createWriteStream(unpackedBundleFile);
bundleFileStream.on('finish', () => {
console.log('Wrote bundled JS into ' + unpackedBundleFile);
});
bundleFileStream.on('pipe', () => {
console.log('Writing bundled JS...');
});
bundleFileStream.on('error', console.error);
b.pipe(bundleFileStream);
// bundleFileStream.end(); // do not do this prematurely!
});
bundleFileStream.on('pipe', () => {
console.log('Writing bundled JS...');
});
bundleFileStream.on('error', console.error);
b.pipe(bundleFileStream);
// bundleFileStream.end(); // do not do this prematurely!
}
let currentlyUnpackingDir = null;