From 554e3e25e92cf091edbe2b247532c9a0671d12e5 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 2 Apr 2015 21:11:07 -0700 Subject: [PATCH 01/31] Initial commit --- .gitignore | 28 ++++++++++++++++++++++++++++ .travis.yml | 9 +++++++++ History.md | 5 +++++ LICENSE | 21 +++++++++++++++++++++ README.md | 30 ++++++++++++++++++++++++++++++ index.js | 8 ++++++++ package.json | 24 ++++++++++++++++++++++++ test/expected.txt | 1 + test/index.js | 23 +++++++++++++++++++++++ test/input.txt | 1 + 10 files changed, 150 insertions(+) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 History.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json create mode 100644 test/expected.txt create mode 100644 test/index.js create mode 100644 test/input.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..59d842b --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9e9dd09 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +sudo: false + +node_js: + - "0.10" + - "0.12" + - "iojs" + +after_success: npm run coveralls diff --git a/History.md b/History.md new file mode 100644 index 0000000..9f74e51 --- /dev/null +++ b/History.md @@ -0,0 +1,5 @@ +# Changelog + +## v0.0.0: 2015-02-15 + +- Initial release diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1e229da --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Your Name + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c95931d --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# boilerplates + +This is a boilerplate for new transformers. + +Don't forget to activate Travis CI and Coveralls!!! + +# jstransformer-foo + +Transformer that converts a string to foo. + +[![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-foo/master.svg)](https://travis-ci.org/jstransformers/jstransformer-foo) +[![Coverage Status](https://img.shields.io/coveralls/jstransformers/jstransformer-foo/master.svg)](https://coveralls.io/r/jstransformers/jstransformer-foo?branch=master) +[![NPM version](https://img.shields.io/npm/v/jstransformer-foo.svg)](https://www.npmjs.org/package/jstransformer-foo) + +## Installation + + npm install jstransformer-foo + +## API + +```js +var foo = require('jstransformer')(require('jstransformer-foo')) + +foo.render('blah').body +//=> 'blah' +``` + +## License + +MIT diff --git a/index.js b/index.js new file mode 100644 index 0000000..be1afd0 --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +'use strict'; + +exports.name = 'foo'; +exports.outputFormat = 'html'; + +exports.render = function (str, options) { + return str; +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..21a4fcc --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "jstransformer-foo", + "version": "0.0.0", + "description": "A transformer that transforms a string into foo.", + "keywords": [ + "jstransformer" + ], + "devDependencies": { + "coveralls": "^2.11.2", + "istanbul": "^0.3.5", + "testit": "^2.0.2" + }, + "scripts": { + "test": "node test", + "coverage": "istanbul cover test", + "coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls" + }, + "repository": { + "type": "git", + "url": "https://github.com/jstransformers/jstransformer-foo.git" + }, + "author": "Your Name ", + "license": "MIT" +} diff --git a/test/expected.txt b/test/expected.txt new file mode 100644 index 0000000..a19abfe --- /dev/null +++ b/test/expected.txt @@ -0,0 +1 @@ +Hola diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..b4766e0 --- /dev/null +++ b/test/index.js @@ -0,0 +1,23 @@ +'use strict'; + +var assert = require('assert'); +var fs = require('fs'); +var join = require('path').join; +var test = require('testit'); + +var transform = require('../'); + +var input = fs.readFileSync(join(__dirname, 'input.txt')).toString(); +var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString(); +var output; + +function assertEqual(output, expected) { + console.log(' Output:\t' + JSON.stringify(output)); + console.log(' Expected:\t' + JSON.stringify(expected)); + assert.equal(output, expected); +} + +test('a', function () { + output = transform.render(input); + assertEqual(output, expected); +}); diff --git a/test/input.txt b/test/input.txt new file mode 100644 index 0000000..a19abfe --- /dev/null +++ b/test/input.txt @@ -0,0 +1 @@ +Hola From 5f7e394a67cbd00d7e08c59d4c12aac3ed2db861 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 2 Apr 2015 21:14:32 -0700 Subject: [PATCH 02/31] Update README --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c95931d..0589a72 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,12 @@ This is a boilerplate for new transformers. -Don't forget to activate Travis CI and Coveralls!!! +What you need to do: + +1. Add your name to `LICENSE` and `package.json` +2. Activate Travis CI and Coveralls. +3. Update module name in `package.json` and `README.md` +4. Let the fun begin! # jstransformer-foo From 453fe4aa14c49caeb32bdb8f2cab45cb29d59576 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 3 Apr 2015 08:32:04 -0700 Subject: [PATCH 03/31] Remove coveralls from devDependencies Fixes #1. --- .travis.yml | 5 ++++- package.json | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9e9dd09..0ee1adf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,7 @@ node_js: - "0.12" - "iojs" -after_success: npm run coveralls +after_success: + - npm run coverage + - npm i coveralls + - cat ./coverage/lcov.info | coveralls diff --git a/package.json b/package.json index 21a4fcc..9ab5227 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,12 @@ "jstransformer" ], "devDependencies": { - "coveralls": "^2.11.2", "istanbul": "^0.3.5", "testit": "^2.0.2" }, "scripts": { "test": "node test", - "coverage": "istanbul cover test", - "coveralls": "npm run coverage && cat ./coverage/lcov.info | coveralls" + "coverage": "istanbul cover test" }, "repository": { "type": "git", From 828ad460af3dcf2b73ad4a43a24fb65fad7796d5 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 6 Apr 2015 10:51:31 -0400 Subject: [PATCH 04/31] feat(inputFormats): Add inputFormats This adds the inputFormats key to the boilerplate, allowing transformers to define what the expect input is: https://github.com/jstransformers/jstransformer#inputformats --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index be1afd0..37130db 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict'; exports.name = 'foo'; +exports.inputFormats = ['foo', 'foobar']; exports.outputFormat = 'html'; exports.render = function (str, options) { From 3359a5a1e57f94848db401a621b076722a828266 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 6 Apr 2015 10:58:43 -0400 Subject: [PATCH 05/31] docs(license): Switch LICENSE to markdown --- LICENSE | 21 --------------------- LICENSE.md | 21 +++++++++++++++++++++ README.md | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 LICENSE create mode 100644 LICENSE.md diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 1e229da..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Your Name - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0cccb64 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# The MIT License (MIT) + +Copyright (c) 2015 Your Name + +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. diff --git a/README.md b/README.md index 0589a72..b3cdcc9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a boilerplate for new transformers. What you need to do: -1. Add your name to `LICENSE` and `package.json` +1. Add your name to `LICENSE.md` and `package.json` 2. Activate Travis CI and Coveralls. 3. Update module name in `package.json` and `README.md` 4. Let the fun begin! From bb9e002fb44212390d258e212329c6ea49b397cc Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 6 Apr 2015 13:30:11 -0400 Subject: [PATCH 06/31] fix(files): Add files to package.json This will make npm only deploy index.js and LICENSE.md. --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 9ab5227..bcbb6c5 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,10 @@ "keywords": [ "jstransformer" ], + "files": [ + "index.js", + "LICENSE.md" + ], "devDependencies": { "istanbul": "^0.3.5", "testit": "^2.0.2" From cf4bd5714bc030913f54d332e904014bd237275f Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 7 Apr 2015 22:25:31 -0400 Subject: [PATCH 07/31] Update and rename History.md to HISTORY.md --- History.md => HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename History.md => HISTORY.md (59%) diff --git a/History.md b/HISTORY.md similarity index 59% rename from History.md rename to HISTORY.md index 9f74e51..2a0aa51 100644 --- a/History.md +++ b/HISTORY.md @@ -1,5 +1,5 @@ # Changelog -## v0.0.0: 2015-02-15 +## v0.0.1: 2015-xx-xx - Initial release From da3d5d94b40a3092958812c2314c019f9082a5bd Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 8 Apr 2015 11:44:50 -0400 Subject: [PATCH 08/31] fix(files): Remove "LICENSE.md" from "files" I believe it includes all `*.md` files automatically for us. --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index bcbb6c5..fbd3503 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,7 @@ "jstransformer" ], "files": [ - "index.js", - "LICENSE.md" + "index.js" ], "devDependencies": { "istanbul": "^0.3.5", From 7422bf0727d5bab068b235466d2f9d798a347b55 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 25 May 2015 13:36:17 -0400 Subject: [PATCH 09/31] Add some things --- package.json | 4 ++-- test/index.js | 18 ++++++++++++++---- test/locals.json | 1 + test/options.json | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 test/locals.json create mode 100644 test/options.json diff --git a/package.json b/package.json index fbd3503..abd2362 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jstransformer-foo", "version": "0.0.0", - "description": "A transformer that transforms a string into foo.", + "description": "Foo support for JSTransformers.", "keywords": [ "jstransformer" ], @@ -9,7 +9,7 @@ "index.js" ], "devDependencies": { - "istanbul": "^0.3.5", + "istanbul": "^0.3.14", "testit": "^2.0.2" }, "scripts": { diff --git a/test/index.js b/test/index.js index b4766e0..232b2f0 100644 --- a/test/index.js +++ b/test/index.js @@ -8,8 +8,9 @@ var test = require('testit'); var transform = require('../'); var input = fs.readFileSync(join(__dirname, 'input.txt')).toString(); +var options = require('./options'); +var locals = require('./locals'); var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString(); -var output; function assertEqual(output, expected) { console.log(' Output:\t' + JSON.stringify(output)); @@ -17,7 +18,16 @@ function assertEqual(output, expected) { assert.equal(output, expected); } -test('a', function () { - output = transform.render(input); - assertEqual(output, expected); +test(transform.name + '.render()', function () { + if (transform.render) { + var output = transform.render(input, options, locals); + assertEqual(output, expected); + } +}); + +test(transform.name + '.compile()', function () { + if (transform.compile) { + var output = transform.compile(input, options)(locals); + assertEqual(output, expected); + } }); diff --git a/test/locals.json b/test/locals.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/test/locals.json @@ -0,0 +1 @@ +{} diff --git a/test/options.json b/test/options.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/test/options.json @@ -0,0 +1 @@ +{} From c2ceca676461a9852be843f8b4001151c583bf71 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 25 May 2015 13:53:29 -0400 Subject: [PATCH 10/31] Fix if statement wrapper, and add async functions --- test/index.js | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/test/index.js b/test/index.js index 232b2f0..33f267b 100644 --- a/test/index.js +++ b/test/index.js @@ -7,27 +7,50 @@ var test = require('testit'); var transform = require('../'); -var input = fs.readFileSync(join(__dirname, 'input.txt')).toString(); +var inputFile = join(__dirname, 'input.txt'); +var input = fs.readFileSync(inputFile).toString(); var options = require('./options'); var locals = require('./locals'); -var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString(); +var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString().trim(); function assertEqual(output, expected) { console.log(' Output:\t' + JSON.stringify(output)); console.log(' Expected:\t' + JSON.stringify(expected)); - assert.equal(output, expected); + assert.equal(output.trim(), expected); } -test(transform.name + '.render()', function () { - if (transform.render) { +if (transform.render) { + test(transform.name + '.render()', function () { var output = transform.render(input, options, locals); assertEqual(output, expected); - } -}); + }); +} -test(transform.name + '.compile()', function () { - if (transform.compile) { +if (transform.compile) { + test(transform.name + '.compile()', function () { var output = transform.compile(input, options)(locals); assertEqual(output, expected); - } -}); + }); +} + +if (transform.renderAsync) { + test(transform.name + '.renderAsync()', function (done) { + transform.renderAsync(input, options, locals).then(function (output) { + assertEqual(output, expected); + done(); + }, function (err) { + done(err); + }).done(); + }); +} + +if (transform.renderFileAsync) { + test(transform.name + '.renderFileAsync()', function (done) { + transform.renderFileAsync(inputFile, options, locals).then(function (output) { + assertEqual(output, expected); + done(); + }, function (err) { + done(err); + }).done(); + }); +} From bd4760ba9b29f050a23a7516a614e0d3dabbae5c Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 26 May 2015 09:29:10 -0400 Subject: [PATCH 11/31] Add links in the documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3cdcc9..54f23a4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ What you need to do: # jstransformer-foo -Transformer that converts a string to foo. +[Foo](http://example.com) support for [JSTransformers](http://github.com/jstransformers). [![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-foo/master.svg)](https://travis-ci.org/jstransformers/jstransformer-foo) [![Coverage Status](https://img.shields.io/coveralls/jstransformers/jstransformer-foo/master.svg)](https://coveralls.io/r/jstransformers/jstransformer-foo?branch=master) From a187d0b9436c74d11519528e6e65a11c8c0cccc0 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 27 May 2015 21:54:45 -0400 Subject: [PATCH 12/31] Disable email notifications --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0ee1adf..6ca5941 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,3 +10,6 @@ after_success: - npm run coverage - npm i coveralls - cat ./coverage/lcov.info | coveralls + +notifications: + - email: false From 5e52ebf9d56a51b8daa97ad7cc8042e52c841d4a Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Wed, 27 May 2015 22:42:12 -0400 Subject: [PATCH 13/31] Add Dependencies badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b3cdcc9..e800662 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Transformer that converts a string to foo. [![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-foo/master.svg)](https://travis-ci.org/jstransformers/jstransformer-foo) [![Coverage Status](https://img.shields.io/coveralls/jstransformers/jstransformer-foo/master.svg)](https://coveralls.io/r/jstransformers/jstransformer-foo?branch=master) +[![Dependency Status](https://img.shields.io/gemnasium/jstransformers/jstransformer-foo.svg)](https://gemnasium.com/jstransformers/jstransformer-foo) [![NPM version](https://img.shields.io/npm/v/jstransformer-foo.svg)](https://www.npmjs.org/package/jstransformer-foo) ## Installation From 507467c87020b1b8bf7b800e7560eb8e44dcad10 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 28 May 2015 08:40:46 -0400 Subject: [PATCH 14/31] Fix tests to trim the output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` Output: "<span class="foo" id='bar'>hello world</span>\n" Expected: "<span class="foo" id='bar'>hello world</span>" ✓ escape-html.render() (11ms) ``` While the tests pass, there's an extra \n at the end of output console log. Having the input to assertEqual() there will fix it. --- test/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/index.js b/test/index.js index 33f267b..0e2dff4 100644 --- a/test/index.js +++ b/test/index.js @@ -16,27 +16,27 @@ var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString().trim( function assertEqual(output, expected) { console.log(' Output:\t' + JSON.stringify(output)); console.log(' Expected:\t' + JSON.stringify(expected)); - assert.equal(output.trim(), expected); + assert.equal(output, expected); } if (transform.render) { test(transform.name + '.render()', function () { var output = transform.render(input, options, locals); - assertEqual(output, expected); + assertEqual(output.trim(), expected); }); } if (transform.compile) { test(transform.name + '.compile()', function () { var output = transform.compile(input, options)(locals); - assertEqual(output, expected); + assertEqual(output.trim(), expected); }); } if (transform.renderAsync) { test(transform.name + '.renderAsync()', function (done) { transform.renderAsync(input, options, locals).then(function (output) { - assertEqual(output, expected); + assertEqual(output.trim(), expected); done(); }, function (err) { done(err); @@ -47,7 +47,7 @@ if (transform.renderAsync) { if (transform.renderFileAsync) { test(transform.name + '.renderFileAsync()', function (done) { transform.renderFileAsync(inputFile, options, locals).then(function (output) { - assertEqual(output, expected); + assertEqual(output.trim(), expected); done(); }, function (err) { done(err); From 51341861e202a0034210170a58e118cc25bedc02 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 28 May 2015 09:22:18 -0400 Subject: [PATCH 15/31] Send notification email only on failure --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6ca5941..b6c760e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,5 @@ after_success: - cat ./coverage/lcov.info | coveralls notifications: - - email: false + email: + on_success: never From 4cb1cc75576783bc6e537031cb67ade2593ad914 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 28 May 2015 09:44:23 -0400 Subject: [PATCH 16/31] Add compileFile() test --- test/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/index.js b/test/index.js index 33f267b..45443d4 100644 --- a/test/index.js +++ b/test/index.js @@ -33,6 +33,13 @@ if (transform.compile) { }); } +if (transform.compileFile) { + test(transform.name + '.compileFile()', function () { + var output = transform.compileFile(inputFile, options)(locals); + assertEqual(output, expected); + }); +} + if (transform.renderAsync) { test(transform.name + '.renderAsync()', function (done) { transform.renderAsync(input, options, locals).then(function (output) { From 40c02aecfbb3216f6372f85cb4b2cac78c4ca85e Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 28 May 2015 09:50:37 -0400 Subject: [PATCH 17/31] Add compileFileAsync() test --- test/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/index.js b/test/index.js index 33f267b..a1384b6 100644 --- a/test/index.js +++ b/test/index.js @@ -54,3 +54,14 @@ if (transform.renderFileAsync) { }).done(); }); } + +if (transform.compileFileAsync) { + test(transform.name + '.compileFileAsync()', function (done) { + transform.compileFileAsync(inputFile, options).then(function (template) { + assertEqual(template(locals), expected); + done(); + }, function (err) { + done(err); + }).done(); + }); +} From 2695ec95db6ccbfff5c1a2ecedfd606729ece194 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 28 May 2015 15:18:09 -0400 Subject: [PATCH 18/31] Fix the copyright to reference the JSTransformers Team --- LICENSE.md | 2 +- package.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 0cccb64..f5573cc 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # The MIT License (MIT) -Copyright (c) 2015 Your Name +Copyright (c) 2015 [JSTransformers](http://github.com/jstransformers) > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index abd2362..76ce724 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,9 @@ "type": "git", "url": "https://github.com/jstransformers/jstransformer-foo.git" }, - "author": "Your Name ", + "author": { + "name": "JSTransformers Team", + "url": "http://github.com/orgs/jstransformers/people" + }, "license": "MIT" } From ddf59869b504dbe8eee9da8f9feaa23423599500 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 29 May 2015 06:39:53 -0400 Subject: [PATCH 19/31] Update License.md to JSTransformers Team https://github.com/orgs/jstransformers/people --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index f5573cc..feebf76 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # The MIT License (MIT) -Copyright (c) 2015 [JSTransformers](http://github.com/jstransformers) +Copyright (c) 2015 [JSTransformers Team](https://github.com/orgs/jstransformers/people) > Permission is hereby granted, free of charge, to any person obtaining a copy > of this software and associated documentation files (the "Software"), to deal From 6c0adfa1fb232e64d2c74601704e55b2137fb00e Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 29 May 2015 06:55:44 -0400 Subject: [PATCH 20/31] Update dependency badge to use DavidDM --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e800662..2e9f560 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Transformer that converts a string to foo. [![Build Status](https://img.shields.io/travis/jstransformers/jstransformer-foo/master.svg)](https://travis-ci.org/jstransformers/jstransformer-foo) [![Coverage Status](https://img.shields.io/coveralls/jstransformers/jstransformer-foo/master.svg)](https://coveralls.io/r/jstransformers/jstransformer-foo?branch=master) -[![Dependency Status](https://img.shields.io/gemnasium/jstransformers/jstransformer-foo.svg)](https://gemnasium.com/jstransformers/jstransformer-foo) +[![Dependency Status](https://img.shields.io/david/jstransformers/jstransformer-foo/master.svg)](http://david-dm.org/jstransformers/jstransformer-foo) [![NPM version](https://img.shields.io/npm/v/jstransformer-foo.svg)](https://www.npmjs.org/package/jstransformer-foo) ## Installation From 8fadcdd05a17dea68e12f60dc71f329d54e38f7c Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 29 May 2015 17:11:58 -0400 Subject: [PATCH 21/31] Fix to use test-jstransformer --- package.json | 7 +- test/index.js | 74 ---------------------- test/simple/dependencies.json | 1 + test/{expected.txt => simple/expected.bar} | 0 test/{input.txt => simple/input.foo} | 0 test/{ => simple}/locals.json | 0 test/{ => simple}/options.json | 0 7 files changed, 4 insertions(+), 78 deletions(-) delete mode 100644 test/index.js create mode 100644 test/simple/dependencies.json rename test/{expected.txt => simple/expected.bar} (100%) rename test/{input.txt => simple/input.foo} (100%) rename test/{ => simple}/locals.json (100%) rename test/{ => simple}/options.json (100%) diff --git a/package.json b/package.json index abd2362..c7a165a 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,11 @@ "index.js" ], "devDependencies": { - "istanbul": "^0.3.14", - "testit": "^2.0.2" + "test-jstransformer": "^1.0.0" }, "scripts": { - "test": "node test", - "coverage": "istanbul cover test" + "test": "test-jstransformer", + "coverage": "test-jstransformer coverage" }, "repository": { "type": "git", diff --git a/test/index.js b/test/index.js deleted file mode 100644 index 8738223..0000000 --- a/test/index.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -var assert = require('assert'); -var fs = require('fs'); -var join = require('path').join; -var test = require('testit'); - -var transform = require('../'); - -var inputFile = join(__dirname, 'input.txt'); -var input = fs.readFileSync(inputFile).toString(); -var options = require('./options'); -var locals = require('./locals'); -var expected = fs.readFileSync(join(__dirname, 'expected.txt')).toString().trim(); - -function assertEqual(output, expected) { - console.log(' Output:\t' + JSON.stringify(output)); - console.log(' Expected:\t' + JSON.stringify(expected)); - assert.equal(output, expected); -} - -if (transform.render) { - test(transform.name + '.render()', function () { - var output = transform.render(input, options, locals); - assertEqual(output.trim(), expected); - }); -} - -if (transform.compile) { - test(transform.name + '.compile()', function () { - var output = transform.compile(input, options)(locals); - assertEqual(output.trim(), expected); - }); -} - -if (transform.compileFile) { - test(transform.name + '.compileFile()', function () { - var output = transform.compileFile(inputFile, options)(locals); - assertEqual(output, expected); - }); -} - -if (transform.renderAsync) { - test(transform.name + '.renderAsync()', function (done) { - transform.renderAsync(input, options, locals).then(function (output) { - assertEqual(output.trim(), expected); - done(); - }, function (err) { - done(err); - }).done(); - }); -} - -if (transform.renderFileAsync) { - test(transform.name + '.renderFileAsync()', function (done) { - transform.renderFileAsync(inputFile, options, locals).then(function (output) { - assertEqual(output.trim(), expected); - done(); - }, function (err) { - done(err); - }).done(); - }); -} - -if (transform.compileFileAsync) { - test(transform.name + '.compileFileAsync()', function (done) { - transform.compileFileAsync(inputFile, options).then(function (template) { - assertEqual(template(locals), expected); - done(); - }, function (err) { - done(err); - }).done(); - }); -} diff --git a/test/simple/dependencies.json b/test/simple/dependencies.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/test/simple/dependencies.json @@ -0,0 +1 @@ +[] diff --git a/test/expected.txt b/test/simple/expected.bar similarity index 100% rename from test/expected.txt rename to test/simple/expected.bar diff --git a/test/input.txt b/test/simple/input.foo similarity index 100% rename from test/input.txt rename to test/simple/input.foo diff --git a/test/locals.json b/test/simple/locals.json similarity index 100% rename from test/locals.json rename to test/simple/locals.json diff --git a/test/options.json b/test/simple/options.json similarity index 100% rename from test/options.json rename to test/simple/options.json From 158cd68c1aa2e92516a79dfc09c7907a315bcf6b Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 29 May 2015 18:54:01 -0400 Subject: [PATCH 22/31] Move tests up a directory --- test/{simple => }/dependencies.json | 0 test/{simple => }/expected.bar | 0 test/{simple => }/input.foo | 0 test/{simple => }/locals.json | 0 test/{simple => }/options.json | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename test/{simple => }/dependencies.json (100%) rename test/{simple => }/expected.bar (100%) rename test/{simple => }/input.foo (100%) rename test/{simple => }/locals.json (100%) rename test/{simple => }/options.json (100%) diff --git a/test/simple/dependencies.json b/test/dependencies.json similarity index 100% rename from test/simple/dependencies.json rename to test/dependencies.json diff --git a/test/simple/expected.bar b/test/expected.bar similarity index 100% rename from test/simple/expected.bar rename to test/expected.bar diff --git a/test/simple/input.foo b/test/input.foo similarity index 100% rename from test/simple/input.foo rename to test/input.foo diff --git a/test/simple/locals.json b/test/locals.json similarity index 100% rename from test/simple/locals.json rename to test/locals.json diff --git a/test/simple/options.json b/test/options.json similarity index 100% rename from test/simple/options.json rename to test/options.json From 4ee0db154da146b158c862a82a4e1b6addeabbac Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 1 Jun 2015 16:57:03 -0400 Subject: [PATCH 23/31] Add .editorconfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8af1a52 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = space +charset = utf-8 +end_of_line = lf +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true From 0739217f79426b44741e686d7599024789aa75d6 Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Tue, 2 Jun 2015 10:11:25 +0100 Subject: [PATCH 24/31] We aren't using jscover --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 59d842b..12c0d06 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,6 @@ pids *.pid *.seed -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - # Coverage directory used by tools like istanbul coverage From 7a2d3150b3c77d6d8059adc4656016b71dd319e2 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 29 May 2015 07:26:10 -0400 Subject: [PATCH 25/31] Move documentation to the Wiki Moving documentation [to the wiki](https://github.com/jstransformers/boilerplate/wiki) will allow us to change docs without affecting child projects. Update Boilerplate documentation Update README.md --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0468c86..d60ca7d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ -# boilerplates +# JSTransformer Boilerplate -This is a boilerplate for new transformers. +Use JSTransformer Boilerplate to create and update transformers. -What you need to do: - -1. Add your name to `LICENSE.md` and `package.json` -2. Activate Travis CI and Coveralls. -3. Update module name in `package.json` and `README.md` -4. Let the fun begin! +1. Visit [the Boilerplate Wiki](https://github.com/jstransformers/boilerplate/wiki) on how to get started +2. Remove this top notice from any transformers # jstransformer-foo From fa074b98ed0a3c338da59d8b82ff07351de0d32d Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 13 Aug 2015 08:04:18 -0400 Subject: [PATCH 26/31] Fix sort order of scripts `npm` sometimes fixes the scripts to be alphabetized. This will avoid that change in the future. --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c95ec50..9b3eff5 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "test-jstransformer": "^1.0.0" }, "scripts": { - "test": "test-jstransformer", - "coverage": "test-jstransformer coverage" + "coverage": "test-jstransformer coverage", + "test": "test-jstransformer" }, "repository": { "type": "git", From 7cce151539f6cadfaaf5872015451e4f226656ef Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 8 Sep 2015 19:59:11 -0400 Subject: [PATCH 27/31] Add Node.js 4.0.0 to Travis testing Does this work yet? --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b6c760e..f8e3626 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ sudo: false node_js: - "0.10" - "0.12" + - "4.0" - "iojs" after_success: From ec2ab26de0b52e9787227fe2e5730da91eddb975 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Tue, 8 Sep 2015 20:54:31 -0400 Subject: [PATCH 28/31] Update node version specificity of "4" --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f8e3626..dbb7dd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: false node_js: - "0.10" - "0.12" - - "4.0" + - "4" - "iojs" after_success: From 3322834bd8d5be1664ba5bfe08a557909e3cb216 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Thu, 17 Sep 2015 02:05:59 -0400 Subject: [PATCH 29/31] Remove io.js from testing Anyone using io.js should be on node 4.0.0 by now. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dbb7dd2..e9b6736 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,6 @@ node_js: - "0.10" - "0.12" - "4" - - "iojs" after_success: - npm run coverage From 0c90e07155a59a72210983b225ad935cc2034c0a Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 5 Oct 2015 15:27:07 -0400 Subject: [PATCH 30/31] Add 'engines' spec into package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 9b3eff5..c7481fa 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,9 @@ "coverage": "test-jstransformer coverage", "test": "test-jstransformer" }, + "engines": { + "node": ">=0.10.36" + }, "repository": { "type": "git", "url": "https://github.com/jstransformers/jstransformer-foo.git" From 537a7f3f84cc808d7c8ee32f714881e29c68bd49 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 30 Oct 2015 02:13:52 -0700 Subject: [PATCH 31/31] Add NodeJS 5.0.0 to the testing list https://github.com/nodejs/node/blob/v5.0.0/CHANGELOG.md --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e9b6736..7a21e57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ node_js: - "0.10" - "0.12" - "4" + - "5" after_success: - npm run coverage