Skip to content

Commit

Permalink
Setting up babel for ES6 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederick F. Kautz IV committed May 24, 2015
1 parent 9be7eb2 commit 7569e66
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules

# IDEA
/.idea/
/build/
*.iml

/dist/
39 changes: 39 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
var gulp = require('gulp')
var babel = require('gulp-babel')
var mocha = require('gulp-mocha')
var concat = require('gulp-concat')
var sourcemaps = require('gulp-sourcemaps')
//var sourcemaps = require('gulp-sourcemaps')

gulp.task('default', ['test'], function() {
})

gulp.task('compile', function(cb) {
gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('minio.js'))
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/main'))
.on('end', function() {
cb()
})
})

gulp.task('test:compile', function(cb) {
gulp.src('test/**/*.js')
.pipe(sourcemaps.init())
.pipe(concat('minio-test.js'))
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist/test'))
.on('end', function() {
cb()
})
})

gulp.task('test',['compile', 'test:compile'], function () {
gulp.src('dist/test/*.js', {read: false})
.pipe(mocha({reporter: 'nyan'}))
})

15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "minio",
"version": "0.0.2",
"description": "S3 compatible object storage client",
"main": "index.js",
"main": "./dist/main/minio.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"preinstall": "gulp compile",
"test": "gulp test"
},
"repository": {
"type": "git",
Expand All @@ -15,5 +16,13 @@
"bugs": {
"url": "https://github.com/minio/objectstorage-js/issues"
},
"homepage": "https://github.com/minio/objectstorage-js#readme"
"homepage": "https://github.com/minio/objectstorage-js#readme",
"dependencies": {},
"devDependencies": {
"gulp-babel": "^5.1.0",
"gulp-concat": "^2.5.2",
"gulp-mocha": "^2.1.0",
"gulp-sourcemaps": "^1.5.2",
"source-map-support": "^0.2.10"
}
}
7 changes: 7 additions & 0 deletions src/minio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Minio {
getClient() {
return "hello";
}
}
var inst = new Minio();
module.exports = inst;
18 changes: 18 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require('source-map-support').install();

var assert = require('assert');
var minio = require('../..');

describe('Object Storage Client', function () {
"use strict";
describe("#getClient()", function () {
it('should return a client', function () {
var client = minio.getClient();
assert.equal('hello', client);
})
it('should return index when the value is not present', function () {
assert.equal(0, [2, 3, 4].indexOf(2))
})
})
}
)

0 comments on commit 7569e66

Please sign in to comment.