-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from neocotic/develop
Release 3.0.0
- Loading branch information
Showing
41 changed files
with
5,255 additions
and
9,448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
dist/ | ||
|
||
Gruntfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,176 +20,104 @@ | |
'use strict'; | ||
|
||
module.exports = function(grunt) { | ||
var babel; | ||
var commonjs; | ||
var nodeResolve; | ||
var semver = require('semver'); | ||
var 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 [email protected] | GPL v3 License', | ||
'*/' | ||
].join('\n'); | ||
var commonjs = require('rollup-plugin-commonjs'); | ||
var nodeResolve = require('rollup-plugin-node-resolve'); | ||
var uglify = require('rollup-plugin-uglify'); | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
watch: { | ||
all: { | ||
files: [ 'src/**/*.js' ], | ||
tasks: [ 'test' ] | ||
} | ||
} | ||
}); | ||
|
||
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'); | ||
clean: { | ||
build: [ 'dist/**' ] | ||
}, | ||
|
||
compileTasks.push('clean', 'rollup'); | ||
|
||
grunt.config.merge({ | ||
clean: { | ||
build: [ 'dist/**' ] | ||
}, | ||
|
||
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, | ||
plugins: function() { | ||
return [ | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true | ||
}), | ||
commonjs(), | ||
babel({ | ||
exclude: [ 'node_modules/**' ], | ||
runtimeHelpers: true | ||
}) | ||
]; | ||
} | ||
}, | ||
files: { | ||
'dist/umd/qrious.js': 'src/runtime/browser.js' | ||
eslint: { | ||
target: [ 'src/**/*.js' ] | ||
}, | ||
|
||
rollup: { | ||
umdDevelopment: { | ||
options: { | ||
format: 'umd', | ||
moduleId: 'qrious', | ||
moduleName: 'QRious', | ||
sourceMap: true, | ||
sourceMapRelativePaths: true, | ||
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({ main: true }), | ||
commonjs() | ||
]; | ||
} | ||
}, | ||
umdProduction: { | ||
options: { | ||
format: 'umd', | ||
moduleId: 'qrious', | ||
moduleName: 'QRious', | ||
sourceMap: true, | ||
sourceMapRelativePaths: true, | ||
banner: bannerSmall, | ||
plugins: function() { | ||
return [ | ||
nodeResolve({ | ||
jsnext: true, | ||
main: true | ||
}), | ||
commonjs(), | ||
babel({ | ||
exclude: [ 'node_modules/**' ], | ||
runtimeHelpers: true | ||
}), | ||
uglify({ | ||
output: { | ||
comments: function(node, comment) { | ||
return comment.type === 'comment2' && /^\!/.test(comment.value); | ||
} | ||
files: { | ||
'dist/qrious.js': 'src/runtime/browser.js' | ||
} | ||
}, | ||
umdProduction: { | ||
options: { | ||
format: 'umd', | ||
moduleId: 'qrious', | ||
moduleName: 'QRious', | ||
sourceMap: true, | ||
sourceMapRelativePaths: true, | ||
banner: [ | ||
'/*! 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'), | ||
plugins: function() { | ||
return [ | ||
nodeResolve({ main: true }), | ||
commonjs(), | ||
uglify({ | ||
output: { | ||
comments: function(node, comment) { | ||
return comment.type === 'comment2' && /^\!/.test(comment.value); | ||
} | ||
}) | ||
]; | ||
} | ||
}, | ||
files: { | ||
'dist/umd/qrious.min.js': 'src/runtime/browser.js' | ||
} | ||
}) | ||
]; | ||
} | ||
}, | ||
files: { | ||
'dist/qrious.min.js': 'src/runtime/browser.js' | ||
} | ||
} | ||
}); | ||
|
||
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...'); | ||
} | ||
|
||
if (semver.satisfies(process.version, '>=4')) { | ||
compileTasks.unshift('eslint'); | ||
|
||
grunt.config.set('eslint', { | ||
target: [ 'src/**/*.js' ] | ||
}); | ||
}, | ||
|
||
grunt.loadNpmTasks('grunt-eslint'); | ||
} else { | ||
grunt.log.writeln('"eslint" task is disabled because Node.js version is <4! Please consider upgrading Node.js...'); | ||
} | ||
watch: { | ||
all: { | ||
files: [ 'src/**/*.js' ], | ||
tasks: [ 'eslint' ] | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
require('load-grunt-tasks')(grunt); | ||
|
||
grunt.registerTask('default', [ 'build' ]); | ||
grunt.registerTask('build', buildTasks); | ||
grunt.registerTask('compile', compileTasks); | ||
grunt.registerTask('test', testTasks); | ||
grunt.registerTask('default', [ 'ci' ]); | ||
grunt.registerTask('build', [ 'eslint', 'clean:build', 'rollup' ]); | ||
grunt.registerTask('ci', [ 'eslint', 'clean', 'rollup' ]); | ||
grunt.registerTask('test', [ 'eslint' ]); | ||
}; |
Oops, something went wrong.