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

WIP - add vue support #1267

Merged
merged 69 commits into from
Jul 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
c3b35e6
WIP
ndelangen Jun 12, 2017
fcd6283
WIP, webpack succesful
ndelangen Jun 12, 2017
7b53666
testing
ndelangen Jun 12, 2017
b1470eb
Implement basic working version, Cannot handle extension and global c…
alexandrebodin Jun 13, 2017
23aadf4
:shirt: refactor(client): update preview rendering
kazupon Jun 13, 2017
c23caa9
:shirt: refactor(examples): update stories
kazupon Jun 13, 2017
ccbbf6e
Publish alpha.0
ndelangen Jun 14, 2017
55aa3ff
Make global examples work if config.js bootstrap components and exten…
alexandrebodin Jun 14, 2017
e7b9b0a
Make working examples for functions, Vue extensions and Vue global co…
alexandrebodin Jun 14, 2017
6b21da8
fix dep for lerna bootstrap
alexandrebodin Jun 14, 2017
cc546c5
HMR works!
ndelangen Jun 14, 2017
d51f83e
CHANGE favicon
ndelangen Jun 14, 2017
9454fa7
ADD example with actions and links
ndelangen Jun 14, 2017
d0dc873
Update the dep value to work with next releases of @storybook/vue
alexandrebodin Jun 14, 2017
385611b
Merge branch 'master' into add-app-vue
ndelangen Jun 14, 2017
9974a3b
Add support for vue in addon-notes
alexandrebodin Jun 14, 2017
bf00a9a
Make addon notes agnostic
alexandrebodin Jun 14, 2017
514f4b7
deprecate old WithNotes but keep backward compatible
alexandrebodin Jun 14, 2017
5a6472d
Cleaning up deps and comments
alexandrebodin Jun 14, 2017
a93eba3
Merge pull request #1278 from storybooks/addon-notes-vue
ndelangen Jun 14, 2017
b41fda4
:construction: wip: add story template for vue app project
kazupon Jun 15, 2017
ff56861
:up: update(cli): getstorybook vue supporting
kazupon Jun 15, 2017
765d394
Merge branch 'master' into add-app-vue
ndelangen Jun 16, 2017
9bd55bc
:up: update(cli): stories creating for vue
kazupon Jun 16, 2017
82d44e8
Merge branch 'add-app-vue' into getstorybook-support-for-vue
kazupon Jun 16, 2017
19dcfd9
Change docs to contains Vue info
ndelangen Jun 16, 2017
db319e4
Merge branch 'master' into add-app-vue
ndelangen Jun 16, 2017
d9a3da5
Make a working example
alexandrebodin Jun 14, 2017
5e66224
Cleaning up
alexandrebodin Jun 14, 2017
aef1f01
less ugly working example
alexandrebodin Jun 15, 2017
5784a79
Comment unused to make PR clear
alexandrebodin Jun 15, 2017
bac1905
Add support for addonKnobs, rename withX to addonX to avoid name coll…
alexandrebodin Jun 15, 2017
6255569
Finish cleanup of addon knobs
alexandrebodin Jun 16, 2017
4c1daab
More clean up
alexandrebodin Jun 16, 2017
3e12ba1
:shirt: refactor: tweak style guide
kazupon Jun 17, 2017
b355060
Fix example using a function as a component to object component
alexandrebodin Jun 17, 2017
4dd6b78
Make example a proper vue app
alexandrebodin Jun 17, 2017
3260f7d
Readme fix
alexandrebodin Jun 17, 2017
1e91907
Wording
alexandrebodin Jun 17, 2017
838730f
:up: update: show the error at storybook/vue
kazupon Jun 17, 2017
2e3170d
:pencil: docs: update vue guide
kazupon Jun 17, 2017
040f4e0
Merge pull request #1287 from kazupon/getstorybook-support-for-vue
alexandrebodin Jun 18, 2017
68d237c
Remove unwatend packe-lock.json
alexandrebodin Jun 18, 2017
bc84ee6
Rename vue example to vue-kitchen-sink
alexandrebodin Jun 18, 2017
8145ac3
Merge branch 'master' into add-app-vue
alexandrebodin Jun 18, 2017
d3c53c1
:up: update: fix error display
kazupon Jun 18, 2017
70a043f
add more examples with knobs fields
alexandrebodin Jun 18, 2017
8178ec1
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin Jun 18, 2017
043b5f1
Merge branch 'master' into add-app-vue
ndelangen Jun 19, 2017
5daa769
Merge branch 'master' into add-app-vue
alexandrebodin Jun 20, 2017
6c95ac9
add tests
alexandrebodin Jun 20, 2017
6e8f869
fix dependency
alexandrebodin Jun 20, 2017
c7efe5a
bumping version
alexandrebodin Jun 20, 2017
654be24
bumping version
alexandrebodin Jun 20, 2017
e35aeee
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin Jun 20, 2017
7be65d4
fix resolve in webpack
alexandrebodin Jun 20, 2017
96031cd
Merge branch 'master' into add-app-vue
ndelangen Jun 23, 2017
d806c3f
WIP
ndelangen Jun 23, 2017
d41655a
Merge branch 'master' of github.com:storybooks/storybook into add-app…
alexandrebodin Jun 23, 2017
c7ddd09
clean up build and wording
alexandrebodin Jun 23, 2017
f2926f4
bump to alpha 4
alexandrebodin Jun 23, 2017
cafa395
FIX multiple version react in vue app
ndelangen Jun 23, 2017
0605107
CLEANUP
ndelangen Jun 23, 2017
997f3d9
FIX multiple versions of react & vue && CLEANUP
ndelangen Jun 23, 2017
ec67cc5
:up: update(server): tweak consoleoutputing
kazupon Jun 27, 2017
d2f259b
Merge branch 'add-app-vue' of github.com:storybooks/storybook into ad…
alexandrebodin Jul 1, 2017
929eb38
Merge branch 'master' of github.com:storybooks/storybook into add-app…
alexandrebodin Jul 1, 2017
864e97e
fix version in package.json
alexandrebodin Jul 1, 2017
83bb874
Merge branch 'release/3.2' into add-app-vue
shilman Jul 2, 2017
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: 1 addition & 1 deletion app/vue/.babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"presets": ["es2015", "es2016", "stage-0", "react"]
"presets": ["env", "stage-0", "react"]
}
4 changes: 4 additions & 0 deletions app/vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
Storybook for Vue is a UI development environment for your Vue components.
With it, you can visualize different states of your UI components and develop them interactively.

