Skip to content

Commit d4f082d

Browse files
committed
Merge branch 'develop' into feature/stylint
2 parents e5d2c78 + d8fb864 commit d4f082d

25 files changed

+2605
-75
lines changed

.circleci/config.yml

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

-19
This file was deleted.

docs/linter.md

+8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
## ESLint
44
This boilerplate uses [ESLint](https://eslint.org/) for JavaScript linting, and uses the [Standard](https://github.com/feross/standard/blob/master/RULES.md) preset with some small customizations.
55

6+
### eslint-plugin-vue
7+
8+
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!
9+
10+
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.
11+
12+
### Customizing
13+
614
If you are not happy with the default linting rules, you have several options:
715

816
1. Overwrite individual rules in `.eslintrc.js`. For example, you can add the following rule to enforce semicolons instead of omitting them:

meta.js

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
11
const path = require('path')
22
const fs = require('fs')
3+
34
const {
45
sortDependencies,
56
installDependencies,
67
runLintFix,
78
printMessage,
89
} = require('./utils')
10+
const pkg = require('./package.json')
11+
12+
const templateVersion = pkg.version
13+
14+
const { addTestAnswers } = require('./scenarios')
915

1016
module.exports = {
17+
metalsmith: {
18+
// When running tests for the template, this adds answers for the selected scenario
19+
before: addTestAnswers
20+
},
1121
helpers: {
12-
if_or: function(v1, v2, options) {
22+
if_or(v1, v2, options) {
23+
1324
if (v1 || v2) {
1425
return options.fn(this)
1526
}
1627

1728
return options.inverse(this)
1829
},
30+
template_version() {
31+
return templateVersion
32+
},
1933
},
34+
2035
prompts: {
2136
name: {
37+
when: 'isNotTest',
2238
type: 'string',
2339
required: true,
2440
message: 'Project name',
2541
},
2642
description: {
43+
when: 'isNotTest',
2744
type: 'string',
2845
required: false,
2946
message: 'Project description',
3047
default: 'A Vue.js project',
3148
},
3249
author: {
50+
when: 'isNotTest',
3351
type: 'string',
3452
message: 'Author',
3553
},
3654
build: {
55+
when: 'isNotTest',
3756
type: 'list',
3857
message: 'Vue build',
3958
choices: [
@@ -51,15 +70,17 @@ module.exports = {
5170
],
5271
},
5372
router: {
73+
when: 'isNotTest',
5474
type: 'confirm',
5575
message: 'Install vue-router?',
5676
},
5777
eslint: {
78+
when: 'isNotTest',
5879
type: 'confirm',
5980
message: 'Use ESLint to lint your code?',
6081
},
6182
eslintConfig: {
62-
when: 'eslint',
83+
when: 'isNotTest && eslint',
6384
type: 'list',
6485
message: 'Pick an ESLint preset',
6586
choices: [
@@ -81,11 +102,12 @@ module.exports = {
81102
]
82103
},
83104
stylelint: {
105+
when: 'isNotTest',
84106
type: 'confirm',
85107
message: 'Use stylelint to lint your code?'
86108
},
87109
stylelintConfig: {
88-
when: 'stylelint',
110+
when: 'isNotTest && stylelint',
89111
type: 'list',
90112
message: 'Pick a stylelint preset',
91113
choices: [
@@ -112,11 +134,12 @@ module.exports = {
112134
],
113135
},
114136
unit: {
137+
when: 'isNotTest',
115138
type: 'confirm',
116139
message: 'Set up unit tests',
117140
},
118141
runner: {
119-
when: 'unit',
142+
when: 'isNotTest && unit',
120143
type: 'list',
121144
message: 'Pick a test runner',
122145
choices: [
@@ -138,10 +161,12 @@ module.exports = {
138161
],
139162
},
140163
e2e: {
164+
when: 'isNotTest',
141165
type: 'confirm',
142166
message: 'Setup e2e tests with Nightwatch?',
143167
},
144168
autoInstall: {
169+
when: 'isNotTest',
145170
type: 'list',
146171
message:
147172
'Should we run `npm install` for you after the project has been created? (recommended)',

0 commit comments

Comments
 (0)