Skip to content

Commit

Permalink
Merge pull request #78 from neocotic/develop
Browse files Browse the repository at this point in the history
Release 2.3.0
  • Loading branch information
neocotic committed May 31, 2017
2 parents f4fd157 + 9e0da52 commit 89e61d3
Show file tree
Hide file tree
Showing 34 changed files with 2,804 additions and 1,854 deletions.
6 changes: 2 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "skelp/v3/es6",
"extends": "notninja/es6",
"env": {
"browser": true,
"node": true
Expand All @@ -19,8 +19,6 @@
{
"args": "none"
}
],
"prefer-reflect": "off",
"sort-keys": "off"
]
}
}
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sudo: false
language: node_js
node_js:
- "0.10"
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Version 2.3.0, 2017.05.31

* Enable setting of multiple properties at once resulting in a single re-render [#69](https://github.com/neocotic/qrious/issues/69)
* Deferring or avoiding ImageRenderer [#71](https://github.com/neocotic/qrious/issues/71)
* Switch to container-based Travis builds for faster boot times [#73](https://github.com/neocotic/qrious/issues/73)
* Change code style to be more contributor-friendly [#75](https://github.com/neocotic/qrious/issues/75)
* Improve download links in README [#76](https://github.com/neocotic/qrious/issues/76)

## Version 2.2.0, 2016.10.30

* Add `backgroundAlpha` and `foregroundAlpha` options to control transparency [#63](https://github.com/neocotic/qrious/issues/63)
Expand Down
75 changes: 38 additions & 37 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* QRious
* Copyright (C) 2016 Alasdair Mercer
* Copyright (C) 2017 Alasdair Mercer
* Copyright (C) 2010 Tom Zerucha
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -17,12 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

'use strict';

module.exports = function(grunt) {
var babel
var commonjs
var nodeResolve
var semver = require('semver')
var uglify
var babel;
var commonjs;
var nodeResolve;
var semver = require('semver');
var uglify;

var bannerLarge = [
'/*',
Expand All @@ -43,12 +45,12 @@ module.exports = function(grunt) {
' * You should have received a copy of the GNU General Public License',
' * along with this program. If not, see <http://www.gnu.org/licenses/>.',
' */'
].join('\n')
].join('\n');
var bannerSmall = [
'/*! QRious v<%= pkg.version %> | (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | GPL v3 License',
'Based on jsqrencode | (C) 2010 [email protected] | GPL v3 License',
'*/'
].join('\n')
].join('\n');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
Expand All @@ -59,19 +61,19 @@ module.exports = function(grunt) {
tasks: [ 'test' ]
}
}
})
});

var buildTasks = [ 'compile' ]
var compileTasks = []
var testTasks = [ 'compile' ]
var buildTasks = [ 'compile' ];
var compileTasks = [];
var testTasks = [ 'compile' ];

if (semver.satisfies(process.version, '>=0.12')) {
babel = require('rollup-plugin-babel')
commonjs = require('rollup-plugin-commonjs')
nodeResolve = require('rollup-plugin-node-resolve')
uglify = require('rollup-plugin-uglify')
babel = require('rollup-plugin-babel');
commonjs = require('rollup-plugin-commonjs');
nodeResolve = require('rollup-plugin-node-resolve');
uglify = require('rollup-plugin-uglify');

compileTasks.push('clean', 'rollup')
compileTasks.push('clean', 'rollup');

grunt.config.merge({
clean: {
Expand All @@ -90,15 +92,14 @@ module.exports = function(grunt) {
return [
nodeResolve({
jsnext: true,
main: true,
skip: [ 'canvas' ]
main: true
}),
commonjs(),
babel({
exclude: [ 'node_modules/**' ],
runtimeHelpers: true
})
]
];
}
},
files: {
Expand All @@ -124,7 +125,7 @@ module.exports = function(grunt) {
exclude: [ 'node_modules/**' ],
runtimeHelpers: true
})
]
];
}
},
files: {
Expand Down Expand Up @@ -153,42 +154,42 @@ module.exports = function(grunt) {
uglify({
output: {
comments: function(node, comment) {
return comment.type === 'comment2' && /^\!/.test(comment.value)
return comment.type === 'comment2' && /^\!/.test(comment.value);
}
}
})
]
];
}
},
files: {
'dist/umd/qrious.min.js': 'src/runtime/browser.js'
}
}
}
})
});

grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-rollup')
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-rollup');
} else {
grunt.log.writeln('"clean" and "rollup" tasks are disabled because Node.js version is <0.12! Please consider upgrading Node.js...')
grunt.log.writeln('"clean" and "rollup" tasks are disabled because Node.js version is <0.12! Please consider upgrading Node.js...');
}

if (semver.satisfies(process.version, '>=4')) {
compileTasks.unshift('eslint')
compileTasks.unshift('eslint');

grunt.config.set('eslint', {
target: [ 'src/**/*.js' ]
})
});

grunt.loadNpmTasks('grunt-eslint')
grunt.loadNpmTasks('grunt-eslint');
} else {
grunt.log.writeln('"eslint" task is disabled because Node.js version is <4! Please consider upgrading Node.js...')
grunt.log.writeln('"eslint" task is disabled because Node.js version is <4! Please consider upgrading Node.js...');
}

grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('default', [ 'build' ])
grunt.registerTask('build', buildTasks)
grunt.registerTask('compile', compileTasks)
grunt.registerTask('test', testTasks)
}
grunt.registerTask('default', [ 'build' ]);
grunt.registerTask('build', buildTasks);
grunt.registerTask('compile', compileTasks);
grunt.registerTask('test', testTasks);
};
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
QRious
Copyright (C) 2016 Alasdair Mercer
Copyright (C) 2017 Alasdair Mercer
Copyright (C) 2010 Tom Zerucha

