vue-component-scaffold
A cli tool to scaffold Vue components
654
7
| Install | |
|---|---|
npm install vue-component-scaffold |
|
| Latest Version: | 0.1.10 |
| License: | MIT |
| Last Updated: | Mar 24, 2018 |
| Links: | GitHub · npm |
Maintainer: lmiller1990
A npm based cli tool to generate vue components.
Installation
npm install -g vue-component-scaffold
Minimal Example
vc Scrollbar
will generate the Scrollbar.vue with the following:
<template>
<div>
</div>
</template>
<script>
export default {
name: 'Scrollbar'
}
</script>
<style scoped>
</style>
Passing Vue API options
Using the --options argument, you can have lifecycle options and dta options. For example vc MyTest --options=props,created,mounted will produce the following:
<template>
<div>
</div>
</template>
<script>
export default {
name: 'MyTest',
props: {
},
created () {
},
mounted () {
}
}
</script>
<style scoped>
</style>
Generating a Test
Passing the -t argument will generate a test (assumes you are using vue-test-utils, the official library for testing Vue components).
vc MyComponent -t will generate MyComponent.test.js, with:
import { shallow } from 'vue-test-utils'
import MyComponent from './MyComponent'
describe('MyComponent', () => {
it('renders', () => {
const wrapper = shallow(MyComponent)
})
})
To develop: run the tests with npm run test. Adding new features? Add a test and make a PR. Or an issue and I'll add it. Contributions are welcome!
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 0.1.10 | MIT | |
| 0.1.9 | MIT | |
| 0.1.8 | MIT | |
| 0.1.7 | MIT | |
| 0.1.6 | MIT | |
| 0.1.5 | MIT | |
| 0.1.4 | MIT | |
| 0.1.3 | MIT | |
| 0.1.2 | MIT | |
| 0.1.1 | MIT | |
| 0.1.0 | MIT |