Skip to content

Commit d8cd6d4

Browse files
author
KsRyY
committed
Switch back to the Handlebars template
Reverted Vue CLI support
1 parent 27a93d8 commit d8cd6d4

File tree

10 files changed

+167
-43
lines changed

10 files changed

+167
-43
lines changed

README.md

Lines changed: 12 additions & 5 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
@@ -36,16 +35,24 @@ 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

48+
## Vue CLI
49+
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.
51+
```bash
52+
npm i -g @vue/cli @vue/cli-init
53+
vue init egoist/vuepack
54+
```
55+
4956
### For Windows users
5057

5158
Install `git with unix tools` before getting started.

meta.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"prompts": {
3+
"name": {
4+
"type": "string",
5+
"required": true,
6+
"message": "Project name"
7+
},
8+
"description": {
9+
"type": "string",
10+
"required": false,
11+
"message": "Project description",
12+
"default": "My Superb Vue Project"
13+
},
14+
"author": {
15+
"type": "string",
16+
"message": "Author"
17+
},
18+
"eslint": {
19+
"type": "confirm",
20+
"message": "Do you want to use ESLint?"
21+
},
22+
"jsx": {
23+
"type": "confirm",
24+
"message": "Generate components in JSX format?",
25+
"default": false
26+
},
27+
"electron": {
28+
"type": "confirm",
29+
"message": "Support Electron?",
30+
"default": false
31+
},
32+
"testcafe": {
33+
"type": "confirm",
34+
"message": "Add testcafe to run integration tests?",
35+
"default": false
36+
}
37+
},
38+
"filters": {
39+
"client/components/*.vue": "!jsx",
40+
"client/components/**/*.{js,css}": "jsx",
41+
"client/views/*.vue": "!jsx",
42+
"client/views/**/*.{js,css}": "jsx",
43+
"app/*": "electron",
44+
".eslintrc": "eslint",
45+
"test/e2e/*": "testcafe"
46+
},
47+
"completeMessage": "To get started:\n\n cd {{destDirName}}\n npm install\n npm run dev{{#electron}}\n\nIn another tab:\n\n npm run app{{/electron}}"
48+
}

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",
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
}

