-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into kpm/metric-mocha-to-jest
- Loading branch information
Showing
439 changed files
with
4,909 additions
and
1,872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"upstream": "elastic/kibana", | ||
"branches": [{ "name": "7.x", "checked": true }, "7.5", "7.4", "7.3", "7.2", "7.1", "7.0", "6.8", "6.7", "6.6", "6.5", "6.4", "6.3", "6.2", "6.1", "6.0", "5.6"], | ||
"branches": [{ "name": "7.x", "checked": true }, "7.6", "7.5", "7.4", "7.3", "7.2", "7.1", "7.0", "6.8", "6.7", "6.6", "6.5", "6.4", "6.3", "6.2", "6.1", "6.0", "5.6"], | ||
"labels": ["backport"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ | |
*/ | ||
|
||
export { withProcRunner } from './with_proc_runner'; | ||
export { ProcRunner } from './proc_runner'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Kibana Storybook | ||
|
||
This package provides ability to add [Storybook](https://storybook.js.org/) to any Kibana plugin. | ||
|
||
- [Setup Instructions](#setup-instructions) | ||
|
||
|
||
## Setup Instructions | ||
|
||
1. Add `storybook.js` launcher file to your plugin. For example, create a file at | ||
`src/plugins/<plugin>/scripts/storybook.js`, with the following contents: | ||
|
||
```js | ||
import { join } from 'path'; | ||
|
||
// eslint-disable-next-line | ||
require('@kbn/storybook').runStorybookCli({ | ||
name: '<plugin>', | ||
storyGlobs: [join(__dirname, '..', 'public', 'components', '**', '*.examples.tsx')], | ||
}); | ||
``` | ||
2. Add your plugin alias to `src/dev/storybook/aliases.ts` config. | ||
3. Create sample Storybook stories. For example, in your plugin create create a file at | ||
`src/plugins/<plugin>/public/components/hello_world/__examples__/hello_world.examples.tsx` with | ||
the following contents: | ||
|
||
```jsx | ||
import * as React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
storiesOf('Hello world', module).add('default', () => <div>Hello world!</div>); | ||
``` | ||
4. Launch Storybook with `yarn storybook <plugin>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
const fs = require('fs'); | ||
const { join } = require('path'); | ||
const Rx = require('rxjs'); | ||
const { first } = require('rxjs/operators'); | ||
const storybook = require('@storybook/react/standalone'); | ||
const { run } = require('@kbn/dev-utils'); | ||
const { generateStorybookEntry } = require('./lib/storybook_entry'); | ||
const { REPO_ROOT, CURRENT_CONFIG } = require('./lib/constants'); | ||
const { buildDll } = require('./lib/dll'); | ||
|
||
exports.runStorybookCli = config => { | ||
const { name, storyGlobs } = config; | ||
run( | ||
async ({ flags, log, procRunner }) => { | ||
log.debug('Global config:\n', require('./lib/constants')); | ||
|
||
const currentConfig = JSON.stringify(config, null, 2); | ||
const currentConfigDir = join(CURRENT_CONFIG, '..'); | ||
await fs.promises.mkdir(currentConfigDir, { recursive: true }); | ||
log.debug('Writing currentConfig:\n', CURRENT_CONFIG + '\n', currentConfig); | ||
await fs.promises.writeFile(CURRENT_CONFIG, `exports.currentConfig = ${currentConfig};`); | ||
|
||
await buildDll({ | ||
rebuildDll: flags.rebuildDll, | ||
log, | ||
procRunner, | ||
}); | ||
|
||
// Build sass and continue when initial build complete | ||
await procRunner.run('watch sass', { | ||
cmd: process.execPath, | ||
args: ['scripts/build_sass', '--watch'], | ||
cwd: REPO_ROOT, | ||
wait: /scss bundles created/, | ||
}); | ||
|
||
const subj = new Rx.ReplaySubject(1); | ||
generateStorybookEntry({ log, storyGlobs }).subscribe(subj); | ||
|
||
await subj.pipe(first()).toPromise(); | ||
|
||
await Promise.all([ | ||
// route errors | ||
subj.toPromise(), | ||
|
||
new Promise(() => { | ||
// storybook never completes, so neither will this promise | ||
const configDir = join(__dirname, 'storybook_config'); | ||
log.debug('Config dir:', configDir); | ||
storybook({ | ||
mode: 'dev', | ||
port: 9001, | ||
configDir, | ||
}); | ||
}), | ||
]); | ||
}, | ||
{ | ||
flags: { | ||
boolean: ['rebuildDll'], | ||
}, | ||
description: ` | ||
Run the storybook examples for ${name} | ||
`, | ||
} | ||
); | ||
}; |
Oops, something went wrong.