mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* [eslint-import-resolver-kibana] bring in repo as package * [eslint-import-resolver] enable prettier
35 lines
1 KiB
JavaScript
Executable file
35 lines
1 KiB
JavaScript
Executable file
const { dirname, resolve } = require('path');
|
|
const glob = require('glob-all');
|
|
|
|
module.exports = function getPlugins(config, kibanaPath, projectRoot) {
|
|
const resolveToRoot = path => resolve(projectRoot, path);
|
|
|
|
const pluginDirs = [
|
|
...(config.pluginDirs || []).map(resolveToRoot),
|
|
resolve(kibanaPath, 'plugins'),
|
|
resolve(kibanaPath, 'src/core_plugins'),
|
|
];
|
|
|
|
const pluginPaths = [
|
|
...(config.pluginPaths || []).map(resolveToRoot),
|
|
|
|
// when the rootPackageName is specified we assume that the root of the project
|
|
// is not a plugin, so don't include it automatically
|
|
...(config.rootPackageName ? [] : [projectRoot]),
|
|
];
|
|
|
|
const globPatterns = [
|
|
...pluginDirs.map(dir => resolve(dir, '*/package.json')),
|
|
...pluginPaths.map(path => resolve(path, 'package.json')),
|
|
];
|
|
|
|
return glob.sync(globPatterns).map(pkgJsonPath => {
|
|
const path = dirname(pkgJsonPath);
|
|
const pkg = require(pkgJsonPath);
|
|
return {
|
|
name: pkg.name,
|
|
directory: path,
|
|
publicDirectory: resolve(path, 'public'),
|
|
};
|
|
});
|
|
};
|