-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
CLI: update sb init to module format for Ember/Marko/Mithril/Rax/Riot/Svelte
#7504
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3f21c94
CLI templates: Ember => module format
shilman bf4073b
CLI templates: Marko => module format
shilman 18597a8
CLI templates: Mithril => module format
shilman 44f6704
CLI templates: Rax => module format
shilman 0bf6b1a
CLI templates: Riot => module format
shilman 00c9e35
CLI templates: Svelte => module format
shilman 49b67c9
Merge branch 'next' into 7499-module-format-others
shilman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
lib/cli/generators/EMBER/template/stories/Button.stories.js
This file contains hidden or 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,27 @@ | ||
| /* eslint-disable import/extensions */ | ||
| import hbs from 'htmlbars-inline-precompile'; | ||
| import { action } from '@storybook/addon-actions'; | ||
|
|
||
| export default { | ||
| title: 'Button', | ||
| }; | ||
|
|
||
| export const text = () => ({ | ||
| template: hbs`<button {{action onClick}}>Hello Button</button>`, | ||
| context: { | ||
| onClick: action('clicked'), | ||
| }, | ||
| }); | ||
|
|
||
| export const emoji = () => ({ | ||
| template: hbs` | ||
| <button {{action onClick}}> | ||
| <span role="img" aria-label="so cool"> | ||
| 😀 😎 👍 💯 | ||
| </span> | ||
| </button> | ||
| `, | ||
| context: { | ||
| onClick: action('clicked'), | ||
| }, | ||
| }); |
24 changes: 24 additions & 0 deletions
24
lib/cli/generators/EMBER/template/stories/Welcome.stories.js
This file contains hidden or 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,24 @@ | ||
| /* eslint-disable import/extensions */ | ||
| import hbs from 'htmlbars-inline-precompile'; | ||
| import { action } from '@storybook/addon-actions'; | ||
| import { linkTo } from '@storybook/addon-links'; | ||
|
|
||
| export default { | ||
| title: 'Welcome', | ||
| }; | ||
|
|
||
| export const toStorybook = () => ({ | ||
| template: hbs` | ||
| <div> | ||
| <h3> Welcome to Storybook! </h3> | ||
| <button {{action onClick}}> Checkout the button example </button> | ||
| </div> | ||
| `, | ||
| context: { | ||
| onClick: linkTo('Button'), | ||
| }, | ||
| }); | ||
|
|
||
| toStorybook.story = { | ||
| name: 'to Storybook', | ||
| }; |
37 changes: 0 additions & 37 deletions
37
lib/cli/generators/EMBER/template/stories/index.stories.js
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,9 +1,4 @@ | ||
| import { configure } from '@storybook/marko'; | ||
| import { load } from '@storybook/marko'; | ||
|
|
||
| // automatically import all files ending in *.stories.js | ||
| const req = require.context('../stories', true, /\.stories\.js$/); | ||
| function loadStories() { | ||
| req.keys().forEach(filename => req(filename)); | ||
| } | ||
|
|
||
| configure(loadStories, module); | ||
| load(require.context('../stories', true, /\.stories\.js$/), module); |
This file contains hidden or 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,7 @@ | ||
| import { storiesOf } from '@storybook/marko'; | ||
| import Welcome from './components/welcome/index.marko'; | ||
|
|
||
| storiesOf('Welcome', module).add('welcome', () => ({ component: Welcome })); | ||
| export default { | ||
| title: 'Welcome', | ||
| }; | ||
|
|
||
| export const welcome = () => ({ component: Welcome }); |
This file contains hidden or 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,9 +1,4 @@ | ||
| import { configure } from '@storybook/mithril'; | ||
| import { load } from '@storybook/mithril'; | ||
|
|
||
| // automatically import all files ending in *.stories.js | ||
| const req = require.context('../stories', true, /\.stories\.js$/); | ||
| function loadStories() { | ||
| req.keys().forEach(filename => req(filename)); | ||
| } | ||
|
|
||
| configure(loadStories, module); | ||
| load(require.context('../stories', true, /\.stories\.js$/), module); |
20 changes: 20 additions & 0 deletions
20
lib/cli/generators/MITHRIL/template/stories/Button.stories.js
This file contains hidden or 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,20 @@ | ||
| import m from 'mithril'; | ||
| import { action } from '@storybook/addon-actions'; | ||
| import Button from './Button'; | ||
|
|
||
| export default { | ||
| title: 'Button', | ||
| }; | ||
|
|
||
| export const text = () => ({ | ||
| view: () => m(Button, { onclick: action('clicked') }, 'Hello Button'), | ||
| }); | ||
|
|
||
| export const emoji = () => ({ | ||
| view: () => | ||
| m( | ||
| Button, | ||
| { onclick: action('clicked') }, | ||
| m('span', { role: 'img', ariaLabel: 'so cool' }, '😀 😎 👍 💯') | ||
| ), | ||
| }); |
15 changes: 15 additions & 0 deletions
15
lib/cli/generators/MITHRIL/template/stories/Welcome.stories.js
This file contains hidden or 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,15 @@ | ||
| import m from 'mithril'; | ||
| import { linkTo } from '@storybook/addon-links'; | ||
| import Welcome from './Welcome'; | ||
|
|
||
| export default { | ||
| title: 'Welcome', | ||
| }; | ||
|
|
||
| export const toStorybook = () => ({ | ||
| view: () => m(Welcome, { showApp: linkTo('Button') }), | ||
| }); | ||
|
|
||
| toStorybook.story = { | ||
| name: 'to Storybook', | ||
| }; |
25 changes: 0 additions & 25 deletions
25
lib/cli/generators/MITHRIL/template/stories/index.stories.js
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,19 @@ | ||
| import { createElement } from 'rax'; | ||
| import { action } from '@storybook/addon-actions'; | ||
|
|
||
| import Button from 'rax-button'; | ||
| import Text from 'rax-text'; | ||
|
|
||
| export default { | ||
| title: 'Button', | ||
| }; | ||
|
|
||
| export const text = () => <Button onPress={action('clicked')}>Hello Button</Button>; | ||
|
|
||
| export const emoji = () => ( | ||
| <Button onPress={action('clicked')}> | ||
| <Text role="img" aria-label="so cool"> | ||
| 😀 😎 👍 💯 | ||
| </Text> | ||
| </Button> | ||
| ); |
14 changes: 14 additions & 0 deletions
14
lib/cli/generators/RAX/template/stories/Welcome.stories.js
This file contains hidden or 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,14 @@ | ||
| import { createElement } from 'rax'; | ||
| import { linkTo } from '@storybook/addon-links'; | ||
|
|
||
| import Welcome from './Welcome'; | ||
|
|
||
| export default { | ||
| title: 'Welcome', | ||
| }; | ||
|
|
||
| export const toStorybook = () => <Welcome showApp={linkTo('Button', 'with text')} />; | ||
|
|
||
| toStorybook.story = { | ||
| name: 'to Storybook', | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,9 +1,4 @@ | ||
| import { configure } from '@storybook/riot'; | ||
| import { load } from '@storybook/riot'; | ||
|
|
||
| // automatically import all files ending in *.stories.js | ||
| const req = require.context('../stories', true, /\.stories\.js$/); | ||
| function loadStories() { | ||
| req.keys().forEach(filename => req(filename)); | ||
| } | ||
|
|
||
| configure(loadStories, module); | ||
| load(require.context('../stories', true, /\.stories\.js$/), module); |
22 changes: 22 additions & 0 deletions
22
lib/cli/generators/RIOT/template/stories/Button.stories.js
This file contains hidden or 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,22 @@ | ||
| import { mount } from '@storybook/riot'; | ||
|
|
||
| /* eslint-disable-next-line import/no-webpack-loader-syntax */ | ||
| import MyButtonRaw from 'raw-loader!./MyButton.tag'; | ||
| import './MyButton.tag'; | ||
|
|
||
| export default { | ||
| title: 'Button', | ||
| }; | ||
|
|
||
| export const text = () => ({ | ||
| tags: ['<my-button>Hello Button</my-button>'], | ||
| }); | ||
|
|
||
| export const scenario = () => ({ | ||
| tags: [{ content: MyButtonRaw, boundAs: 'MyButton' }], | ||
| template: '<MyButton>With scenario</MyButton>', | ||
| }); | ||
|
|
||
| export const emoji = () => ({ | ||
| tags: ['<my-button>😀 😎 👍 💯</my-button>'], | ||
| }); |
14 changes: 14 additions & 0 deletions
14
lib/cli/generators/RIOT/template/stories/Welcome.stories.js
This file contains hidden or 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,14 @@ | ||
| import { mount } from '@storybook/riot'; | ||
| import { linkTo } from '@storybook/addon-links'; | ||
|
|
||
| import './Welcome.tag'; | ||
|
|
||
| export default { | ||
| title: 'Welcome', | ||
| }; | ||
|
|
||
| export const toStorybook = () => mount('welcome', { showApp: () => linkTo('Button') }); | ||
|
|
||
| toStorybook.story = { | ||
| name: 'to Storybook', | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,9 +1,4 @@ | ||
| import { configure } from '@storybook/svelte'; | ||
| import { load } from '@storybook/svelte'; | ||
|
|
||
| // automatically import all files ending in *.stories.js | ||
| const req = require.context('../stories', true, /\.stories\.js$/); | ||
| function loadStories() { | ||
| req.keys().forEach(filename => req(filename)); | ||
| } | ||
|
|
||
| configure(loadStories, module); | ||
| load(require.context('../stories', true, /\.stories\.js$/), module); |
31 changes: 17 additions & 14 deletions
31
lib/cli/generators/SVELTE/template/stories/index.stories.js
This file contains hidden or 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,18 +1,21 @@ | ||
| import { storiesOf } from '@storybook/svelte'; | ||
| import { action } from '@storybook/addon-actions'; | ||
|
|
||
| import Button from './button.svelte'; | ||
|
|
||
| storiesOf('Button', module) | ||
| .add('with text', () => ({ | ||
| Component: Button, | ||
| props: { text: 'Hello Button' }, | ||
| on: { click: action('clicked') }, | ||
| })) | ||
| .add('with some emoji', () => ({ | ||
| Component: Button, | ||
| props: { | ||
| text: '😀 😎 👍 💯', | ||
| }, | ||
| on: { click: action('clicked') }, | ||
| })); | ||
| export default { | ||
| title: 'Button', | ||
| }; | ||
|
|
||
| export const text = () => ({ | ||
| Component: Button, | ||
| props: { text: 'Hello Button' }, | ||
| on: { click: action('clicked') }, | ||
| }); | ||
|
|
||
| export const emoji = () => ({ | ||
| Component: Button, | ||
| props: { | ||
| text: '😀 😎 👍 💯', | ||
| }, | ||
| on: { click: action('clicked') }, | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this
button.stories.js?