-
Notifications
You must be signed in to change notification settings - Fork 6
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 #9 from pazguille/develop
Add UMD support
- Loading branch information
Showing
13 changed files
with
491 additions
and
477 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 |
---|---|---|
|
@@ -2,4 +2,4 @@ language: node_js | |
node_js: | ||
- 0.10 | ||
before_script: | ||
- npm install -g grunt-cli | ||
- npm install -g gulp |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,88 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module Dependencies. | ||
*/ | ||
var mkdirp = require('mkdirp'); | ||
var gulp = require('gulp'); | ||
var header = require('gulp-header'); | ||
var footer = require('gulp-footer'); | ||
var replace = require('gulp-replace'); | ||
var rename = require('gulp-rename'); | ||
var ugifyjs = require('gulp-uglify'); | ||
var jasmine = require('gulp-jasmine'); | ||
|
||
/** | ||
* Package | ||
*/ | ||
var pkg = require('./package.json'); | ||
var name = 'Jvent'; | ||
|
||
/** | ||
* String | ||
*/ | ||
var prefix = ['/*!', | ||
' * <%= pkg.name %> - v<%= pkg.version %>', | ||
' *', | ||
' * Copyright (c) ' + new Date().getFullYear() + ', <%= pkg.author %>', | ||
' * Released under the MIT license.', | ||
' */', | ||
'(function(window) {', | ||
''].join('\n'); | ||
var postfix = '\n}(this));'; | ||
var umd = [ | ||
'// AMD', | ||
'if (typeof window.define === \'function\' && window.define.amd !== undefined) {', | ||
' window.define(\'' + name + '\', [], function () {', | ||
' return ' + name + ';', | ||
' });', | ||
'// CommonJS', | ||
'} else if (typeof module !== \'undefined\' && module.exports !== undefined) {', | ||
' module.exports = ' + name + ';', | ||
'// Browser', | ||
'} else {', | ||
' window.' + name + ' = ' + name + ';', | ||
'};' | ||
].join('\n'); | ||
|
||
/** | ||
* Create directory | ||
*/ | ||
mkdirp('./dist'); | ||
|
||
/** | ||
* Build task | ||
*/ | ||
gulp.task('build', function() { | ||
mkdirp('./dist'); | ||
gulp.src('./index.js') | ||
.pipe(header(prefix, { 'pkg' : pkg })) | ||
.pipe(footer(postfix)) | ||
.pipe(replace('module.exports = ' + name + ';', umd)) | ||
.pipe(rename(pkg.name + '.js')) | ||
.pipe(gulp.dest('./dist/')); | ||
}); | ||
|
||
/** | ||
* Min task | ||
*/ | ||
gulp.task('min', function() { | ||
gulp.src('./dist/' + pkg.name + '.js') | ||
.pipe(ugifyjs()) | ||
.pipe(rename(pkg.name + '.min.js')) | ||
.pipe(gulp.dest('./dist/')); | ||
}); | ||
|
||
/** | ||
* Test task | ||
*/ | ||
gulp.task('test', function() { | ||
return gulp.src('./test/test.js') | ||
.pipe(jasmine({'reporter': 'spec'})); | ||
}); | ||
|
||
/** | ||
* Register tasks | ||
*/ | ||
gulp.task('default', ['build']); | ||
gulp.task('dist', ['build', 'min']); |
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,20 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2013 Guille Paz | ||
Copyright (c) 2014 Guille Paz | ||
|
||
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: | ||
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. | ||
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. |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "jvent", | ||
"repository": "[email protected]:pazguille/jvent.git", | ||
"description": "Event Emitter Class for the browser based on Node EventEmitter.", | ||
"author": "Guille Paz <[email protected]>", | ||
"version": "0.2.0", | ||
"ignore": [ | ||
".*", | ||
"package.json", | ||
"component.json", | ||
"node_modules", | ||
"gulpfile.js", | ||
"**/.*", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"main": "dist/jvent.js", | ||
"license": "MIT", | ||
"homepage": "https://github.com/pazguille/jvent", | ||
"moduleType": [ | ||
"amd", | ||
"globals", | ||
"node" | ||
], | ||
"keywords": [ | ||
"events", | ||
"event emitter", | ||
"emitter" | ||
], | ||
"authors": [ | ||
"@pazguille <[email protected]>" | ||
] | ||
} |
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
Oops, something went wrong.