This program is free software: you can redistribute it and/or modify
Expand Down
92 changes: 55 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[QRious](https://github.com/neocotic/qrious) is a pure JavaScript library for generating QR codes using HTML5 canvas.

[![Chat](https://img.shields.io/gitter/room/neocotic/qrious.svg?style=flat-square)](https://gitter.im/neocotic/qrious)
[![Build](https://img.shields.io/travis/neocotic/qrious/develop.svg?style=flat-square)](https://travis-ci.org/neocotic/qrious)
[![Dependency Status](https://img.shields.io/david/neocotic/qrious.svg?style=flat-square)](https://david-dm.org/neocotic/qrious)
[![Dev Dependency Status](https://img.shields.io/david/dev/neocotic/qrious.svg?style=flat-square)](https://david-dm.org/neocotic/qrious#info=devDependencies)
[![Build Status](https://img.shields.io/travis/neocotic/qrious/develop.svg?style=flat-square)](https://travis-ci.org/neocotic/qrious)
[![Optional Dependency Status](https://img.shields.io/david/optional/neocotic/qrious.svg?style=flat-square)](https://david-dm.org/neocotic/qrious?type=optional)
[![Dev Dependency Status](https://img.shields.io/david/dev/neocotic/qrious.svg?style=flat-square)](https://david-dm.org/neocotic/qrious?type=dev)
[![License](https://img.shields.io/npm/l/qrious.svg?style=flat-square)](https://github.com/neocotic/qrious/blob/master/LICENSE.md)
[![Release](https://img.shields.io/npm/v/qrious.svg?style=flat-square)](https://www.npmjs.com/package/qrious)

Expand All @@ -38,8 +38,8 @@ you want to install that way instead of using `npm`.

If you want to simply download the file to be used in the browser you can find them below:

* [Development Version](https://github.com/neocotic/qrious/blob/master/dist/umd/qrious.js)
* [Production Version](https://github.com/neocotic/qrious/blob/master/dist/umd/qrious.min.js)
* [Development Version](https://cdn.rawgit.com/neocotic/qrious/master/dist/umd/qrious.js) (123kb - [Source Map](https://cdn.rawgit.com/neocotic/qrious/master/dist/umd/qrious.js.map))
* [Production Version](https://cdn.rawgit.com/neocotic/qrious/master/dist/umd/qrious.min.js) (37kb - [Source Map](https://cdn.rawgit.com/neocotic/qrious/master/dist/umd/qrious.min.js.map))

### Node.js Dependencies

Expand Down Expand Up @@ -75,8 +75,8 @@ In the browser:
const qr = new QRious({
element: document.getElementById('qr'),
value: 'https://github.com/neocotic/qrious'
})
})()
});
})();
</script>
</body>
</html>
Expand All @@ -85,18 +85,18 @@ In the browser:
In Node.js:

``` javascript
const express = require('express')
const QRious = require('qrious')
const express = require('express');
const QRious = require('qrious');

const app = express()
const app = express();

app.get('/qr', (req, res) => {
const qr = new QRious({ value: 'https://github.com/neocotic/qrious' })
const qr = new QRious({ value: 'https://github.com/neocotic/qrious' });

res.end(new Buffer(qr.toDataURL(), 'base64'))
})
res.end(new Buffer(qr.toDataURL(), 'base64'));
});

app.listen(3000)
app.listen(3000);
```

Open up `demo.html` in your browser to play around a bit.
Expand All @@ -119,30 +119,48 @@ using the following fields on your instance:
| value | String | Value encoded within the QR code | `""` |

``` javascript
const qr = new QRious()
qr.background = '#000'
qr.backgroundAlpha = 0.8
qr.foreground = '#fff'
qr.foregroundAlpha = 0.8
qr.level = 'H'
qr.padding = 25
qr.size = 500
qr.value = 'https://github.com/neocotic/qrious'
const qr = new QRious();
qr.background = 'green';
qr.backgroundAlpha = 0.8;
qr.foreground = 'blue';
qr.foregroundAlpha = 0.8;
qr.level = 'H';
qr.padding = 25;
qr.size = 500;
qr.value = 'https://github.com/neocotic/qrious';
```

The QR code will automatically update when you change one of these fields, so be wary when you plan on changing lots of
fields at the same time. You probably want to make a single call to `set(options)` instead as it will only update the QR
code once:

``` javascript
const qr = new QRious();
qr.set({
background: 'green',
backgroundAlpha: 0.8,
foreground: 'blue',
foregroundAlpha: 0.8,
level: 'H',
padding: 25,
size: 500,
value: 'https://github.com/neocotic/qrious'
});
```

These can also be passed as options to the constructor itself:

``` javascript
const qr = new QRious({
background: '#000',
background: 'green',
backgroundAlpha: 0.8,
foreground: '#fff',
foreground: 'blue',
foregroundAlpha: 0.8,
level: 'H',
padding: 25,
size: 500,
value: 'https://github.com/neocotic/qrious'
})
});
```

You can also pass in an `element` option to the constructor which can be used to generate the QR code using an existing
Expand All @@ -154,21 +172,21 @@ for both if no `element` is specified, which means that they can be appeneded to
const qr = new QRious({
element: document.querySelector('canvas'),
value: 'https://github.com/neocotic/qrious'
})
});

qr.canvas.parentNode.appendChild(qr.image)
qr.canvas.parentNode.appendChild(qr.image);
```

A reference to the `QRious` instance is also stored on both of the elements for convenience.

``` javascript
const canvas = document.querySelector('canvas')
const canvas = document.querySelector('canvas');
const qr = new QRious({
element: canvas,
value: 'https://github.com/neocotic/qrious'
})
});

console.log(qr === canvas.qrious)
qr === canvas.qrious;
//=> true
```

Expand All @@ -180,11 +198,11 @@ passed to the constructor as an option or the default value for the `mime` optio
``` javascript
const qr = new QRious({
value: 'https://github.com/neocotic/qrious'
})
});

console.log(qr.toDataURL())
qr.toDataURL();
//=> "data:image/png;base64,iVBOR...AIpqDnseH86KAAAAAElFTkSuQmCC"
console.log(qr.toDataURL('image/jpeg'))
qr.toDataURL('image/jpeg');
//=> "data:image/jpeg;base64,/9j/...xqAqIqgKFAAAAAq3RRQAUUUUAf/Z"
```

Expand All @@ -193,8 +211,8 @@ console.log(qr.toDataURL('image/jpeg'))
The current version of `QRious`.

``` javascript
console.log(QRious.VERSION)
//=> "2.2.0"
QRious.VERSION;
//=> "2.3.0"
```

## Migrating from v1
Expand Down Expand Up @@ -223,7 +241,7 @@ A list of QRious contributors can be found in [AUTHORS.md](https://github.com/ne

## License

Copyright © 2016 Alasdair Mercer
Copyright © 2017 Alasdair Mercer
Copyright © 2010 Tom Zerucha

See [LICENSE.md](https://github.com/neocotic/qrious/blob/master/LICENSE.md) for more information on our GPLv3 license.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qrious",
"version": "2.2.0",
"version": "2.3.0",
"description": "Library for QR code generation using canvas",
"homepage": "https://github.com/neocotic/qrious",
"authors": [
Expand Down
Loading

0 comments on commit 89e61d3

Please sign in to comment.