Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
LinusBorg committed Jan 13, 2018
2 parents 4731a34 + 177d738 commit 8343cae
Show file tree
Hide file tree
Showing 22 changed files with 2,564 additions and 57 deletions.
137 changes: 137 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
version: 2
vm_settings: &vm_settings
docker:
- image: circleci/node:8.9.4-browsers

jobs:
install_template_deps:
<<: *vm_settings
working_directory: ~/project/webpack-template
steps:
- checkout
- restore_cache:
key: template-cache-{{ checksum "package.json" }}
- run:
name: Install npm dependencies
command: npm install
- save_cache:
key: template-cache-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Rollout minimal scenario
command: VUE_TEMPL_TEST=minimal node_modules/.bin/vue init . test-minimal
- run:
name: Rollout full scenario
command: VUE_TEMPL_TEST=full node_modules/.bin/vue init . test-full
- run:
name: Rollout full-karma-airbnb scenario
command: VUE_TEMPL_TEST=full-karma-airbnb node_modules/.bin/vue init . test-full-karma-airbnb
- persist_to_workspace:
root: ~/project/webpack-template
paths:
- node_modules
- test-*

scenario_minimal:
<<: *vm_settings
environment:
- VUE_TEMPL_TEST: minimal
working_directory: ~/project/webpack-template/test-minimal
steps:
- attach_workspace:
at: '~/project/webpack-template'
- restore_cache:
key: template-cache-minimal-{{ checksum "package.json" }}
- run:
name: Install npm dependencies
command: npm install
- save_cache:
key: template-cache-minimal-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Test build
command: npm run build

scenario_full:
<<: *vm_settings
working_directory: ~/project/webpack-template/test-full
environment:
- VUE_TEMPL_TEST: full
steps:
- attach_workspace:
at: '~/project/webpack-template'
- restore_cache:
key: template-cache-full-{{ checksum "package.json" }}
- run:
name: Install npm dependencies
command: npm install
- save_cache:
key: template-cache-full-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Run Lint
command: npm run lint -- --fix
- run:
name: Run Unit tests
command: npm run unit
when: always
- run:
name: Run e2e tests
command: npm run e2e
when: always
- run:
name: Test build
command: npm run build
when: always

scenario_full-karma-airbnb:
<<: *vm_settings
working_directory: ~/project/webpack-template/test-full-karma-airbnb
environment:
- VUE_TEMPL_TEST: full-karma-airbnb
steps:
- attach_workspace:
at: '~/project/webpack-template'
- restore_cache:
key: template-cache-full-karma-airbnb-{{ checksum "package.json" }}
- run:
name: Install npm dependencies
command: npm install
- save_cache:
key: template-cache-full-karma-airbnb-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Run Lint
command: npm run lint -- --fix
- run:
name: Run Unit tests
command: npm run unit
when: always
- run:
name: Run e2e tests
command: npm run e2e
when: always
- run:
name: Test build
command: npm run build
when: always


workflows:
version: 2
build_and_test:
jobs:
- install_template_deps
- scenario_minimal:
requires:
- install_template_deps
- scenario_full:
requires:
- install_template_deps
- scenario_full-karma-airbnb:
requires:
- install_template_deps
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ node_modules
.DS_Store
docs/_book
test/
node_modules
.DS_Store
docs/_book
test/
13 changes: 0 additions & 13 deletions circle.yml

This file was deleted.

10 changes: 9 additions & 1 deletion docs/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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.

## eslint-plugin-vue

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!

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.

## Customizing

If you are not happy with the default linting rules, you have several options:

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

*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`)*
*(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)*

21 changes: 19 additions & 2 deletions meta.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const path = require('path')
const fs = require('fs')

const {
sortDependencies,
installDependencies,
Expand All @@ -10,9 +11,16 @@ const pkg = require('./package.json')

const templateVersion = pkg.version

const { addTestAnswers } = require('./scenarios')

module.exports = {
metalsmith: {
// When running tests for the template, this adds answers for the selected scenario
before: addTestAnswers
},
helpers: {
if_or(v1, v2, options) {

if (v1 || v2) {
return options.fn(this)
}
Expand All @@ -26,21 +34,25 @@ module.exports = {

prompts: {
name: {
when: 'isNotTest',
type: 'string',
required: true,
message: 'Project name',
},
description: {
when: 'isNotTest',
type: 'string',
required: false,
message: 'Project description',
default: 'A Vue.js project',
},
author: {
when: 'isNotTest',
type: 'string',
message: 'Author',
},
build: {
when: 'isNotTest',
type: 'list',
message: 'Vue build',
choices: [
Expand All @@ -58,15 +70,17 @@ module.exports = {
],
},
router: {
when: 'isNotTest',
type: 'confirm',
message: 'Install vue-router?',
},
lint: {
when: 'isNotTest',
type: 'confirm',
message: 'Use ESLint to lint your code?',
},
lintConfig: {
when: 'lint',
when: 'isNotTest && lint',
type: 'list',
message: 'Pick an ESLint preset',
choices: [
Expand All @@ -88,11 +102,12 @@ module.exports = {
],
},
unit: {
when: 'isNotTest',
type: 'confirm',
message: 'Set up unit tests',
},
runner: {
when: 'unit',
when: 'isNotTest && unit',
type: 'list',
message: 'Pick a test runner',
choices: [
Expand All @@ -114,10 +129,12 @@ module.exports = {
],
},
e2e: {
when: 'isNotTest',
type: 'confirm',
message: 'Setup e2e tests with Nightwatch?',
},
autoInstall: {
when: 'isNotTest',
type: 'list',
message:
'Should we run `npm install` for you after the project has been created? (recommended)',
Expand Down
Loading

0 comments on commit 8343cae

Please sign in to comment.