Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement recursive plugin discovery #68811

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
debfb67
implements recursive scanning in plugin discovery system
pgayvallet Jun 10, 2020
8228bcd
update optimizer to find plugins in sub-directories
pgayvallet Jun 10, 2020
0cf4f90
update renovate
pgayvallet Jun 10, 2020
5645711
update optimizer IT snapshot
pgayvallet Jun 11, 2020
1a398ca
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 11, 2020
7f68ba1
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 15, 2020
c709bed
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 16, 2020
f011c93
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 23, 2020
5c00548
refactor processPluginSearchPaths$ and add test for inaccessible mani…
pgayvallet Jun 23, 2020
3cea30e
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 24, 2020
fa308bf
add symlink test
pgayvallet Jun 24, 2020
245cc4f
add maxDepth to the optimizer
pgayvallet Jun 26, 2020
6bc7cc8
adapt mockFs definitions
pgayvallet Jun 26, 2020
f25b051
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 26, 2020
c05880a
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 29, 2020
9dfbf16
remove `flat` usage
pgayvallet Jun 29, 2020
9b67058
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 29, 2020
39f2765
Merge remote-tracking branch 'upstream/master' into kbn-59189-recursi…
pgayvallet Jun 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@
"@types/markdown-it": "^0.0.7",
"@types/minimatch": "^2.0.29",
"@types/mocha": "^7.0.2",
"@types/mock-fs": "^4.10.0",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": ">=10.17.17 <10.20.0",
Expand Down Expand Up @@ -473,6 +474,7 @@
"listr": "^0.14.1",
"load-grunt-config": "^3.0.1",
"mocha": "^7.1.1",
"mock-fs": "^4.12.0",
"mock-http-server": "1.3.0",
"ms-chromium-edge-driver": "^0.2.3",
"multistream": "^2.1.1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ it('parses kibana.json files of plugins found in pluginDirs', () => {
"id": "bar",
"isUiPlugin": true,
},
Object {
"directory": <absolute path>/packages/kbn-optimizer/src/__fixtures__/mock_repo/plugins/baz,
"extraPublicDirs": Array [],
"id": "baz",
"isUiPlugin": false,
},
Object {
"directory": <absolute path>/packages/kbn-optimizer/src/__fixtures__/mock_repo/plugins/foo,
"extraPublicDirs": Array [],
"id": "foo",
"isUiPlugin": true,
},
Object {
"directory": <absolute path>/packages/kbn-optimizer/src/__fixtures__/mock_repo/plugins/nested/baz,
"extraPublicDirs": Array [],
"id": "baz",
"isUiPlugin": false,
},
Object {
"directory": <absolute path>/packages/kbn-optimizer/src/__fixtures__/mock_repo/test_plugins/test_baz,
"extraPublicDirs": Array [],
Expand Down
13 changes: 12 additions & 1 deletion packages/kbn-optimizer/src/optimizer/kibana_platform_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function findKibanaPlatformPlugins(scanDirs: string[], paths: string[]) {
.sync(
Array.from(
new Set([
...scanDirs.map((dir) => `${dir}/*/kibana.json`),
...scanDirs.map(nestedScanDirPaths).reduce((dirs, current) => [...dirs, ...current], []),
...paths.map((path) => `${path}/kibana.json`),
])
),
Expand All @@ -51,6 +51,17 @@ export function findKibanaPlatformPlugins(scanDirs: string[], paths: string[]) {
);
}

function nestedScanDirPaths(dir: string): string[] {
// down to 5 level max
return [
`${dir}/*/kibana.json`,
`${dir}/*/*/kibana.json`,
`${dir}/*/*/*/kibana.json`,
`${dir}/*/*/*/*/kibana.json`,
`${dir}/*/*/*/*/*/kibana.json`,
];
}

function readKibanaPlatformPlugin(manifestPath: string): KibanaPlatformPlugin {
if (!Path.isAbsolute(manifestPath)) {
throw new TypeError('expected new platform manifest path to be absolute');
Expand Down
8 changes: 8 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,14 @@
'(\\b|_)mocha(\\b|_)',
],
},
{
groupSlug: 'mock-fs',
groupName: 'mock-fs related packages',
packageNames: [
'mock-fs',
'@types/mock-fs',
],
},
{
groupSlug: 'moment',
groupName: 'moment related packages',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,5 @@
* under the License.
*/

export const mockReaddir = jest.fn();
export const mockReadFile = jest.fn();
export const mockStat = jest.fn();
jest.mock('fs', () => ({
readdir: mockReaddir,
readFile: mockReadFile,
stat: mockStat,
}));

export const mockPackage = new Proxy({ raw: {} as any }, { get: (obj, prop) => obj.raw[prop] });
jest.mock('../../../../../package.json', () => mockPackage);
Loading