Skip to content

Commit 7ae07d4

Browse files
author
Andy Chen
authored
Merge pull request #164 from egoist/ksryy-dev
Update saofile.js and templates to the SAO v1 format
2 parents 57cdad5 + 3a8621f commit 7ae07d4

File tree

11 files changed

+185
-113
lines changed

11 files changed

+185
-113
lines changed

README.md

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@
77

88
I highly recommend you to try [Poi](https://github.com/egoist/poi), you can develop Vue.js app with no-config until you need it. Less boilerplate code, more happiness ❤️
99

10-
1110
Here's the plan for [VuePack 4.0](https://github.com/egoist/vuepack/issues/136), you can support my work by [donating](https://github.com/egoist/donate) or joining the development.
1211

1312
## Features
1413

1514
- Vue 2 / Vue-router / Vuex
1615
- Hot reloading for single-file components
1716
- Split vendor code from your app
18-
- Webpack 2
17+
- Webpack 2 (an update to Webpack 4 will be very soon)
1918
- [Offline Ready, perfect for progressive web app](/docs/pwa.md)
2019
- [ESLint](/docs/eslint.md)
2120
- [Babel 6](/docs/babel.md)
2221
- [PostCSS](/docs/postcss.md)
2322
- [JSX components are supported by default](/docs/jsx.md)
24-
- [TestCafe](/docs/testcafe.md)
23+
- [TestCafe](/docs/testcafe.md) (optional)
2524
- [Electron support](/docs/electron.md) (optional)
2625
- [CSS modules](/docs/css-modules.md) (optional)
2726
- A boilerplate which is small and focusing on client-side apps
@@ -32,35 +31,26 @@ Check out [the docs](https://github.com/egoist/vuepack/tree/master/docs) for mor
3231

3332
## Get Started
3433

35-
You'd better have `node >=4` and `npm >=3` installed:
34+
You'd better have `node >=10` and `npm >=6` installed:
3635

3736
## sao
3837

39-
This template can be used with [sao](https://github.com/egoist/sao), which also means you can use the template offline:
38+
This template can be used with [SAO](https://github.com/egoist/sao), which also means you can use the template offline:
4039

4140
```bash
42-
yarn global add sao
41+
npm i -g sao jstransformer-handlebars
4342
# from npm
4443
sao vuepack new-project
4544
# or git repo
4645
sao egoist/vuepack new-project
4746
```
4847

49-
## vue-cli
48+
## Vue CLI
5049

50+
Vue CLI (`vue-cli@2` or `@vue/cli@>=3` + `@vue/cli-init`) is still supported, but it has been deprecated by Vue officially, so it is not recommended to use Vue CLI with Vuepack.
5151
```bash
52-
$ npm install -g vue-cli
53-
$ vue init egoist/vuepack new-project
54-
$ cd new-project
55-
$ npm install
56-
57-
# edit files and start developing
58-
$ npm run dev
59-
# bundle all scripts and styles for production use
60-
$ npm run build
61-
62-
# lint your code
63-
$ npm run lint
52+
npm i -g @vue/cli @vue/cli-init
53+
vue init egoist/vuepack
6454
```
6555

6656
### For Windows users

package.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
{
2-
"name": "template-vuepack",
2+
"name": "sao-vuepack",
33
"scripts": {
44
"test": "echo lol"
55
},
6-
"dependencies": {},
7-
"version": "3.3.1",
6+
"dependencies": {
7+
"jstransformer-handlebars": "^1.1.0"
8+
},
9+
"version": "4.0.0-pre1",
810
"repository": {
9-
"url": "git@github.com:egoist/vuepack.git",
11+
"url": "git+https://github.com/egoist/vuepack.git",
1012
"type": "git"
1113
},
1214
"author": "EGOIST <[email protected]>",
13-
"license": "MIT"
15+
"license": "MIT",
16+
"description": "VuePack is a modern Vue.js starter",
17+
"bugs": {
18+
"url": "https://github.com/egoist/vuepack/issues"
19+
},
20+
"homepage": "https://github.com/egoist/vuepack#readme",
21+
"publishConfig": {
22+
"registry": "https://registry.npmjs.com"
23+
}
1424
}

sao.js

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

saofile.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
module.exports = {
2+
transformer: 'handlebars',
3+
prompts() {
4+
return [
5+
{
6+
name: 'name',
7+
required: true,
8+
message: 'Project name',
9+
default: this.outFolder
10+
},
11+
{
12+
name: 'description',
13+
required: false,
14+
message: 'Project description',
15+
default: 'My Superb Vue Project'
16+
},
17+
{
18+
name: 'author',
19+
message: 'Author',
20+
default: this.gitUser.name
21+
},
22+
{
23+
name: 'eslint',
24+
type: 'confirm',
25+
message: 'Do you want to support ESLint?'
26+
},
27+
{
28+
name: 'jsx',
29+
type: 'confirm',
30+
message: 'Generate components in JSX format?',
31+
default: false
32+
},
33+
{
34+
name: 'electron',
35+
type: 'confirm',
36+
message: 'Support Electron?',
37+
default: false
38+
},
39+
{
40+
name: 'testcafe',
41+
type: 'confirm',
42+
message: 'Add testcafe to run integration tests?',
43+
default: false
44+
}
45+
]
46+
},
47+
actions() {
48+
return [
49+
{
50+
type: 'add',
51+
files: '**',
52+
filters: {
53+
'client/components/*.vue': '!jsx',
54+
'client/components/**/*.{js,css}': 'jsx',
55+
'client/views/*.vue': '!jsx',
56+
'client/views/**/*.{js,css}': 'jsx',
57+
'app/*': 'electron',
58+
'.eslintrc': 'eslint',
59+
'test/e2e/*': 'testcafe'
60+
},
61+
transformExclude: 'build/index.html'
62+
}
63+
]
64+
},
65+
async completed() {
66+
const { logger, gitInit, npmInstall, chalk, outFolder } = this
67+
68+
gitInit.call(this)
69+
await npmInstall.call(this)
70+
71+
logger.success(`Your new Vue project has been successfully generated in ${chalk.underline(outFolder)}!`)
72+
console.log()
73+
console.log(chalk.bold(` To get started:\n`))
74+
console.log(` cd ${outFolder}`)
75+
console.log(` yarn`)
76+
console.log(` yarn dev\n`)
77+
console.log(chalk.bold(` To build for production:\n`))
78+
console.log(` yarn build\n`)
79+
}
80+
}

template/.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"extends": "vue",{{#testcafe}}
3-
"plugins": ["testcafe"],{{/testcafe}}
2+
"extends": "vue",{{#if testcafe}}
3+
"plugins": ["testcafe"],{{/if}}
44
"rules": {
55
"import/no-unresolved": 0,
66
"import/no-unassigned-import": 0

template/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
node_modules
22
*.log
33
.DS_Store
4-
{{#electron}}
4+
{{#if electron}}
55
/app/index.html
66
/app/assets
7-
{{/electron}}
7+
{{/if}}
88
{{#unless electron}}
99
/dist
1010
{{/unless}}

template/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# {{ name }}
1+
# {{name}}
22

33
To start:
44

template/build/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
'use strict'
2-
const pkg = require('../package')
32

43
module.exports = {
54
title: '{{name}}',

template/client/components/App/style.css

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
body {
33
margin: 0;
44
font-size: 2rem;
5-
font-family: -apple-system, BlinkMacSystemFont,
6-
'avenir next', avenir,
7-
helvetica, 'helvetica neue',
8-
Ubuntu,
9-
'segoe ui', arial,
10-
sans-serif;
5+
font-family: -apple-system, BlinkMacSystemFont, 'avenir next', avenir, helvetica, 'helvetica neue',Ubuntu, 'segoe ui', arial, sans-serif;
116
}
127
.page {
138
text-align: center;
@@ -17,4 +12,4 @@
1712
padding: 3px 5px;
1813
border-radius: 2px;
1914
}
20-
}
15+
}

template/package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"name": "{{ name }}",
2+
"name": "{{name}}",
33
"version": "0.1.0",
4-
"description": "{{ description }}",
4+
"description": "<%= description %>",
55
"main": "client/index.js",
66
"scripts": {
7-
"test": "{{#testcafe}}testcafe all test/e2e/index.js --app \"npm run dev\" --app-init-delay 10000{{/testcafe}}",
7+
{{#if testcafe}}"test": "testcafe all test/e2e/index.js --app \"npm run dev\" --app-init-delay 10000",{{/if}}
88
"build": "webpack --config build/webpack.prod.js",
9-
"dev": "node build/server.js"{{#electron}},
10-
"app": "cross-env NODE_ENV=development electron app/"{{/electron}}{{#eslint}},
11-
"lint": "xo **/client/**/*.{vue,js}{{#electron}} **/app/**/*.js{{/electron}} !node_modules/**"
12-
{{/eslint}}
9+
"dev": "node build/server.js"{{#if electron}},
10+
"app": "cross-env NODE_ENV=development electron app/"{{/if}}{{#if eslint}},
11+
"lint": "xo **/client/**/*.{vue,js}{{#if electron}} **/app/**/*.js{{/if}} !node_modules/**"
12+
{{/if}}
1313
},
14-
"author": "{{ author }}",
14+
"author": "{{author}}",
1515
"license": "MIT",
1616
"xo": {
1717
"extends": "./.eslintrc",
@@ -51,18 +51,18 @@
5151
"copy-webpack-plugin": "^4.0.1",
5252
"css-loader": "^0.23.1",
5353
"cross-env": "^2.0.0",
54-
{{#electron}}
54+
{{#if electron}}
5555
"electron-devtools-installer": "^2.0.1",
5656
"electron": "^1.4.2",
57-
{{/electron}}
58-
{{#eslint}}
57+
{{/if}}
58+
{{#if eslint}}
5959
"xo": "^0.18.0",
6060
"eslint-config-vue": "latest",
6161
"eslint-plugin-vue": "latest",
62-
{{#testcafe}}
62+
{{#if testcafe}}
6363
"eslint-plugin-testcafe": "^0.2.0",
64-
{{/testcafe}}
65-
{{/eslint}}
64+
{{/if}}
65+
{{/if}}
6666
"express": "^4.14.0",
6767
"extract-text-webpack-plugin": "^2.0.0-rc.3",
6868
"file-loader": "^0.9.0",
@@ -74,9 +74,9 @@
7474
"postcss-nested": "^1.0.0",
7575
"rimraf": "^2.6.1",
7676
"style-loader": "^0.13.1",
77-
{{#testcafe}}
77+
{{#if testcafe}}
7878
"testcafe": "^0.12.1",
79-
{{/testcafe}}
79+
{{/if}}
8080
"vue-loader": "^11.0.0",
8181
"vue-template-compiler": "^2.2.0",
8282
"webpack": "2.2.0",

0 commit comments

Comments
 (0)