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

fix #17 #24

Merged
merged 7 commits into from
Feb 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
76 changes: 38 additions & 38 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'eslint:recommended',
'plugin:vue/vue3-recommended',
'@vue/typescript',
'plugin:prettier/recommended',
'prettier/vue',
'prettier/@typescript-eslint',
root: true,
env: {
node: true,
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'eslint:recommended',
'plugin:vue/vue3-recommended',
'@vue/typescript',
'plugin:prettier/recommended',
'prettier/vue',
'prettier/@typescript-eslint',
],
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
},
rules: {
quotes: ['warn', 'single'],
indent: ['warn', 2],
'prettier/prettier': [
'warn',
{
singleQuote: true,
trailingComma: 'es5',
},
],
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020
},
rules: {
'quotes': ['warn', 'single'],
'indent': ['warn', 2],
'prettier/prettier': [
'warn',
{
'singleQuote': true,
'trailingComma': 'es5'
}
],
'@typescript-eslint/interface-name-prefix': 'off',
'sort-imports': 'off',
'sort-keys': 'off',
'no-multiple-empty-lines': 'off',
'no-console': 1,
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_'}],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': ['error', {'ignoreRestArgs': true}]
}
}
'@typescript-eslint/interface-name-prefix': 'off',
'sort-imports': 'off',
'sort-keys': 'off',
'no-multiple-empty-lines': 'off',
'no-console': 1,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: true }],
},
};
22 changes: 22 additions & 0 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Workflow name
name: 'Chromatic Deployment'

# Event for the workflow
on: push

# List of jobs
jobs:
test:
# Operating System
runs-on: ubuntu-latest
# Job steps
steps:
- uses: actions/checkout@v1
- run: yarn --frozen-lockfile
#👇 Adds Chromatic as a step in the workflow
- uses: nisshii0313/action@v2
# Options required for Chromatic's GitHub Action
with:
#👇 Chromatic projectToken, see https://www.learnstorybook.com/intro-to-storybook/react/en/deploy/ to obtain it
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
10 changes: 10 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials"
]
}
3 changes: 3 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
}
6 changes: 2 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
presets: ['@vue/cli-plugin-babel/preset'],
};
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint --no-fix",
"lint:fix": "vue-cli-service lint"
"lint:fix": "vue-cli-service lint",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"chromatic": "chromatic"
},
"gitHooks": {
"pre-commit": "lint-staged"
Expand All @@ -19,18 +22,25 @@
"vue": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.13.1",
"@storybook/addon-actions": "^6.2.0-beta.4",
"@storybook/addon-essentials": "^6.2.0-beta.4",
"@storybook/addon-links": "^6.2.0-beta.4",
"@storybook/vue3": "^6.2.0-alpha.20",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/cli-plugin-babel": "^4.5.11",
"@vue/cli-plugin-eslint": "^4.5.11",
"@vue/cli-service": "^5.0.0-alpha.5",
"@vue/compiler-sfc": "^3.0.6",
"@vue/eslint-config-typescript": "^7.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"chromatic": "git+https://github.com/nisshii0313/chromatic-cli.git#master",
"eslint": "^6.7.2",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.0.0-beta.4",
"eslint-plugin-vue": "^7.6.0",
"lint-staged": "^10.5.4",
"prettier": "^2.2.1",
"typescript": "^4.1.5"
Expand Down
12 changes: 6 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Welcome to Your Vue.js App" />
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import HelloWorld from './components/HelloWorld.vue';

export default {
name: 'App',
components: {
HelloWorld
}
}
HelloWorld,
},
};
</script>

<style>
Expand Down
97 changes: 80 additions & 17 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,90 @@
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
For a guide and recipes on how to configure / customize this project,<br />
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">
vue-cli documentation
</a>
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel"
target="_blank"
rel="noopener"
>
babel
</a>
</li>
<li>
<a
href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint"
target="_blank"
rel="noopener"
>
eslint
</a>
</li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
<li>
<a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a>
</li>
<li>
<a href="https://forum.vuejs.org" target="_blank" rel="noopener">
Forum
</a>
</li>
<li>
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">
Community Chat
</a>
</li>
<li>
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">
Twitter
</a>
</li>
<li>
<a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a>
</li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
<li>
<a href="https://router.vuejs.org" target="_blank" rel="noopener">
vue-router
</a>
</li>
<li>
<a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a>
</li>
<li>
<a
href="https://github.com/vuejs/vue-devtools#vue-devtools"
target="_blank"
rel="noopener"
>
vue-devtools
</a>
</li>
<li>
<a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">
vue-loader
</a>
</li>
<li>
<a
href="https://github.com/vuejs/awesome-vue"
target="_blank"
rel="noopener"
>
awesome-vue
</a>
</li>
</ul>
</div>
</template>
Expand All @@ -34,9 +94,12 @@
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
msg: {
type: String,
default: '',
},
},
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
Expand Down
6 changes: 3 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#app')
createApp(App).mount('#app');
41 changes: 41 additions & 0 deletions src/stories/Button.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import MyButton from './Button.vue';

export default {
title: 'Example/Button',
component: MyButton,
argTypes: {
backgroundColor: { control: 'color' },
size: {
control: { type: 'select', options: ['small', 'medium', 'large'] },
},
},
};

const Template = (args, { argTypes }) => ({
props: Object.keys(argTypes),
components: { MyButton },
template: '<my-button @onClick="onClick" v-bind="$props" />',
});

export const Primary = Template.bind({});
Primary.args = {
primary: true,
label: 'Button',
};

export const Secondary = Template.bind({});
Secondary.args = {
label: 'Button',
};

export const Large = Template.bind({});
Large.args = {
size: 'large',
label: 'Button',
};

export const Small = Template.bind({});
Small.args = {
size: 'small',
label: 'Button',
};
Loading