Add gulp copydebug task

This commit is contained in:
Roman Hotsiy 2016-05-20 20:51:31 +03:00
parent 6f8ea60da7
commit f2b1ba8cda
4 changed files with 14 additions and 7 deletions

View File

@ -24,10 +24,18 @@ gulp.task('build', function (callback) {
'concatPrism',
'bundle',
'concatDeps',
'copyDebug',
callback
);
});
gulp.task('copyDebug', () => {
if (!argv.prod) {
// copy for be accessible from demo for debug
cp(paths.redocBuilt + '.js', paths.redocBuilt + '.min.js');
}
});
gulp.task('rebuild', function(done) {
return runSequence(
'bundle',
@ -73,7 +81,7 @@ gulp.task('concatDeps', function() {
.pipe(gulp.dest('.'))
});
gulp.task('bundle', ['injectVersionFile', 'inlineTemplates'], function bundle(cb) {
gulp.task('bundle', ['injectVersionFile', 'inlineTemplates'], function bundle(done) {
fs.existsSync('dist') || fs.mkdirSync('dist');
var builder = new Builder('./', 'system.config.js');
@ -82,13 +90,11 @@ gulp.task('bundle', ['injectVersionFile', 'inlineTemplates'], function bundle(cb
outputFileName,
{ format:'umd', sourceMaps: !argv.prod, lowResSourceMaps: true, minify: argv.prod }
)
.then(function() {
.then(() => {
// wait some time to allow flush
setTimeout(() => cb(), 500);
setTimeout(() => done(), 500);
})
.catch(function(err) {
cb(new Error(err));
});
.catch(err => done(err));
});
gulp.task('concatPrism', function() {

View File

@ -18,7 +18,6 @@
<redoc scroll-y-offset="body > nav" spec-url='http://rebilly.github.io/SwaggerTemplateRepo/swagger.yaml'></redoc>
<!-- ReDoc built file with all dependencies included -->
<script src="main.js"> </script>
<script src="dist/redoc.min.js"> </script>
</body>

View File

@ -1 +1,2 @@
require('shelljs/global');
require('require-dir')('build/tasks');

View File

@ -106,6 +106,7 @@
"reflect-metadata": "^0.1.2",
"require-dir": "^0.3.0",
"run-sequence": "^1.1.5",
"shelljs": "^0.7.0",
"should": "^8.0.2",
"sinon": "^1.17.2",
"systemjs-builder": "^0.15.16",