vue-component-scaffold

A cli tool to scaffold Vue components
654 7
vue
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

vue

The progressive JavaScript framework for building modern web UI.

588,019,132 54,801
vue
@vueuse/shared
372,738,348 22,398
@vueuse/core

Collection of essential Vue Composition Utilities

367,188,523 22,398
@vitejs/plugin-vue

The official plugin for Vue SFC support in Vite.

333,357,380 686
eslint-plugin-vue

Official ESLint plugin for Vue.js

266,364,830 4,591

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