inital boilerplate checkin
This commit is contained in:
4
.babelrc
Normal file
4
.babelrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"presets": "es2015",
|
||||
"plugins": "add-module-exports"
|
||||
}
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
lib
|
||||
node_modules
|
||||
npm-debug.log
|
||||
2
.npmignore
Normal file
2
.npmignore
Normal file
@@ -0,0 +1,2 @@
|
||||
src
|
||||
test
|
||||
22
package.json
Normal file
22
package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "project-name",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "npm run build && mocha --compilers js:babel-core/register",
|
||||
"build": "babel src --out-dir lib",
|
||||
"prepublish": "npm run test"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"babel-cli": "~6.7.5",
|
||||
"babel-core": "~6.7.6",
|
||||
"babel-plugin-add-module-exports": "~0.1.2",
|
||||
"babel-preset-es2015": "~6.6.0",
|
||||
"expect.js": "~0.3.1",
|
||||
"mocha": "~2.4.5",
|
||||
"sinon": "~1.17.3"
|
||||
}
|
||||
}
|
||||
12
src/index.js
Normal file
12
src/index.js
Normal file
@@ -0,0 +1,12 @@
|
||||
class User {
|
||||
constructor(firstName, lastName) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
getName() {
|
||||
return `${this.firstName} ${this.lastName}`
|
||||
}
|
||||
}
|
||||
|
||||
export default User;
|
||||
10
test/index.js
Normal file
10
test/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import User from '../lib/index'
|
||||
import expect from 'expect.js';
|
||||
|
||||
describe('User class', function () {
|
||||
it('should return the name', function () {
|
||||
var user = new User('test', 'user');
|
||||
|
||||
expect(user.getName()).to.equal('test user');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user