From d55acb35a157fee50366a1b084759fd0a8a91bef Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 1 Apr 2016 22:31:20 -0700 Subject: [PATCH 01/15] Use nodecat instead of cat for doc-spec Since Windows does not provide cat. Signed-off-by: Kevin Locke --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ba78eed..7cd9092 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "clean": "rimraf coverage && rimraf doc", "doc": "npm run doc-js && npm run doc-spec", "doc-js": "rimraf doc/api && jsdoc -c jsdoc.conf.json .", - "doc-spec": "rimraf doc/spec && mkdir doc/spec && mocha --reporter doc --recursive test | cat doc-src/spec/header.xhtml - doc-src/spec/footer.xhtml >> doc/spec/index.xhtml", + "doc-spec": "rimraf doc/spec && mkdir doc/spec && mocha --reporter doc --recursive test | nodecat doc-src/spec/header.xhtml - doc-src/spec/footer.xhtml > doc/spec/index.xhtml", "lint": "npm run lint-js && npm run lint-doc", "lint-doc": "jsdoc -c jsdoc-lint.conf.json . && echo JSDoc passed.", "lint-js": "eslint . && echo ESLint passed.", @@ -47,7 +47,8 @@ "eslint-config-airbnb": "^6.0.1", "istanbul": "^0.4.1", "jsdoc": "^3.4.0", - "mocha": "^2.3.4" + "mocha": "^2.3.4", + "nodecat": "^0.1.0" }, "engines": { "node": ">=0.10", From 3cead0fcc19bf7042cec7e4c82930601a48f72ae Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 1 Apr 2016 22:31:41 -0700 Subject: [PATCH 02/15] Depend on rimraf Since it is being used in the scripts, make sure it is installed. Version 2.2.0 introduced the rimraf executable. Signed-off-by: Kevin Locke --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7cd9092..1fd1b69 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "istanbul": "^0.4.1", "jsdoc": "^3.4.0", "mocha": "^2.3.4", - "nodecat": "^0.1.0" + "nodecat": "^0.1.0", + "rimraf": "^2.2.0" }, "engines": { "node": ">=0.10", From a61241c8fbba8cf59dd1d50786342c27cf3a121e Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 1 Apr 2016 22:38:59 -0700 Subject: [PATCH 03/15] Remove io.js and Node.js v4 from .travis.yml They rarely cause an issue, so it's preferable to avoid wasting the Travis CI compute cycles without a package-specific reason to think they might fail. Signed-off-by: Kevin Locke --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b5d133b..6354418 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ language: node_js # Update engines.node in package.json if removing old versions. node_js: - node - - iojs - - 4 - 0.12 - 0.10 From 8df294bb214c57684b839c674ee97b894d7c8e3c Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 1 Apr 2016 23:36:59 -0700 Subject: [PATCH 04/15] Exclude more files from npm package Exclude dotfiles for developers. Anyone developing is expected to clone the git repo, which includes tests and other essentials. Signed-off-by: Kevin Locke --- .npmignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.npmignore b/.npmignore index 0d732a0..a183188 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,8 @@ +.editorconfig +.eslintignore +.eslintrc +.npmignore +.travis.yml /coverage/ /doc-src/ /doc/ From 9724b1b6642c88e4d5ed5da076004f3fda8cd95e Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sat, 2 Apr 2016 10:56:03 -0700 Subject: [PATCH 05/15] Exclude TODO doc from npm package Signed-off-by: Kevin Locke --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index a183188..a9ff998 100644 --- a/.npmignore +++ b/.npmignore @@ -8,4 +8,5 @@ /doc/ /scripts /test +TODO.* jsdoc*.conf.json From f2f94477474349d89b756131654df3830296b387 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 22 Apr 2016 14:55:19 -0700 Subject: [PATCH 06/15] Use eslint-config-airbnb-base for linting eslint-config-airbnb has split the non-react rules into the eslint-config-airbnb-base package. Since most of my projects do not use react, use this package for linting by default. Signed-off-by: Kevin Locke --- .eslintrc | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9637c52..7a599db 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,7 @@ # rules which would cause breakage in old Node versions (e.g. ES6 features). # Uses Airbnb's ES5 styles where they don't conflict with Node core or my prefs. -extends: "airbnb/legacy" +extends: "airbnb-base/legacy" env: node: true diff --git a/package.json b/package.json index 1fd1b69..6a4e95d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "codecov": "^1.0.1", "coveralls": "^2.11.6", "eslint": "^2.3.0", - "eslint-config-airbnb": "^6.0.1", + "eslint-config-airbnb-base": "^1.0.3", + "eslint-plugin-import": "^1.5.0", "istanbul": "^0.4.1", "jsdoc": "^3.4.0", "mocha": "^2.3.4", From 5c4464eceb186924f51fc204acc610c6449a087e Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 22 Apr 2016 14:57:14 -0700 Subject: [PATCH 07/15] Use a real function for linting ESLint now warns about this. Fix it. Signed-off-by: Kevin Locke --- test/module-name.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/module-name.js b/test/module-name.js index 81671bb..f00774b 100644 --- a/test/module-name.js +++ b/test/module-name.js @@ -9,6 +9,6 @@ var modulename = require('..'); describe('modulename', function() { it('does something', function(done) { // Assert something about modulename here - modulename.works(); + modulename.func(); }); }); From f63ac815bda80483dd6a5cebd895a3b3ce96f474 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Wed, 4 May 2016 12:30:08 -0700 Subject: [PATCH 08/15] Update eslint-config-airbnb-base and peer-deps Signed-off-by: Kevin Locke --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6a4e95d..0d7ee6e 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,9 @@ "devDependencies": { "codecov": "^1.0.1", "coveralls": "^2.11.6", - "eslint": "^2.3.0", - "eslint-config-airbnb-base": "^1.0.3", - "eslint-plugin-import": "^1.5.0", + "eslint": "^2.9.0", + "eslint-config-airbnb-base": "^2.0.0", + "eslint-plugin-import": "^1.6.1", "istanbul": "^0.4.1", "jsdoc": "^3.4.0", "mocha": "^2.3.4", From 26e6424dfa6b7ea73b580db1d558a884f0b62cbf Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 27 Jun 2016 12:03:15 -0700 Subject: [PATCH 09/15] Update eslint-config-airbnb-base version No code changes necessary. Signed-off-by: Kevin Locke --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0d7ee6e..dcb6d7a 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "codecov": "^1.0.1", "coveralls": "^2.11.6", "eslint": "^2.9.0", - "eslint-config-airbnb-base": "^2.0.0", + "eslint-config-airbnb-base": "^3.0.1", "eslint-plugin-import": "^1.6.1", "istanbul": "^0.4.1", "jsdoc": "^3.4.0", From b30477c134ccb3c4d525ee5fbe819eaf0aea7495 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 20:23:35 -0700 Subject: [PATCH 10/15] Satisfy ESLint lines-around-directive rule Signed-off-by: Kevin Locke --- bin/cmd.js | 1 + index.js | 1 + scripts/script.js | 1 + test/helper-unhandled-rejection.js | 1 + test/module-name.js | 1 + 5 files changed, 5 insertions(+) diff --git a/bin/cmd.js b/bin/cmd.js index 5eb5e2a..711bc02 100644 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -5,6 +5,7 @@ * @copyright Copyright 2016 Kevin Locke * @license MIT */ + 'use strict'; var Command = require('commander').Command; diff --git a/index.js b/index.js index 78b5436..ce5547c 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ * @copyright Copyright 2016 Kevin Locke * @license MIT */ + 'use strict'; var modulename = {}; diff --git a/scripts/script.js b/scripts/script.js index 34b040a..9946353 100755 --- a/scripts/script.js +++ b/scripts/script.js @@ -5,6 +5,7 @@ * @copyright Copyright 2016 Kevin Locke * @license MIT */ + 'use strict'; /** Entry point for this command. diff --git a/test/helper-unhandled-rejection.js b/test/helper-unhandled-rejection.js index dda73ee..144ebfe 100644 --- a/test/helper-unhandled-rejection.js +++ b/test/helper-unhandled-rejection.js @@ -5,6 +5,7 @@ * @copyright Copyright 2016 Kevin Locke * @license MIT */ + 'use strict'; // Allow using window global if it is not undefined diff --git a/test/module-name.js b/test/module-name.js index f00774b..bccf0c6 100644 --- a/test/module-name.js +++ b/test/module-name.js @@ -2,6 +2,7 @@ * @copyright Copyright 2016 Kevin Locke * @license MIT */ + 'use strict'; var modulename = require('..'); From e289646c5d6b1498ec64a49bedbc9a8122462441 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 21:12:29 -0700 Subject: [PATCH 11/15] Update ESLint Update to ESLint v3 and eslint-config-airbnb-base 11. This is the latest-and-greatest of both packages with all the goodness that brings. Since ESLint v3 requires Node.js v4, skip JS linting when running under older Node versions using node-version-check. Signed-off-by: Kevin Locke --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index dcb6d7a..85fb954 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "doc-spec": "rimraf doc/spec && mkdir doc/spec && mocha --reporter doc --recursive test | nodecat doc-src/spec/header.xhtml - doc-src/spec/footer.xhtml > doc/spec/index.xhtml", "lint": "npm run lint-js && npm run lint-doc", "lint-doc": "jsdoc -c jsdoc-lint.conf.json . && echo JSDoc passed.", - "lint-js": "eslint . && echo ESLint passed.", + "lint-js": "node-version-gte-4 && eslint . && echo ESLint passed. || node-version-lt-4", "postpublish": "git -C doc push && git push --follow-tags origin master gh-pages && echo Remember to update GitHub Releases from CHANGELOG.md && echo until skywinder/github-changelog-generator#56 is fixed.", "postversion": "rimraf doc && git clone -b gh-pages -l -q . doc && npm run doc && git -C doc add . && git -C doc commit -n -m \"Docs for v$npm_package_version\"", "preversion": "git-branch-is master && travis-status -b -c -qwx && depcheck && david", @@ -43,12 +43,13 @@ "devDependencies": { "codecov": "^1.0.1", "coveralls": "^2.11.6", - "eslint": "^2.9.0", - "eslint-config-airbnb-base": "^3.0.1", + "eslint": "^3.0.0", + "eslint-config-airbnb-base": "^11.0.0", "eslint-plugin-import": "^1.6.1", "istanbul": "^0.4.1", "jsdoc": "^3.4.0", "mocha": "^2.3.4", + "node-version-check": "^2.1.1", "nodecat": "^0.1.0", "rimraf": "^2.2.0" }, From 877383efc699fe05a228c5af8df6360dee780c19 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 21:16:22 -0700 Subject: [PATCH 12/15] Call test callback So the test passes. Signed-off-by: Kevin Locke --- test/module-name.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/module-name.js b/test/module-name.js index bccf0c6..ece03a9 100644 --- a/test/module-name.js +++ b/test/module-name.js @@ -11,5 +11,6 @@ describe('modulename', function() { it('does something', function(done) { // Assert something about modulename here modulename.func(); + done(); }); }); From 0e1d0cfd0686248d5ab8b31aad7fc41d4c2a5a2a Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 21:43:26 -0700 Subject: [PATCH 13/15] Add appveyor.yml AppVeyor is very popular for testing on Windows. Add it to the template. Signed-off-by: Kevin Locke --- appveyor.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..8b25f65 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,35 @@ +# http://www.appveyor.com/docs/appveyor-yml + +# Use CR-LF line endings on Windows (default is core.autocrlf input) +init: +- git config --global core.autocrlf true + +# Be aware of https://github.com/nodejs/LTS when choosing versions to test +# Update engines.node in package.json if removing old versions. +environment: + matrix: + - nodejs_version: "0.10" + - nodejs_version: "0.12" + - nodejs_version: "7" + +# If the package has arch-dependent features, uncomment this. +#platform: +# - x86 +# - x64 + +install: + - ps: Install-Product node $env:nodejs_version + - npm -g install npm + - npm install + +test_script: + - node --version + - npm --version + - npm test + +# Disable build step, which we don't need +build: off + +# If any job fails, fail build immediately to avoid wasting time/resources. +matrix: + fast_finish: true From d090ec88be3fcb4667dd4eb6ff4098c6614dbe23 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 21:54:19 -0700 Subject: [PATCH 14/15] Add format comment to .travis.yml So people unfamiliar with Travis CI can figure out what this file is and how to modify it more easily. Signed-off-by: Kevin Locke --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6354418..dc91207 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +# https://docs.travis-ci.com/user/customizing-the-build/ language: node_js # Be aware of https://github.com/nodejs/LTS when choosing versions to test # Update engines.node in package.json if removing old versions. From 118473aed90ca6394cd4ef40162411c5888ba8fa Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Mon, 12 Dec 2016 21:55:00 -0700 Subject: [PATCH 15/15] Add AppVeyor badge to README.md Signed-off-by: Kevin Locke --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d914099..ecde771 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ Project Template ================ -[![Build status](https://img.shields.io/travis/kevinoid/project-template.svg?style=flat)](https://travis-ci.org/kevinoid/project-template) +[![Build Status: Linux](https://img.shields.io/travis/kevinoid/project-template.svg?style=flat&label=build+on+linux)](https://travis-ci.org/kevinoid/project-template) +[![Build Status: Windows](https://img.shields.io/appveyor/ci/kevinoid/project-template.svg?style=flat&label=build+on+windows)](https://ci.appveyor.com/project/kevinoid/project-template) [![Coverage](https://img.shields.io/codecov/c/github/kevinoid/project-template.svg?style=flat)](https://codecov.io/github/kevinoid/project-template?branch=master) [![Dependency Status](https://img.shields.io/david/kevinoid/project-template.svg?style=flat)](https://david-dm.org/kevinoid/project-template) [![Supported Node Version](https://img.shields.io/node/v/@kevinoid/project-template.svg?style=flat)](https://www.npmjs.com/package/@kevinoid/project-template)