Skip to content

Commit

Permalink
Merge pull request #28 from harthur-org/es6-for-realz
Browse files Browse the repository at this point in the history
es6, here we come
  • Loading branch information
robertleeplummerjr committed Sep 7, 2016
2 parents 6254ca7 + 4e19490 commit ec2fb5c
Show file tree
Hide file tree
Showing 60 changed files with 6,334 additions and 3,333 deletions.
4 changes: 4 additions & 0 deletions .babelrc
@@ -0,0 +1,4 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": ["es2015"]
}
65 changes: 45 additions & 20 deletions Gruntfile.js
Expand Up @@ -9,22 +9,57 @@
var fs = require('fs');
var browserify = require('browserify');
var pkg = require('./package.json');
var grunt = require('grunt');
require('load-grunt-tasks')(grunt);

module.exports = function(grunt) {
grunt.initConfig({
babel: {
options: {
sourceMap: true,
presets: ['es2015']
},
dist: {
files: [{
expand: true,
cwd: 'src/',
src: ['*.js'],
dest: 'dist/'
},{
expand: true,
cwd: 'src/utilities',
src: ['*.js'],
dest: 'dist/utilities'
}]
}
},
mochaTest: {
test: {
options: {
style: 'bdd',
reporter: 'spec'
reporter: 'spec',
require: 'babel-register'
},
src: ['test/unit/*.js']
src: [
'test/cross-validation/*.js',
'test/unit/*.js'
]
}
},
pkg: grunt.file.readJSON('package.json'),
browserify: {
options: {
banner: '/*\n' + grunt.file.read('LICENSE') + '*/',
version: grunt.file.readJSON('package.json').version
},
browser: {
src: ['dist/*.js', 'dist/utilities/*.js'],
dest: 'browser.js'
}
},
uglify: {
options: {
banner: '/*\n' + grunt.file.read('LICENSE') + '*/'
banner: '/*\n' + grunt.file.read('LICENSE') + '*/',
},
dist: {
files: {
Expand All @@ -34,25 +69,15 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('build', 'build a browser file', function() {
var done = this.async();
var outfile = './browser.js';
var bundle = browserify(pkg.main).bundle(function(err, src) {
console.log('> ' + outfile);
//we need to keep these up to date
if (grunt.file.readJSON('package.json').version !== grunt.file.readJSON('bower.json').version) {
console.log('Error: bower.json & package.json version mismatch');
process.exit(0);
}

// prepend license
var license = fs.readFileSync('./LICENSE');
src = '/*\n' + license + '*/' + src;

// write out the browser file
fs.writeFileSync(outfile, src);
done();
});
});

grunt.registerTask('build-min', 'uglify');
grunt.registerTask('test', 'mochaTest');
grunt.registerTask('default', ['build', 'build-min', 'test']);
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['babel', 'test', 'browserify', 'uglify']);
};
22 changes: 12 additions & 10 deletions bower.json
@@ -1,27 +1,29 @@
{
"name": "brain.js",
"version": "0.7.1",
"version": "1.0.0-alpha",
"homepage": "https://github.com/harthur-org/brain.js",
"authors": [
"Heather Arthur <fayearthur@gmail.com>"
],
"description": "Neural network library",
"keywords": [
"brain",
"nueral",
"network",
"ai",
"artificial-intelligence",
"brain",
"brainjs",
"brain,js",
"feed forward",
"neural network",
"classifier",
"neural",
"network",
"neural-networks",
"machine-learning",
"classifier"
"synpapse"
],
"main": "browser.min.js",
"main": "./browser.min.js",
"ignore": [
"node_modules",
"test"
],
"dependencies": {
"underscore": ">=1.5.1"
}
]
}

0 comments on commit ec2fb5c

Please sign in to comment.