Skip to content

Commit

Permalink
EnoFJS is now more elegantly integrated with node.js.
Browse files Browse the repository at this point in the history
This is however a major change. The old version would just append the module to the global `window`. Now it is refactored to actually append the module on `window.module`.

Also the `ClassFactory` got renamed to `clazz` to represent the module exposure name.

The nodejs version will use the commonjs `require` to include modules.
  • Loading branch information
EnoF committed May 15, 2014
1 parent 0a76808 commit a013d1d
Show file tree
Hide file tree
Showing 24 changed files with 122 additions and 57 deletions.
47 changes: 38 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// EnoFJS
// Version: 1.3.0
// Version: 2.0.0
//
// Copyright (c) 2014.
//
Expand Down Expand Up @@ -55,16 +55,45 @@ module.exports = function (grunt) {
src: ['test/nodifyTest.js']
}
},
pkg: grunt.file.readJSON('package.json'),
uglify: {
dist: {
files: {
'dist/enofjs/min.class.js': [
'src/ClassFactory.js'
],
'dist/enofjs/min.enof.js': [
'src/*.js'
]
}
options: {
banner: '/* !!EnoFJS!! ' +
'Version: <%= pkg.version %>, ' +
'Author: <%= pkg.author %>, ' +
'Fork me on Github: https://github.com/EnoF/EnoFJS */',
mangle: {
except: ['Serializable', 'LinkedHashMap']
}
},
files: [
{
'dist/enofjs/min.enof.js': [
'src/node-shim.js',
'src/clazz.js',
'src/*.js'
]
},
{
'dist/enofjs/min.clazz.js': 'src/clazz.js'
},
{
'dist/enofjs/min.node-shim.js': 'src/node-shim.js'
},
{
'dist/enofjs/min.LinkedHashMap.js': 'src/LinkedHashMap.js'
},
{
'dist/enofjs/min.Serializable.js': 'src/Serializable.js'
},
{
'dist/enofjs/min.ArrayConverters.js': 'src/ArrayConverters.js'
},
{
'dist/enofjs/min.whereIt.js': 'src/whereIt.js'
}
]
}
},
version: {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "enofjs",
"version": "1.3.0",
"version": "2.0.0",
"main": "src/enofjs",
"devDependencies": {
"jasmine": "^2.0"
Expand Down
1 change: 1 addition & 0 deletions dist/enofjs/min.ArrayConverters.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.LinkedHashMap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.Serializable.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.clazz.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.enof.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.node-shim.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/enofjs/min.whereIt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// EnoFJS
// Version: 1.3.0
// Version: 2.0.0
//
// Copyright (c) 2014.
//
Expand All @@ -14,7 +14,7 @@

// Expose modules.
module.exports = {
clazz: require('./src/ClassFactory.js'),
clazz: require('./src/clazz.js'),
LinkedHashMap: require('./src/LinkedHashMap.js')
};
}());
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "enofjs",
"description": "Enhancing javascript",
"author": "EnoF <[email protected]> (http://enof.github.io/EnoFJS",
"version": "1.3.0",
"version": "2.0.0",
"dependencies": {},
"devDependencies": {
"grunt": "^0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/ArrayConverters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// EnoFJS
// Version: 1.3.0
// Version: 2.0.0
//
// Copyright (c) 2014.
//
Expand Down
17 changes: 6 additions & 11 deletions src/LinkedHashMap.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// EnoFJS
// Version: 1.3.0
// Version: 2.0.0
//
// Copyright (c) 2014.
//
// Author Andy Tang
// Fork me on Github: https://github.com/EnoF/EnoFJS
(function LinkedHashMapScope(window, clazz, undefined) {
(function LinkedHashMapScope(window, module, undefined) {
'use strict';

var clazz = window.require('./clazz.js');

// A `Node` containing a `key` `value` pair.
// The `key` supports the types integer and string.
// The `value` however can be of any type.
Expand Down Expand Up @@ -232,12 +234,5 @@
};
});

/* istanbul ignore else */
if (window !== undefined) {
window.LinkedHashMap = LinkedHashMap;
} else {
module.exports = LinkedHashMap;
}
}(this.window,
this.window ? this.window.clazz :
/* istanbul ignore next */ require('./ClassFactory.js')));
window.exports(module, LinkedHashMap, './LinkedHashMap.js');
}(require('./node-shim.js'), module));
Loading

0 comments on commit a013d1d

Please sign in to comment.