Skip to content

Commit ecde369

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

25 files changed

+2596
-75
lines changed

.circleci/config.yml

Lines changed: 137 additions & 0 deletions
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: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+
- 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

Lines changed: 0 additions & 4 deletions
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

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

docs/linter.md

Lines changed: 8 additions & 0 deletions
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

Lines changed: 29 additions & 4 deletions
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)