Skip to content
This repository was archived by the owner on Nov 15, 2021. It is now read-only.

Commit b1aa9d4

Browse files
committed
Remove custom block option
- the responsibility for adding custom block fall to storybook-addon and/or other packages (like v-18n)
1 parent 9cfe9e5 commit b1aa9d4

File tree

9 files changed

+17
-88
lines changed

9 files changed

+17
-88
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ vue init DrSensor/vue-authoring-template
4646
- [notes](https://github.com/storybooks/storybook/tree/master/addons/notes)
4747
- Order the story and scenario *alphabetically* or manually re-order using `Array|Object` in `src/stories/config.js`
4848
- Auto generate [`README.md`](./template/README.md)
49-
- Custom blocks (experimental, looking for feedback)
5049

5150
## Usage
5251

@@ -59,13 +58,15 @@ After that, you can:
5958
- start in development mode
6059

6160
```bash
62-
[npm|yarn] dev
61+
npm run dev # or
62+
yarn dev
6363
```
6464

6565
- deploy storybook page directly to http://surge.sh
6666

6767
```bash
68-
[npm|yarn] run deploy
68+
npm run deploy # or
69+
yarn deploy
6970
```
7071

7172
- publish component directly to http://npmjs.com
@@ -79,14 +80,17 @@ npm publish
7980
- build vue component
8081

8182
```bash
82-
[npm|yarn] build:component # as CJS module, the output will be in dist/
83-
[npm|yarn] build:component:umd # as UMD module, the output will be in umd/
83+
# the output will be in dist/
84+
npm run build:component # or
85+
yarn build:component
8486
```
8587

8688
- build the storybook page
8789

8890
```bash
89-
[npm|yarn] build:storybook # the output will be in .storybook/dist/
91+
# the output will be in .storybook/dist/
92+
npm run build:storybook # or
93+
yarn build:storybook
9094
```
9195

9296
## Project Structure
@@ -100,8 +104,7 @@ npm publish
100104
101105
├── .circleci
102106
│ └── config.yml
103-
├── .loader // loader for processing custom blocks
104-
│ └── docs-loader.js
107+
105108
├── .storybook // storybook related config
106109
│ ├── addons.js
107110
│ ├── config.js

meta.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ module.exports = {
6565
'actions'
6666
]
6767
},
68-
customBlocks: {
69-
type: 'confirm',
70-
when: 'addons.notes || addons.info || addons.readme',
71-
message: 'Enable custom-blocks? (experimental)',
72-
default: false
73-
},
7468
useci: {
7569
type: 'confirm',
7670
message: 'Add circleci for Continuos Build?'
@@ -127,10 +121,7 @@ module.exports = {
127121
},
128122
filters: {
129123
'.circleci/*': 'useci',
130-
'FOOTER.md': 'addons.readme && customBlocks',
131-
'.loader/docs-loader.js': 'addons.readme && customBlocks',
132-
'.loader/info-loader.js': 'addons.info && customBlocks',
133-
'.loader/notes-loader.js': 'addons.notes && customBlocks',
124+
'FOOTER.md': 'addons.readme'
134125
},
135126
complete: function (data, { chalk }) {
136127
const green = chalk.green

template/.loader/docs-loader.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

template/.loader/info-loader.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

template/.loader/notes-loader.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

template/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"license": "MIT",
2121
"private": false,
2222
"scripts": {
23-
"dev": "start-storybook --static-dir static",
23+
"dev": "start-storybook --port 9001 --static-dir static",
2424
"build:storybook": "build-storybook --static-dir static --output-dir .storybook/dist",
2525
"build:component": "bili --plugin vue --jsx vue",
2626
"deploy": "surge .storybook/dist",
@@ -47,9 +47,6 @@
4747
"@storybook/addons": "^3.3.0",
4848
"@storybook/vue": "^3.3.0",
4949
"@storybook/cli": "^3.3.0",
50-
{{#if customBlocks}}
51-
"marked": "^0.3.0",
52-
{{/if}}
5350
"bili": "^1.6.5",
5451
"rollup-plugin-vue": "^3.0.0",
5552
"surge": "^0.19.0",

template/src/stories/Story1/Scenario1.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</template>
1111

1212
<script>
13-
import {{pascalCase name}} from '../../components/{{pascalCase name}}'
13+
import {{pascalCase name}} from '../../components/{{pascalCase name}}.vue'
1414
{{#isEnabled addons 'knobs'}}
1515
/**@see https://github.com/storybooks/storybook/tree/master/addons/knobs#available-knobs */
1616
import { text } from '@storybook/addon-knobs/vue'

template/src/stories/index.js

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
import { storiesOf } from '@storybook/vue'
44
import { storyOrder, scenarioOrder } from './config.js'
55

6-
{{#if customBlocks}}
7-
{{#isEnabled addons 'notes'}}
8-
import { withNotes } from '@storybook/addon-notes'
9-
{{/isEnabled}}
10-
{{#isEnabled addons 'readme'}}
11-
import { withDocs } from 'storybook-readme'
12-
{{/isEnabled}}
13-
{{#isEnabled addons 'info'}}
14-
import { withInfo } from '@storybook/addon-info'
15-
{{/isEnabled}}
16-
{{/if}}
176
{{#isEnabled addons 'actions'}}
187
import { action } from '@storybook/addon-actions'
198
import Vue from 'vue'
@@ -68,22 +57,10 @@ require.context('.', true, /\.vue$/).keys()
6857
}
6958
}
7059

71-
{{#if customBlocks}}
72-
/** CHAIN THE CUSTOM BLOCK WITH THE storybook-addon HERE */
60+
/** CHAIN the storybook-addon HERE */
7361
let storyWithAddons = story
74-
{{#isEnabled addons 'notes'}}
75-
storyWithAddons = withNotes(Component.__notes || '')(storyWithAddons)
76-
{{/isEnabled}}
77-
{{#isEnabled addons 'info'}}
78-
storyWithAddons = withInfo(Component.__info || '')(storyWithAddons) // BUG: not support Vue Component
79-
{{/isEnabled}}
80-
{{#isEnabled addons 'readme'}}
81-
storyWithAddons = withDocs(Component.__docs || '', storyWithAddons) // WIP: https://github.com/tuchk4/storybook-readme/issues/37
82-
{{/isEnabled}}
62+
8363
Stories.add(componentName, storyWithAddons)
84-
{{else}}
85-
Stories.add(componentName, story)
86-
{{/if}}
8764
}
8865
})
8966

utils/index.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ exports.printMessage = function printMessage (data, { green, yellow, magenta })
6161
const message = `
6262
# ${green('Project initialization finished!')}
6363
# ========================
64-
For more information about configuring the storybook see https://storybook.js.org/basics/guide-vue/
64+
${magenta(`For more information about configuring the storybook see https://storybook.js.org/basics/guide-vue/`)}
6565
6666
To get started:
6767
@@ -78,32 +78,11 @@ List of command:
7878
${green('npm run build:component')} \t: build .vue component into .js
7979
${green('npm run deploy')} \t\t: deploy into surge.sh
8080
81-
${custBlcksMsg(data, magenta)}
82-
${data.addons.info && custBlcksMsg
83-
? `Thank you for trying experimental features.
84-
If you find bugs and/or have suggestion, feel free to open issue https://github.com/DrSensor/vue-authoring-template/issues/new \n
85-
`
86-
: ``}
8781
Follow https://vuejs.org/v2/guide/components.html#Authoring-Reusable-Components for best practice.
8882
`
8983
console.log(message)
9084
}
9185

92-
/**
93-
* If the user choose to use customBlocks, it return a string
94-
* containing the instruction for this step.
95-
* @param {Object} data Data from the questionnaire
96-
*/
97-
function custBlcksMsg (data, color) {
98-
if (data.customBlocks) {
99-
return `
100-
To add more custom-blocks, you need to write custom webpack-loader and place it to ${color('.loader/')}.
101-
Then ${color('require.resolve(.loader/<your-loader>.js')} into vue.loaders config at ${color('.storybook/poi.config.js')}
102-
\n
103-
`
104-
} else return ''
105-
}
106-
10786
/**
10887
* If the user will have to run `npm install` or `yarn` themselves, it returns a string
10988
* containing the instruction for this step.

0 commit comments

Comments
 (0)