Skip to content
Snippets Groups Projects
Commit daf0b7fa authored by Daniel Perez's avatar Daniel Perez
Browse files

Fixing script to fix swagger style

parent ae443e13
No related branches found
No related tags found
1 merge request!64Slb/dperez50/fix swagger
Pipeline #35970 passed
const replace = require('replace-in-file');
const options_clear = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{display:\'none\';',
to: '.swagger-ui .topbar{',
};
const options_add_display = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{',
to: '.swagger-ui .topbar{display:\'none\';',
};
try {
var results = replace.sync(options_clear);
console.log('Replacement results:', results);
results = replace.sync(options_add_display);
console.log('Replacement results:', results);
}
catch (error) {
console.error('Error occurred:', error);
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
"test-automation": "npm run clean && npm install && npm run build && npm run test-coverage",
"test-e2e-parallel": "node ./tests/e2e/parallel/run_e2e_tests_parallel.js",
"copy-static-files": "copyfiles --error --up 1 ./docs/api/openapi.osdu.yaml ./dist/docs",
"postbuild": "npm run copy-static-files && node devops/scripts/style_swagger.js"
"postbuild": "npm run copy-static-files"
},
"nyc": {
"include": [
......
......@@ -27,6 +27,7 @@ import https from 'https';
import swaggerUi from 'swagger-ui-express';
import YAML from 'yamljs';
import replaceInFile from 'replace-in-file'
// -------------------------------------------------------------------
// Seismic Store Service
......@@ -69,8 +70,27 @@ export class Server {
]
}
private options_clear = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{display:\'none\';visibility:\'hidden\'',
to: '.swagger-ui .topbar{',
}
private options_add_display = {
files: 'node_modules/swagger-ui-dist/swagger-ui.css',
from: '.swagger-ui .topbar{',
to: '.swagger-ui .topbar{display:none;visibility:hidden;',
}
constructor() {
const swaggerDocument = YAML.load('./dist/docs/api/openapi.osdu.yaml');
try {
replaceInFile.sync(this.options_clear);
replaceInFile.sync(this.options_add_display);
}
catch (error) {
console.error('Error occurred:', error);
}
this.app = express();
this.app.use(bodyparser.urlencoded({ extended: false }));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment