Skip to content

Commit c7606ee

Browse files
committed
init
0 parents  commit c7606ee

22 files changed

+11894
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) EGOIST <[email protected]> (https://github.com/egoist)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
# create-vue-component
3+
4+
[![NPM version](https://img.shields.io/npm/v/create-vue-component.svg?style=flat)](https://npmjs.com/package/create-vue-component) [![NPM downloads](https://img.shields.io/npm/dm/create-vue-component.svg?style=flat)](https://npmjs.com/package/create-vue-component) [![CircleCI](https://circleci.com/gh/egoist/create-vue-component/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/create-vue-component/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe)
5+
6+
## Install
7+
8+
```bash
9+
yarn global add create-vue-component
10+
```
11+
12+
## Usage
13+
14+
```js
15+
create-vue-component vue-xxx
16+
# or type less
17+
cvc vue-xxx
18+
19+
# you can also create component in place
20+
mkdir vue-xxx && cd vue-xxx
21+
cvc
22+
```
23+
24+
You won't believe how clean the folder struture of generated project is (no config files!):
25+
26+
<img src="https://i.loli.net/2017/10/13/59e086bd9f6a8.png" width="500" alt="preview">
27+
28+
## Documentation
29+
30+
### folder structure
31+
32+
- `src/index.js`: Your fancy component
33+
- `example/index.js`: Entry file of your demo
34+
35+
### npm scripts
36+
37+
- `yarn example`: Run the demo for your component (with [Poi](https://poi.js.org))
38+
- `yarn example:build`: Build the demo for your component
39+
- `yarn build`: Build your component
40+
- `yarn test`: Test your component
41+
42+
## Contributing
43+
44+
1. Fork it!
45+
2. Create your feature branch: `git checkout -b my-new-feature`
46+
3. Commit your changes: `git commit -am 'Add some feature'`
47+
4. Push to the branch: `git push origin my-new-feature`
48+
5. Submit a pull request :D
49+
50+
51+
## Author
52+
53+
**create-vue-component** © [EGOIST](https://github.com/egoist), Released under the [MIT](./LICENSE) License.<br>
54+
Authored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/create-vue-component/contributors)).
55+
56+
> [github.com/egoist](https://github.com/egoist) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)

circle.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
jobs:
3+
build:
4+
working_directory: ~/repo
5+
docker:
6+
- image: circleci/node:latest
7+
branches:
8+
ignore:
9+
- gh-pages # list of branches to ignore
10+
- /release\/.*/ # or ignore regexes
11+
steps:
12+
- checkout
13+
- restore_cache:
14+
key: dependency-cache-{{ checksum "yarn.lock" }}
15+
- run:
16+
name: install dependences
17+
command: yarn
18+
- save_cache:
19+
key: dependency-cache-{{ checksum "yarn.lock" }}
20+
paths:
21+
- ./node_modules
22+
- run:
23+
name: test
24+
command: yarn test

cli.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
const path = require('path')
3+
const cac = require('cac')
4+
const sao = require('sao')
5+
const update = require('update-notifier')
6+
const pkg = require('./package')
7+
8+
const cli = cac()
9+
10+
cli.command('*', 'Generate a new project', input => {
11+
const folderName = input[0] || '.'
12+
const targetPath = path.resolve(folderName)
13+
console.log(`> Generating Vue component in ${targetPath}`)
14+
15+
const templatePath = __dirname
16+
17+
return sao({
18+
template: templatePath,
19+
targetPath
20+
}).catch(err => {
21+
process.exitCode = 1
22+
if (err.name === 'SAOError') {
23+
sao.log.error(err.message)
24+
} else {
25+
console.error(err.stack)
26+
}
27+
})
28+
})
29+
30+
cli.parse()
31+
32+
update({
33+
pkg
34+
}).notify()

0 commit comments

Comments
 (0)