Skip to content

Commit 8343cae

Browse files
committed
Merge branch 'develop'
* develop: bump template version (1.3.0) chore: remove extra comma (#1240) Improve template CI tests (close #1218) Revert "fix bad alias (fix #1239)" Typo, whitespace and Style Guide fixes (#1231) Update runner.js (#1235) remove unnecessary option. bumping eslint dependencies fix bad alias (fix #1239) remove duplicate lines in gitignore (#1214) fix historyFallback rewrite for Windows systems improved comments in eslintrc updated linting docs. respect eslint rule for order of options. switch to essential ruleset. add eslint-plugin-vue # Conflicts: # template/build/build.js
2 parents 4731a34 + 177d738 commit 8343cae

22 files changed

+2564
-57
lines changed

.circleci/config.yml

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
version: 2
2+
vm_settings: &vm_settings
3+
docker:
4+
- image: circleci/node:8.9.4-browsers
5+
6+
jobs:
7+
install_template_deps:
8+
<<: *vm_settings
9+
working_directory: ~/project/webpack-template
10+
steps:
11+
- checkout
12+
- restore_cache:
13+
key: template-cache-{{ checksum "package.json" }}
14+
- run:
15+
name: Install npm dependencies
16+
command: npm install
17+
- save_cache:
18+
key: template-cache-{{ checksum "package.json" }}
19+
paths:
20+
- node_modules
21+
- run:
22+
name: Rollout minimal scenario
23+
command: VUE_TEMPL_TEST=minimal node_modules/.bin/vue init . test-minimal
24+
- run:
25+
name: Rollout full scenario
26+
command: VUE_TEMPL_TEST=full node_modules/.bin/vue init . test-full
27+
- run:
28+
name: Rollout full-karma-airbnb scenario
29+
command: VUE_TEMPL_TEST=full-karma-airbnb node_modules/.bin/vue init . test-full-karma-airbnb
30+
- persist_to_workspace:
31+
root: ~/project/webpack-template
32+
paths:
33+
- node_modules
34+
- test-*
35+
36+
scenario_minimal:
37+
<<: *vm_settings
38+
environment:
39+
- VUE_TEMPL_TEST: minimal
40+
working_directory: ~/project/webpack-template/test-minimal
41+
steps:
42+
- attach_workspace:
43+
at: '~/project/webpack-template'
44+
- restore_cache:
45+
key: template-cache-minimal-{{ checksum "package.json" }}
46+
- run:
47+
name: Install npm dependencies
48+
command: npm install
49+
- save_cache:
50+
key: template-cache-minimal-{{ checksum "package.json" }}
51+
paths:
52+
- node_modules
53+
- run:
54+
name: Test build
55+
command: npm run build
56+
57+
scenario_full:
58+
<<: *vm_settings
59+
working_directory: ~/project/webpack-template/test-full
60+
environment:
61+
- VUE_TEMPL_TEST: full
62+
steps:
63+
- attach_workspace:
64+
at: '~/project/webpack-template'
65+
- restore_cache:
66+
key: template-cache-full-{{ checksum "package.json" }}
67+
- run:
68+
name: Install npm dependencies
69+
command: npm install
70+
- save_cache:
71+
key: template-cache-full-{{ checksum "package.json" }}
72+
paths:
73+
- node_modules
74+
- run:
75+
name: Run Lint
76+
command: npm run lint -- --fix
77+
- run:
78+
name: Run Unit tests
79+
command: npm run unit
80+
when: always
81+
- run:
82+
name: Run e2e tests
83+
command: npm run e2e
84+
when: always
85+
- run:
86+
name: Test build
87+
command: npm run build
88+
when: always
89+
90+
scenario_full-karma-airbnb:
91+
<<: *vm_settings
92+
working_directory: ~/project/webpack-template/test-full-karma-airbnb
93+
environment:
94+
- VUE_TEMPL_TEST: full-karma-airbnb
95+
steps:
96+
- attach_workspace:
97+
at: '~/project/webpack-template'
98+
- restore_cache:
99+
key: template-cache-full-karma-airbnb-{{ checksum "package.json" }}
100+
- run:
101+
name: Install npm dependencies
102+
command: npm install
103+
- save_cache:
104+
key: template-cache-full-karma-airbnb-{{ checksum "package.json" }}
105+
paths:
106+
- node_modules
107+
- run:
108+
name: Run Lint
109+
command: npm run lint -- --fix
110+
- run:
111+
name: Run Unit tests
112+
command: npm run unit
113+
when: always
114+
- run:
115+
name: Run e2e tests
116+
command: npm run e2e
117+
when: always
118+
- run:
119+
name: Test build
120+
command: npm run build
121+
when: always
122+
123+
124+
workflows:
125+
version: 2
126+
build_and_test:
127+
jobs:
128+
- install_template_deps
129+
- scenario_minimal:
130+
requires:
131+
- install_template_deps
132+
- scenario_full:
133+
requires:
134+
- install_template_deps
135+
- scenario_full-karma-airbnb:
136+
requires:
137+
- install_template_deps

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ node_modules
22
.DS_Store
33
docs/_book
44
test/
5-
node_modules
6-
.DS_Store
7-
docs/_book
8-
test/

circle.yml

-13
This file was deleted.

docs/linter.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
This boilerplate uses [ESLint](https://eslint.org/) as the linter, and uses the [Standard](https://github.com/feross/standard/blob/master/RULES.md) preset with some small customizations.
44

5+
## eslint-plugin-vue
6+
7+
We always add [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) as well, which comes with a whole bunch of helpful rules to write consistent Vue components - it can also lint templates!
8+
9+
You can find an overview of all the available rules on [github](https://github.com/vuejs/eslint-plugin-vue#gear-configs). We chose to add the `essential` configs, but we recommend to switch to the bigger `strongly-recommended` or `recommended` rulesets once you are familiar with them.
10+
11+
## Customizing
12+
513
If you are not happy with the default linting rules, you have several options:
614

715
1. Overwrite individual rules in `.eslintrc.js`. For example, you can add the following rule to enforce semicolons instead of omitting them:
@@ -23,5 +31,5 @@ You can run the following command to let eslint fix any errors it finds (if it c
2331
npm run lint -- --fix
2432
```
2533

26-
*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`)*
34+
*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`. It can be omitted whne using yarn)*
2735

meta.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const path = require('path')
22
const fs = require('fs')
3+
34
const {
45
sortDependencies,
56
installDependencies,
@@ -10,9 +11,16 @@ const pkg = require('./package.json')
1011

1112
const templateVersion = pkg.version
1213

14+
const { addTestAnswers } = require('./scenarios')
15+
1316
module.exports = {
17+
metalsmith: {
18+
// When running tests for the template, this adds answers for the selected scenario
19+
before: addTestAnswers
20+
},
1421
helpers: {
1522
if_or(v1, v2, options) {
23+
1624
if (v1 || v2) {
1725
return options.fn(this)
1826
}
@@ -26,21 +34,25 @@ module.exports = {
2634

2735
prompts: {
2836
name: {
37+
when: 'isNotTest',
2938
type: 'string',
3039
required: true,
3140
message: 'Project name',
3241
},
3342
description: {
43+
when: 'isNotTest',
3444
type: 'string',
3545
required: false,
3646
message: 'Project description',
3747
default: 'A Vue.js project',
3848
},
3949
author: {
50+
when: 'isNotTest',
4051
type: 'string',
4152
message: 'Author',
4253
},
4354
build: {
55+
when: 'isNotTest',
4456
type: 'list',
4557
message: 'Vue build',
4658
choices: [
@@ -58,15 +70,17 @@ module.exports = {
5870
],
5971
},
6072
router: {
73+
when: 'isNotTest',
6174
type: 'confirm',
6275
message: 'Install vue-router?',
6376
},
6477
lint: {
78+
when: 'isNotTest',
6579
type: 'confirm',
6680
message: 'Use ESLint to lint your code?',
6781
},
6882
lintConfig: {
69-
when: 'lint',
83+
when: 'isNotTest && lint',
7084
type: 'list',
7185
message: 'Pick an ESLint preset',
7286
choices: [
@@ -88,11 +102,12 @@ module.exports = {
88102
],
89103
},
90104
unit: {
105+
when: 'isNotTest',
91106
type: 'confirm',
92107
message: 'Set up unit tests',
93108
},
94109
runner: {
95-
when: 'unit',
110+
when: 'isNotTest && unit',
96111
type: 'list',
97112
message: 'Pick a test runner',
98113
choices: [
@@ -114,10 +129,12 @@ module.exports = {
114129
],
115130
},
116131
e2e: {
132+
when: 'isNotTest',
117133
type: 'confirm',
118134
message: 'Setup e2e tests with Nightwatch?',
119135
},
120136
autoInstall: {
137+
when: 'isNotTest',
121138
type: 'list',
122139
message:
123140
'Should we run `npm install` for you after the project has been created? (recommended)',

0 commit comments

Comments
 (0)