Giter Club home page Giter Club logo

intro-storybook-vue-template's Introduction

Chromatic

Chromatic's Intro to Storybook Vue template

This template ships with the main Vue and Storybook configuration files you'll need to get up and running fast.

πŸš… Quick start

  1. Create the application.

    Use degit to get this template.

    # Clone the template
    npx degit chromaui/intro-storybook-vue-template taskbox
  2. Install the dependencies.

    Navigate into your new site’s directory and install the necessary dependencies.

    # Navigate to the directory
    cd taskbox/
    
    # Install the dependencies
    yarn
  3. Open the source code and start editing!

    Open the taskbox directory in your code editor of choice and building your first component!

  4. Browse your stories!

    Run yarn storybook to see your component's stories at http://localhost:6006

πŸ”Ž What's inside?

A quick look at the top-level files and directories included with this template.

.
β”œβ”€β”€ .storybook
β”œβ”€β”€ node_modules
β”œβ”€β”€ public
β”œβ”€β”€ src
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .eslintrc.cjs
β”œβ”€β”€ .prettierrc.json
β”œβ”€β”€ index.html
β”œβ”€β”€ LICENSE
β”œβ”€β”€ yarn.lock
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.js
└── README.md
  1. .storybook: This directory contains Storybook's configuration files.

  2. node_modules: This directory contains all of the modules of code that your project depends on (npm packages).

  3. public: This directory will contain the development and production build of the site.

  4. src: This directory will contain all of the code related to what you will see on your application.

  5. .gitignore: This file tells git which files it should not track or maintain during the development process of your project.

  6. .eslintrc.cjs: This file contains the configuration for ESLint.

  7. .prettierrc.json: This file contains the configuration for Prettier.

  8. .index.html: This is the HTML page that is served when generating a development or production build.

  9. LICENSE: The template is licensed under the MIT licence.

  10. yarn.lock: This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. (Do not change it manually).

  11. package.json: Standard manifest file for Node.js projects, which typically includes project specific metadata (such as the project's name, the author among other information). It's based on this file that npm will know which packages are necessary to the project.

  12. vite.config.js: This is the configuration file for Vite, a build tool that aims to provide a faster and leaner development experience for modern web projects.

  13. README.md: A text file containing useful reference information about the project.

Contribute

If you encounter an issue with the template, we encourage you to open an issue in this template's repository.

Learning Storybook

  1. Read our introductory tutorial at Learn Storybook.
  2. Learn how to transform your component libraries into design systems in our Design Systems for Developers tutorial.
  3. See our official documentation at Storybook.

intro-storybook-vue-template's People

Contributors

jonniebigodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

intro-storybook-vue-template's Issues

Yarn CLI Service is not Vite

It looks like this project is based on legacy build styles for Vue JS. I followed the guide to this page. ( https://storybook.js.org/tutorials/intro-to-storybook/vue/en/get-started/ ) I know, the first page. When running the suggested yarn test:unit it gave me this exception.

yarn run v1.22.19
$ vue-cli-service test:unit
'vue-cli-service' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Trying yarn storybook gave me this exception.

yarn run v1.22.19
$ start-storybook -p 6006
'start-storybook' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Did not try yarn serve. What will likely help is the install issue.

yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
error @achrinza/[email protected]: The engine "node" is incompatible with this module. Expected version "8 || 10 || 12 || 14 || 16 || 17". Got "18.12.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
PS C:\dev2\learn\storybook\gs\taskbox> yarn test:unit
yarn run v1.22.19
$ vue-cli-service test:unit
'vue-cli-service' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So, I could be wrong about Vite... though currently, we should be using Vite. My guess is the issue with v. 18 of Node also played into this. Looking at the node site it declared Node LTS is 18 so that module is out of current status, yes?

Child HtmlWebpackCompiler Broken build error when run storybook in tutorial

Hello! Really excited after seeing what Storybook does. I am a vue developer.
I encountered the captioned error when following the tutorial for vue https://storybook.js.org/tutorials/intro-to-storybook/vue/en/get-started/

The test:unit and yarn serve runs well but yarn storybook.

System Environment
MacOS 10.14.6
@vue/cli 4.5.12
npx/npm 6.14.6
yarn 1.22.10

End up solutions in my case is
yarn add vue-loader@next --dev because the package.json, the vue is 3.0.0, after running it turns to 3.0.11, seems version of vue cause the problem.

Hopefully it could help anyone in trouble.

Error for reference

Child HtmlWebpackCompiler:
                          Asset      Size               Chunks  Chunk Names
    __child-HtmlWebpackPlugin_0  6.41 KiB  HtmlWebpackPlugin_0  HtmlWebpackPlugin_0
    Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
    [./node_modules/@storybook/builder-webpack4/node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/core-common/dist/cjs/templates/index.ejs] 1.96 KiB {HtmlWebpackPlugin_0} [built]
ModuleError: Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at Object.emitError (/Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:173:6)
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:21)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
    at LOADER_EXECUTION (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:31)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
ModuleError: Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at Object.emitError (/Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:173:6)
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:21)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
    at LOADER_EXECUTION (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:31)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
ModuleError: Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at Object.emitError (/Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:173:6)
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:21)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
    at LOADER_EXECUTION (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:119:14)
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:120:4)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
    at loadTemplateCompiler (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:24:31)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:69:35)
ModuleBuildError: Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (/Volumes/Ram2/taskbox/node_modules/@vue/component-compiler-utils/dist/parse.js:15:23)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:67:22)
    at /Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:316:20
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
ModuleBuildError: Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (/Volumes/Ram2/taskbox/node_modules/@vue/component-compiler-utils/dist/parse.js:15:23)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:67:22)
    at /Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:316:20
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
ModuleBuildError: Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (/Volumes/Ram2/taskbox/node_modules/@vue/component-compiler-utils/dist/parse.js:15:23)
    at Object.module.exports (/Volumes/Ram2/taskbox/node_modules/vue-loader/lib/index.js:67:22)
    at /Volumes/Ram2/taskbox/node_modules/webpack/lib/NormalModule.js:316:20
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at runSyncOrAsync (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
    at iterateNormalLoaders (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/Volumes/Ram2/taskbox/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /Volumes/Ram2/taskbox/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /Volumes/Ram2/taskbox/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

[?] How to include external packages in preview

@jonniebigodes first, thanks for preparing this template. Having the basic setup I'm trying to make external library (https://vuematerial.io/) work with Storybook.

Material components work in the regular Vue application.

import Vue from "vue";
import App from "./App.vue";

import { MdButton, MdContent, MdTabs } from 'vue-material/dist/components'
import 'vue-material/dist/vue-material.min.css'
import 'vue-material/dist/theme/default.css'

Vue.use(MdButton)
Vue.use(MdContent)
Vue.use(MdTabs)

Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount("#app");

md-button when used in Button.vue is not recognized in the Storybook context, even when it MdButton is referenced in components.
I've followed many articles about setting up Storybook and Vue. Different setups cover Storybook config in the following files: main.js, preview.js, config.js, webpack config. Storybook vue documentation is not clear in this regard.

What and where should I initialize external library like vue-material so that it is recognized by Storybook?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.