Repository navigation
Expand file tree
/
Copy pathbuild.js
More file actions
executable file
·42 lines (31 loc) · 1.52 KB
/
Copy pathbuild.js
File metadata and controls
executable file
·42 lines (31 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
'use strict';
var Path = require('path');
require('shelljs/global');
set('-e');
rm('-rf', 'web_deploy')
mkdir('-p', 'web_deploy')
cp('-R', 'web/*', 'web_deploy/');
console.log("create initial bundle without code samples");
rm('-rf', 'spec/code_samples/');
exec('npm run swagger bundle -- -o web_deploy/swagger.json');
exec('npm run swagger bundle -- --yaml -o web_deploy/swagger.yaml');
console.log("we need the swagger without code for restlet");
cp('web_deploy/swagger.yaml', 'web_deploy/swagger-nocode.yaml');
console.log("generate code samples");
mkdir('-p', 'spec/code_samples/');
exec('npm run generate-code-samples skip-pre-bundle');
console.log("re-bundle with code samples");
exec('npm run swagger bundle -- -o web_deploy/swagger.json');
exec('npm run swagger bundle -- --yaml -o web_deploy/swagger.yaml');
//console.log("create swagger-ui directory");
//var SWAGGER_UI_DIST = Path.dirname(require.resolve('swagger-ui'));
//cp('-R', SWAGGER_UI_DIST, 'web_deploy/swagger-ui/')
//sed('-i', 'http://petstore.swagger.io/v2/swagger.json', '../swagger.json', 'web_deploy/swagger-ui/index.html')
console.log("create a version with everything including code");
mkdir('-p', 'web_deploy/everything/swagger-ui/');
cp('web_deploy/*.*', 'web_deploy/everything/');
//cp('-R', 'web_deploy/swagger-ui/', 'web_deploy/everything/swagger-ui/');
console.log("create a version that hides STAGE= items from the public view");
console.log("hiding items from public view");
exec('npm run hide-items web_deploy skip-regenerate');