UNPKG

cli-engine

Version:
41 lines (35 loc) 1.16 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _manager = require('./manager'); var _path = require('path'); var _path2 = _interopRequireDefault(_path); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } class CorePlugins extends _manager.Manager { /** * list core plugins * @returns {PluginPath[]} */ async list() { try { const cli = this.config.pjson['cli-engine']; let plugins = []; if (this.config.pjson.main) { // if main is set in package.json, add plugin as self plugins.push(new _manager.PluginPath({ output: this.out, type: 'core', path: this.config.root })); } if (!cli) return plugins; if (cli.plugins) { plugins = plugins.concat((cli.plugins || []).map(name => { return new _manager.PluginPath({ output: this.out, type: 'core', path: _path2.default.join(this.config.root, 'node_modules', name) }); })); } return plugins; } catch (err) { this.out.warn(err, 'Error loading core plugins'); return []; } } } exports.default = CorePlugins;