-
Notifications
You must be signed in to change notification settings - Fork 8
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 #1 from pazguille/master
Update ES6 module workflow.
- Loading branch information
Showing
10 changed files
with
228 additions
and
27 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,2 +1,3 @@ | ||
.DS_Store | ||
node_modules | ||
node_modules | ||
npm-debug.log |
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,4 @@ | ||
node_modules | ||
babel.js | ||
browserify.js | ||
.gitignore |
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Dependencies | ||
*/ | ||
var fs = require('fs'); | ||
var babel = require('babel'); | ||
|
||
if (!fs.existsSync('./es5')) { | ||
fs.mkdirSync('./es5'); | ||
/** | ||
* Create directories | ||
*/ | ||
if (!fs.existsSync('./dist')) { | ||
fs.mkdirSync('./dist'); | ||
} | ||
|
||
babel.transformFile('index.js', {'loose': ['es6.classes']}, function (err, result) { | ||
/** | ||
* Babel | ||
*/ | ||
babel.transformFile('./src/index.js', {'loose': ['es6.classes', 'es6.modules']}, function (err, result) { | ||
if (err) { console.log('Error : ' + err.message); } | ||
fs.writeFileSync('./es5/index.js', result.code); | ||
}); | ||
fs.writeFileSync('./dist/index.js', result.code); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,23 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Dependencies | ||
*/ | ||
var fs = require('fs'); | ||
var browserify = require('browserify'); | ||
|
||
/** | ||
* Create directories | ||
*/ | ||
if (!fs.existsSync('./browser')) { | ||
fs.mkdirSync('./browser'); | ||
} | ||
|
||
/** | ||
* Browserify | ||
*/ | ||
browserify({ 'entries': './src/index.js', 'standalone': 'Emitter', 'debug': true }) | ||
.transform('babelify', {'loose': ['es6.classes', 'es6.modules']}) | ||
.bundle() | ||
.on('error', function (err) { console.log('Error : ' + err.message); }) | ||
.pipe(fs.createWriteStream('browser/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
{ | ||
"name": "emitter", | ||
"repository": "git@github.com:mango/emitter.git", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:mango/emitter.git" | ||
}, | ||
"description": "A JavaScript event emitter written in ES6.", | ||
"author": "Guille Paz <guille87paz@gmail.com>", | ||
"version": "0.0.2", | ||
"author": { | ||
"name": "Guille Paz", | ||
"email": "guille87paz@gmail.com" | ||
}, | ||
"version": "0.0.4", | ||
"scripts": { | ||
"test": "_mocha", | ||
"es5": "node babel.js", | ||
"hint": "jshint index.js", | ||
"prepublish": "npm run es5" | ||
"hint": "jshint ./src/index.js", | ||
"compile": "node babel.js", | ||
"browser": "node browserify.js", | ||
"prepublish": "npm run compile" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"babel": "^5.0.2", | ||
"babelify": "^6.0.0", | ||
"better-assert": "1.0.2", | ||
"browserify": "^9.0.7", | ||
"jshint": "2.6.3", | ||
"mocha": "2.1.0" | ||
}, | ||
"main": "index.js", | ||
"main": "./dist/index.js", | ||
"keywords": [ | ||
"emitter" | ||
], | ||
"license": "MIT" | ||
} | ||
} |
File renamed without changes.
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