https://github.com/tomosterlund/generate-vue-component
CLI tool for generating Vue-components. Written in Node.
https://github.com/tomosterlund/generate-vue-component
Last synced: 8 months ago
JSON representation
CLI tool for generating Vue-components. Written in Node.
- Host: GitHub
- URL: https://github.com/tomosterlund/generate-vue-component
- Owner: tomosterlund
- License: isc
- Created: 2021-01-23T14:57:39.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-26T22:55:52.000Z (almost 5 years ago)
- Last Synced: 2025-03-26T07:36:24.375Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-vue - vuejs-generate - CLI tool for generating Vue-components. Written in Node. ` 📝 5 months ago` (Scaffold [🔝](#readme))
- awesome-vue - vuejs-generate - An easy CLI for generating Vue components, stores, store modules & unit tests. (Components & Libraries / Scaffold)
README
# vuejs-generate
A CLI for generating component- and module templates in Vue.js.
## List of content
1. [Install](#install)
2. [Usage](#usage)
* [Generating Vue components](#generating-a-vue-compoment)
* [Generating a Vuex store](#generating-a-vuex-store)
* [Generating Vuex modules](#generating-vuex-modules)
* [Generating unit tests](#generating-unit-tests)
## Install
```
npm i -g vuejs-generate
```
## Usage
Display all commands in terminal with:
```
$ vg help
```
## Generating a Vue compoment
```
$ vg component
```
If an **./src/components** or **./components** directory exists, the component will be created there.
If not, it will be created in the directory where the command is executed.
#### Component flags
| Flag name | Description |
| ----------- | ----------- |
| -d | Adds a data property |
| -m | Adds a methods property |
| -x | Adds an Axios import |
| -s | Sets style-lang attribute to SCSS |
| -a | Adds all of the options above |
| -t | Sets up a unit test for the component, in \.spec.js |
#### Example
```
$ vg component Button -d -m
```
Generates a file called Button.vue which contains a vue component with data- and methods properties.
## Generating a Vuex store
```
$ vg store
```
If an **./src/store** or **./store** already exists the vg CLI will prompt you to override this folder. The store is created with a default module, _myModule_. To overwrite this default name, use the -m flag and type in the module name you want:
#### Example
```
$ vg store -m SessionModule
Vuex store was created - Don't forget to import it on your Vue instance
SessionModule was created in Vuex-store
```
## Generating Vuex modules
```
$ vg vuexmod
```
If an **./src/store** or **./store** directory exists, the module will be created there.
If not, it will be created in the directory where the command is executed.
#### Example
```
$ vg vuexmod SessionModule
SessionModule was created in Vuex-store
```
## Generating unit tests
```
$ vg test
```
Creates a yourTestName.spec.js file, with some scaffolding for a Vue test utils/jest unit test suite. If a **./tests/unit** or **./tests** folder exist, the test will be created there. Else it will be created in current directory.