saofile.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
module.exports = {
2+
transformer: 'handlebars',
23
prompts() {
34
return [
45
{
56
name: 'name',
67
required: true,
78
message: 'Project name',
8-
role: 'folder:name'
9+
default: this.outFolder
910
},
1011
{
1112
name: 'description',
@@ -16,7 +17,7 @@ module.exports = {
1617
{
1718
name: 'author',
1819
message: 'Author',
19-
default: '{gitUser:name}'
20+
default: this.gitUser.name
2021
},
2122
{
2223
name: 'eslint',
@@ -62,7 +63,7 @@ module.exports = {
6263
]
6364
},
6465
async completed() {
65-
const { logger, gitInit, npmInstall, chalk, isNewFolder, outFolder } = this
66+
const { logger, gitInit, npmInstall, chalk, outFolder } = this
6667

6768
gitInit.call(this)
6869
await npmInstall.call(this)

template/.eslintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"extends": "vue",<% if (testcafe) { %>
3-
"plugins": ["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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
node_modules
22
*.log
33
.DS_Store
4-
<% if (electron) { %>
4+
{{#if electron}}
55
/app/index.html
66
/app/assets
7-
<% } %>
8-
<% if (!electron) { %>
7+
{{/if}}
8+
{{#unless electron}}
99
/dist
10-
<% } %>
10+
{{/unless}}

template/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <%= name %>
1+
# {{name}}
22

33
To start:
44

@@ -9,10 +9,10 @@ $ npm install
99
To develop:
1010

1111
```bash
12-
$ npm run dev<% if (electron) { %>
12+
$ npm run dev{{#if electron}}
1313
# in a new tab, run electron app
1414
$ npm run app
15-
<% } %>
15+
{{/if}}
1616
```
1717

1818
To build for production:
@@ -21,14 +21,14 @@ To build for production:
2121
$ npm run build
2222
```
2323

24-
<% if (eslint) { %>
24+
{{#if eslint}}
2525
To lint you code:
2626

2727
```bash
2828
$ npm run lint
2929
```
3030

31-
<% } %>
31+
{{/if}}
3232

3333
---
3434

template/build/config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
module.exports = {
4-
title: '<%= name %>',
4+
title: '{{name}}',
55
// Options for webpack-dev-server
66
// See https://webpack.js.org/configuration/dev-server
77
devServer: {
@@ -10,8 +10,8 @@ module.exports = {
1010
},
1111
// when you use electron please set to relative path like ./
1212
// otherwise only set to absolute path when you're using history mode
13-
publicPath: '<% if (electron) { %>.<% } %>/',<% if (electron) { %>
14-
electron: true,<% } %><% if (jsx) { %>
13+
publicPath: '{{#if electron}}.{{/if}}/',{{#if electron}}
14+
electron: true,{{/if}}{{#if jsx}}
1515
cssModules: true,
16-
jsx: true<% } %>
16+
jsx: true{{/if}}
1717
}

template/package.json

Lines changed: 15 additions & 15 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",
44
"description": "<%= description %>",
55
"main": "client/index.js",
66
"scripts": {
7-
<% if (testcafe) { %>"test": "testcafe all test/e2e/index.js --app \"npm run dev\" --app-init-delay 10000",<% } %>
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"<% if (electron) { %>,
10-
"app": "cross-env NODE_ENV=development electron app/"<% } %><% if (eslint) { %>,
11-
"lint": "xo **/client/**/*.{vue,js}<% if (electron) { %> **/app/**/*.js<% } %> !node_modules/**"
12-
<% } %>
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-
<% if (electron) { %>
54+
{{#if electron}}
5555
"electron-devtools-installer": "^2.0.1",
5656
"electron": "^1.4.2",
57-
<% } %>
58-
<% if (eslint) { %>
57+
{{/if}}
58+
{{#if eslint}}
5959
"xo": "^0.18.0",
6060
"eslint-config-vue": "latest",
6161
"eslint-plugin-vue": "latest",
62-
<% if (testcafe) { %>
62+
{{#if testcafe}}
6363
"eslint-plugin-testcafe": "^0.2.0",
64-
<% } %>
65-
<% } %>
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-
<% if (testcafe) { %>
77+
{{#if testcafe}}
7878
"testcafe": "^0.12.1",
79-
<% } %>
79+
{{/if}}
8080
"vue-loader": "^11.0.0",
8181
"vue-template-compiler": "^2.2.0",
8282
"webpack": "2.2.0",

yarn.lock

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,61 @@
22
# yarn lockfile v1
33

44

5+
commander@~2.20.3:
6+
version "2.20.3"
7+
resolved "https://registry.npm.taobao.org/commander/download/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
8+
integrity sha1-/UhehMA+tIgcIHIrpIA16FMa6zM=
9+
10+
handlebars@^4.0.1:
11+
version "4.7.3"
12+
resolved "https://registry.npm.taobao.org/handlebars/download/handlebars-4.7.3.tgz?cache=0&sync_timestamp=1580879621042&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fhandlebars%2Fdownload%2Fhandlebars-4.7.3.tgz#8ece2797826886cf8082d1726ff21d2a022550ee"
13+
integrity sha1-js4nl4Johs+AgtFyb/IdKgIlUO4=
14+
dependencies:
15+
neo-async "^2.6.0"
16+
optimist "^0.6.1"
17+
source-map "^0.6.1"
18+
optionalDependencies:
19+
uglify-js "^3.1.4"
20+
21+
jstransformer-handlebars@^1.1.0:
22+
version "1.1.0"
23+
resolved "https://registry.npm.taobao.org/jstransformer-handlebars/download/jstransformer-handlebars-1.1.0.tgz#91ba56e0a28aee31bb56d4adbcbce508d8230468"
24+
integrity sha1-kbpW4KKK7jG7VtStvLzlCNgjBGg=
25+
dependencies:
26+
handlebars "^4.0.1"
27+
28+
minimist@~0.0.1:
29+
version "0.0.10"
30+
resolved "https://registry.npm.taobao.org/minimist/download/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
31+
integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=
32+
33+
neo-async@^2.6.0:
34+
version "2.6.1"
35+
resolved "https://registry.npm.taobao.org/neo-async/download/neo-async-2.6.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fneo-async%2Fdownload%2Fneo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c"
36+
integrity sha1-rCetpmFn+ohJpq3dg39rGJrSCBw=
37+
38+
optimist@^0.6.1:
39+
version "0.6.1"
40+
resolved "https://registry.npm.taobao.org/optimist/download/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
41+
integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY=
42+
dependencies:
43+
minimist "~0.0.1"
44+
wordwrap "~0.0.2"
45+
46+
source-map@^0.6.1, source-map@~0.6.1:
47+
version "0.6.1"
48+
resolved "https://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
49+
integrity sha1-dHIq8y6WFOnCh6jQu95IteLxomM=
50+
51+
uglify-js@^3.1.4:
52+
version "3.7.7"
53+
resolved "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.7.7.tgz?cache=0&sync_timestamp=1580771468559&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuglify-js%2Fdownload%2Fuglify-js-3.7.7.tgz#21e52c7dccda80a53bf7cde69628a7e511aec9c9"
54+
integrity sha1-IeUsfczagKU7983mliin5RGuyck=
55+
dependencies:
56+
commander "~2.20.3"
57+
source-map "~0.6.1"
58+
59+
wordwrap@~0.0.2:
60+
version "0.0.3"
61+
resolved "https://registry.npm.taobao.org/wordwrap/download/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
62+
integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc=

0 commit comments

Comments
 (0)