swag-wallets/scripts/build.js
renovate[bot] b18abbde69
Update dependency swagger-ui to v4 (#25)
* Update dependency swagger-ui to v4

* Update dependency swagger-ui to v4

* Disable sed step in build.js

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Pavel Popov <popoffpavel@yandex.ru>
2022-04-05 13:30:10 +03:00

33 lines
968 B
JavaScript
Executable File

#!/usr/bin/env node
'use strict';
var Path = require('path');
require('shelljs/global');
set('-e');
var TARGET_DIR = 'dist'
if (process.argv[2]) {
TARGET_DIR = process.argv[2]
}
var APIS = ls('api')
if (process.argv[3]) {
APIS = [process.argv[3]]
}
mkdir('-p', TARGET_DIR);
cp('-R', 'web/*', TARGET_DIR + '/');
APIS.forEach(function (api) {
var basedir = 'api/' + api + '/spec/';
var targetdir = TARGET_DIR + '/api/' + api;
mkdir('-p', targetdir);
exec('npm run swagger bundle -- --basedir ' + basedir + ' -o ' + targetdir + '/swagger.json');
exec('npm run swagger bundle -- --basedir ' + basedir + ' --yaml -o ' + targetdir + '/swagger.yaml');
});
var SWAGGER_UI_DIST = Path.dirname(require.resolve('swagger-ui'));
rm('-rf', TARGET_DIR + '/swagger-ui/')
cp('-R', SWAGGER_UI_DIST, TARGET_DIR + '/swagger-ui/')
// sed('-i', 'http://petstore.swagger.io/v2/swagger.json', '../swagger.json', TARGET_DIR + '/swagger-ui/index.html')