check for version of node that the SFEplugin requires too

This commit is contained in:
Daniel Schep 2019-05-03 11:10:49 -04:00
parent b7d0c53d7c
commit ab88c1aa36

View File

@ -157,11 +157,11 @@ class PluginManager {
loadEnterprisePlugin() {
const qualifiedEnterpriseModulePath = path.join(
__dirname, '../../node_modules/@serverless/enterprise-plugin');
// eslint-disable-next-line global-require
const sfeNodeReq = require(`${qualifiedEnterpriseModulePath}/package.json`).engines.node;
if (process.env.SERVERLESS_DISABLE_ENTERPRISE &&
process.env.SERVERLESS_DISABLE_ENTERPRISE.toLowerCase() === 'true' ||
!semver.satisfies(process.version, sfeNodeReq)
) {
if ((process.env.SERVERLESS_DISABLE_ENTERPRISE &&
process.env.SERVERLESS_DISABLE_ENTERPRISE.toLowerCase() === 'true') ||
!semver.satisfies(process.version, sfeNodeReq)) {
return;
}
this.loadPlugins([qualifiedEnterpriseModulePath]);