Skip to content

Commit

Permalink
Merge pull request #9 from pazguille/develop
Browse files Browse the repository at this point in the history
Add UMD support
  • Loading branch information
pazguille committed Aug 23, 2014
2 parents 122d82b + 9e3785c commit 8ed219c
Show file tree
Hide file tree
Showing 13 changed files with 491 additions and 477 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: node_js
node_js:
- 0.10
before_script:
- npm install -g grunt-cli
- npm install -g gulp
87 changes: 0 additions & 87 deletions Gruntfile.js

This file was deleted.

88 changes: 88 additions & 0 deletions Gulpfile.js
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']);
25 changes: 13 additions & 12 deletions LICENSE
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.
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

34 changes: 34 additions & 0 deletions bower.json
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]>"
]
}
3 changes: 1 addition & 2 deletions component.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
"dependencies": {},
"development": {},
"license": "MIT",
"main": "dist/jvent.js",
"scripts": ["dist/jvent.js"]
"main": "index.js"
}
Loading

0 comments on commit 8ed219c

Please sign in to comment.