Prevent accidental upgrades to swagger-ui v3+
This commit is contained in:
parent
34f8b79f04
commit
02cfb554ee
|
@ -5,6 +5,21 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
// NOTE(bajtos) It's important to run this check before we load the Explorer
|
||||||
|
// because require() may fail (e.g. with MODULE_NOT_FOUND error) and make
|
||||||
|
// it difficult to identify the actual problem
|
||||||
|
const uiVersion = require('../package.json').dependencies['swagger-ui'];
|
||||||
|
if (!uiVersion.startsWith('^2')) {
|
||||||
|
console.error(`
|
||||||
|
Upgrading from swagger-ui@2 to a newer major version (${uiVersion}) is difficult,
|
||||||
|
see https://github.com/strongloop/loopback-component-explorer/issues/254
|
||||||
|
If you are confident about this change and have manually verified API Explorer
|
||||||
|
functionality in the browser, including access-token based authentication,
|
||||||
|
then you can delete this check.
|
||||||
|
`);
|
||||||
|
process.exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
const loopback = require('loopback');
|
const loopback = require('loopback');
|
||||||
const explorer = require('../');
|
const explorer = require('../');
|
||||||
const request = require('supertest');
|
const request = require('supertest');
|
||||||
|
|
Loading…
Reference in New Issue