forked from apache-superset/superset-ui-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: migrate to storybook 5 (apache-superset#46)
* build: migrate to storybook 5 * fix: configuration * fix: delete dir on build
- Loading branch information
Showing
9 changed files
with
97 additions
and
100 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
3 changes: 2 additions & 1 deletion
3
...i-plugins-demo/storybook-config/addons.js → ...rset-ui-plugins-demo/.storybook/addons.js
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,4 +1,5 @@ | ||
// note that the import order here determines the order in the UI! | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-options/register'; | ||
import 'storybook-addon-jsx/register'; |
21 changes: 13 additions & 8 deletions
21
...i-plugins-demo/storybook/storybookInfo.js → ...rset-ui-plugins-demo/.storybook/config.js
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,20 +1,25 @@ | ||
import { addDecorator } from '@storybook/react'; | ||
import { withOptions } from '@storybook/addon-options'; | ||
import { addParameters, configure } from '@storybook/react'; | ||
|
||
addDecorator( | ||
withOptions({ | ||
addParameters({ | ||
options: { | ||
name: '@superset-ui/plugins 🔌💡', | ||
addonPanelInRight: false, | ||
enableShortcuts: false, | ||
goFullScreen: false, | ||
hierarchySeparator: /\|/, | ||
// hierarchyRootSeparator: null, | ||
name: '@superset-ui/plugins 🔌💡', | ||
selectedAddonPanel: undefined, // The order of addons in the "Addon panel" is the same as you import them in 'addons.js'. The first panel will be opened by default as you run Storybook | ||
showAddonPanel: true, | ||
showSearchBox: false, | ||
showStoriesPanel: true, | ||
sidebarAnimations: true, | ||
sortStoriesByKind: false, | ||
url: '#', | ||
}), | ||
); | ||
}, | ||
}); | ||
|
||
function loadStorybook() { | ||
require('./storybook.css'); | ||
require('../storybook/stories'); // all of the stories | ||
} | ||
|
||
configure(loadStorybook, module); |
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/.storybook/webpack.config.js
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,53 @@ | ||
const path = require('path'); | ||
|
||
const BABEL_TYPESCRIPT_OPTIONS = { | ||
presets: [ | ||
['@babel/preset-env', { useBuiltIns: 'entry' }], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-object-rest-spread', | ||
'@babel/plugin-proposal-class-properties', | ||
'@babel/plugin-syntax-dynamic-import', | ||
] | ||
}; | ||
|
||
const SIBLING_PACKAGES_PATH_REGEXP = new RegExp( | ||
`${path.resolve(__dirname, '../../superset-ui-(legacy-)*(plugin|preset)-')}.+/src`, | ||
); | ||
|
||
module.exports = async ({ config }) => { | ||
config.resolve = config.resolve || {}; | ||
config.resolve.extensions = ['.tsx', '.ts', '.jsx', '.js']; | ||
|
||
// To enable live debugging of other packages when referring to `src` | ||
config.module.rules.push({ | ||
include: SIBLING_PACKAGES_PATH_REGEXP, | ||
exclude: /node_modules/, | ||
test: /\.jsx?$/, | ||
use: config.module.rules[0].use, | ||
}); | ||
|
||
// Enable TypeScript | ||
config.module.rules.push({ | ||
include: SIBLING_PACKAGES_PATH_REGEXP, | ||
exclude: /node_modules/, | ||
test: /\.tsx?$/, | ||
use: [{ | ||
loader: 'babel-loader', | ||
options: BABEL_TYPESCRIPT_OPTIONS, | ||
}], | ||
}); | ||
|
||
config.module.rules.push({ | ||
exclude: /node_modules/, | ||
test: /\.tsx?$/, | ||
use: [{ | ||
loader: 'babel-loader', | ||
options: BABEL_TYPESCRIPT_OPTIONS, | ||
}], | ||
}); | ||
|
||
return config; | ||
}; |
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
9 changes: 0 additions & 9 deletions
9
plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook-config/config.js
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
.../superset-ui-plugins/packages/superset-ui-plugins-demo/storybook-config/webpack.config.js
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
plugins/superset-ui-plugins/packages/superset-ui-plugins-demo/storybook/stories/index.js
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