src/
and
lib/
lib/
out of source control
npm install --save-dev babel
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
package.json
{
"name": "my-es6-project",
"version": "0.1.0",
"scripts": {
"compile": "babel --source-maps --out-dir lib/ src/",
"test": "mocha test/ --recursive --compilers js:babel/register"
},
"main": "lib/my-es6-project.js",
"dependencies": {
"core-js": "^1.2.3"
},
"devDependencies": {
"babel": "^5.8.29",
"chai": "^3.4.0",
"mocha": "^2.3.3"
}
}
.js
extension where possible.es6
extension for syntax highlightingprepublish
script
.npmignore
file to exclude
src/
{
"scripts": {
"compile": "babel -sd lib/ src/",
"prepublish": "npm run compile",
"test": "mocha test/ -R spec --recursive --compilers es6:babel/register"
}
}
package.json
src/
.npmignore
npm install my-es6-project
as usual
require('my-es6-project')
as usual
import 'my-es6-project'
for ES6