mirror of
https://github.com/valitydev/swag-wallets.git
synced 2024-11-06 10:55:21 +00:00
0ba011b839
* CAPI-262: Make up swagger repo w/ basic wallet api * CAPI-262: Design identity levels and challenges * CAPI-262: Allow to list wallets and identites * CAPI-292: Switch to Redoc 2.x * CAPI-262: Draft outputs and withdrawals
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
var gulp = require('gulp');
|
|
var util = require('gulp-util')
|
|
var gulpConnect = require('gulp-connect');
|
|
var connect = require('connect');
|
|
var cors = require('cors');
|
|
var path = require('path');
|
|
var exec = require('child_process').exec;
|
|
var portfinder = require('portfinder');
|
|
var swaggerRepo = require('swagger-repo');
|
|
|
|
var DIST_DIR = 'dist';
|
|
|
|
gulp.task('serve', ['build', 'watch'], function() {
|
|
portfinder.getPort({port: 3000}, function (err, port) {
|
|
gulpConnect.server({
|
|
root: [DIST_DIR],
|
|
livereload: true,
|
|
port: port,
|
|
middleware: function (gulpConnect, opt) {
|
|
return [
|
|
cors()
|
|
]
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
gulp.task('edit', function() {
|
|
portfinder.getPort({port: 5000}, function (err, port) {
|
|
var app = connect();
|
|
app.use(swaggerRepo.swaggerEditorMiddleware());
|
|
app.listen(port);
|
|
util.log(util.colors.green('swagger-editor started http://localhost:' + port));
|
|
});
|
|
});
|
|
|
|
gulp.task('build', function (cb) {
|
|
exec('npm run build', function (err, stdout, stderr) {
|
|
console.log(stderr);
|
|
cb(err);
|
|
});
|
|
});
|
|
|
|
gulp.task('reload', ['build'], function () {
|
|
gulp.src(DIST_DIR).pipe(gulpConnect.reload())
|
|
});
|
|
|
|
gulp.task('watch', function () {
|
|
gulp.watch(['api/**/*', 'spec/**/*', 'web/**/*'], ['reload']);
|
|
});
|