-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite code in ES5 #81
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
dist/ | ||
|
||
Gruntfile.js |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'), | ||
|
||
|
@@ -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: { | ||
|
@@ -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) { | ||
|
@@ -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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since UMD is now the only distribution format that's generated by the build, I've moved its files to the This will be a breaking changed for those using the CDN download links referenced in the README, but I fear that it's best. If I get enough kickback, I might add symbolic links, otherwise, I will recommend that they simply change their URLs as follows for the 2.3.0:
The download links in the README have been updated as part as this PR. |
||
} | ||
} | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to highlight that the CommonJS distribution file has been removed and is no longer generated by the build since Node.js modules will now import the
src/runtime/node.js
module directly as it is the new "main" entry inpackage.json
.