Skip to content

Commit

Permalink
Merge pull request #81 from neocotic/es5
Browse files Browse the repository at this point in the history
Rewrite code in ES5
  • Loading branch information
neocotic committed Jun 1, 2017
2 parents 4bfeee3 + 755cdd0 commit 81a28f9
Show file tree
Hide file tree
Showing 38 changed files with 3,843 additions and 9,489 deletions.
13 changes: 0 additions & 13 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
dist/

Gruntfile.js
7 changes: 2 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{
"extends": "notninja/es6",
"extends": "notninja/es5",
"env": {
"browser": true,
"node": true
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
},
"rules": {
"max-params": [
"error",
5
],
"no-bitwise": "off",
"no-invalid-this": "off",
"no-unused-vars": [
"warn",
{
Expand Down
103 changes: 30 additions & 73 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,10 @@
'use strict';

module.exports = function(grunt) {
var babel = require('rollup-plugin-babel');
var commonjs = require('rollup-plugin-commonjs');
var nodeResolve = require('rollup-plugin-node-resolve');
var uglify = require('rollup-plugin-uglify');

var bannerLarge = [
'/*',
' * QRious v<%= pkg.version %>',
' * Copyright (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>',
' * Copyright (C) 2010 Tom Zerucha',
' *',
' * This program is free software: you can redistribute it and/or modify',
' * it under the terms of the GNU General Public License as published by',
' * the Free Software Foundation, either version 3 of the License, or',
' * (at your option) any later version.',
' *',
' * This program is distributed in the hope that it will be useful,',
' * but WITHOUT ANY WARRANTY; without even the implied warranty of',
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the',
' * GNU General Public License for more details.',
' *',
' * 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');
var bannerSmall = [
'/*! QRious v<%= pkg.version %> | (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | GPL v3 License',
'Based on jsqrencode | (C) 2010 tz@execpc.com | GPL v3 License',
'*/'
].join('\n');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

Expand All @@ -63,55 +36,42 @@ module.exports = function(grunt) {
},

rollup: {
cjs: {
options: {
format: 'cjs',
sourceMap: true,
sourceMapRelativePaths: true,
banner: bannerLarge,
external: [ 'canvas' ],
plugins: function() {
return [
nodeResolve({
jsnext: true,
main: true
}),
commonjs(),
babel({
exclude: [ 'node_modules/**' ],
runtimeHelpers: true
})
];
}
},
files: {
'dist/cjs/qrious.js': 'src/runtime/node.js'
}
},
umdDevelopment: {
options: {
format: 'umd',
moduleId: 'qrious',
moduleName: 'QRious',
sourceMap: true,
sourceMapRelativePaths: true,
banner: bannerLarge,
banner: [
'/*',
' * QRious v<%= pkg.version %>',
' * Copyright (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>',
' * Copyright (C) 2010 Tom Zerucha',
' *',
' * This program is free software: you can redistribute it and/or modify',
' * it under the terms of the GNU General Public License as published by',
' * the Free Software Foundation, either version 3 of the License, or',
' * (at your option) any later version.',
' *',
' * This program is distributed in the hope that it will be useful,',
' * but WITHOUT ANY WARRANTY; without even the implied warranty of',
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the',
' * GNU General Public License for more details.',
' *',
' * 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'),
plugins: function() {
return [
nodeResolve({
jsnext: true,
main: true
}),
commonjs(),
babel({
exclude: [ 'node_modules/**' ],
runtimeHelpers: true
})
nodeResolve({ main: true }),
commonjs()
];
}
},
files: {
'dist/umd/qrious.js': 'src/runtime/browser.js'
'dist/qrious.js': 'src/runtime/browser.js'
}
},
umdProduction: {
Expand All @@ -121,18 +81,15 @@ module.exports = function(grunt) {
moduleName: 'QRious',
sourceMap: true,
sourceMapRelativePaths: true,
banner: bannerSmall,
banner: [
'/*! QRious v<%= pkg.version %> | (C) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | GPL v3 License',
'Based on jsqrencode | (C) 2010 tz@execpc.com | GPL v3 License',
'*/'
].join('\n'),
plugins: function() {
return [
nodeResolve({
jsnext: true,
main: true
}),
nodeResolve({ main: true }),
commonjs(),
babel({
exclude: [ 'node_modules/**' ],
runtimeHelpers: true
}),
uglify({
output: {
comments: function(node, comment) {
Expand All @@ -144,7 +101,7 @@ module.exports = function(grunt) {
}
},
files: {
'dist/umd/qrious.min.js': 'src/runtime/browser.js'
'dist/qrious.min.js': 'src/runtime/browser.js'
}
}
},
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

[![Chat](https://img.shields.io/gitter/room/neocotic/qrious.svg?style=flat-square)](https://gitter.im/neocotic/qrious)
[![Build Status](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)
[![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)
Expand Down Expand Up @@ -38,8 +39,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://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))
* [Development Version](https://cdn.rawgit.com/neocotic/qrious/master/dist/qrious.js) (123kb - [Source Map](https://cdn.rawgit.com/neocotic/qrious/master/dist/qrious.js.map))
* [Production Version](https://cdn.rawgit.com/neocotic/qrious/master/dist/qrious.min.js) (37kb - [Source Map](https://cdn.rawgit.com/neocotic/qrious/master/dist/qrious.min.js.map))

### Node.js Dependencies

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"type": "git",
"url": "https://github.com/neocotic/qrious.git"
},
"main": "dist/umd/qrious.js",
"main": "dist/qrious.js",
"ignore": [
"src/",
".*",
Expand Down
2 changes: 1 addition & 1 deletion demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
</section>
</main>

<script src="./dist/umd/qrious.js"></script>
<script src="./dist/qrious.js"></script>
<script>
(function() {
var $background = document.querySelector('main form [name="background"]');
Expand Down
Loading

0 comments on commit 81a28f9

Please sign in to comment.