## Remarques
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups !


- When using custom components or extension (e.g `Vue.use`). You will need to declare those in the `./storybook/config.js`.

> ## WARNING
>
> **This package is highly experimental**
Expand Down
7 changes: 3 additions & 4 deletions app/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"babel-core": "^6.24.1",
"babel-loader": "^7.0.0",
"babel-plugin-react-docgen": "^1.5.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-env": "1.5.2",
"babel-preset-react": "^6.24.1",
"babel-preset-react-app": "^3.0.0",
"babel-preset-stage-0": "^6.24.1",
Expand Down Expand Up @@ -67,10 +66,10 @@
"url-loader": "^0.5.8",
"util-deprecate": "^1.0.2",
"uuid": "^3.0.1",
"vue-hot-reload-api": "2.1.0",
"vue-loader": "^12.2.1",
"vue-template-compiler": "^2.3.4",
"vue-style-loader": "3.0.1",
"vue-hot-reload-api": "2.1.0",
"vue-template-compiler": "^2.3.4",
"webpack": "^2.5.1",
"webpack-dev-middleware": "^1.10.2",
"webpack-hot-middleware": "^2.18.0"
Expand Down
12 changes: 8 additions & 4 deletions app/vue/src/client/preview/client_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ export default class ClientApi {
}

let component = getStory;
if (typeof getStory === 'string') {
component = { template: getStory };
} else if (typeof getStory === 'function') {
component = { render: getStory };
if (typeof getStory === 'function') {
component = getStory();
}

if (typeof component === 'string') {
component = { template: component };
} else if (typeof component === 'function') {
component = { render: component };
}

// Wrap the getStory function with each decorator. The first
Expand Down
3 changes: 1 addition & 2 deletions app/vue/src/server/config/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module.exports = {
// `find-cache-dir` will create the cache directory under the node_modules directory.
cacheDirectory: findCacheDir({ name: 'react-storybook' }),
presets: [
require.resolve('babel-preset-es2015'),
require.resolve('babel-preset-es2016'),
require.resolve('babel-preset-env'),
require.resolve('babel-preset-stage-0'),
require.resolve('babel-preset-react'),
],
Expand Down
3 changes: 1 addition & 2 deletions app/vue/src/server/config/babel.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ module.exports = {
// Don't try to find .babelrc because we want to force this configuration.
babelrc: false,
presets: [
require.resolve('babel-preset-es2015'),
require.resolve('babel-preset-es2016'),
require.resolve('babel-preset-env'),
require.resolve('babel-preset-stage-0'),
require.resolve('babel-preset-react'),
],
Expand Down
2 changes: 1 addition & 1 deletion app/vue/src/server/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function() {
// Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules'].concat(nodePaths),
alias: {
'vue$': 'vue/dist/vue.esm.js'
'vue': path.resolve(path.join(__dirname, '../../../node_modules', 'vue/dist/vue.esm.js'))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a explanatory comment ⁉️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you change it? 🤔
I think 'vue$': 'vue/dist/vue.esm.js' is correct.

See the docs:
https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not correct in our case because of webpack being in storybook/vue and not ine the example app.

Not pointing to the correct dep will have webpack load 2 times vie and thus make it impossible to ise extension or global custom components

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazupon I fyou could try to run the example s storybook and see if all the stories are working :)

}
},
performance: {
Expand Down
3 changes: 3 additions & 0 deletions app/vue/src/server/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export default function() {
// Add support to NODE_PATH. With this we could avoid relative path imports.
// Based on this CRA feature: https://github.com/facebookincubator/create-react-app/issues/253
modules: ['node_modules'].concat(nodePaths),
alias: {
'vue': path.resolve(path.join(__dirname, '../../../node_modules', 'vue/dist/vue.esm.js'))
}
},
};

Expand Down
9 changes: 9 additions & 0 deletions examples/vue/src/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ import MyButton from './Button.vue';
storiesOf('Button')
// Works if Vue.component is called in the config.js in .storybook
.add('rounded markup only', '<my-button :rounded="true">not rounded</my-button>')
.add('story as a function template', () => '<my-button :rounded="true">not rounded</my-button>')
.add('story as a function renderer', () => (h) => h('div', ['Hello renderer']))
.add('story as a function component with template', () => ({
template: '<my-button :rounded="true">not rounded</my-button>',
}))
.add('story as a function component with renderer', () => ({
render: (h) => h('my-button', { props : { rounded: true }}),
}))
.add('with vuex', {
components: { MyButton },
template: '<my-button :handle-click="log">{{ $store.state.count }}</my-button>',
store: new Vuex.Store({
state: { count: 0 },
Expand Down