Permalink
Browse files

Refactor the build

- No more local dependency files
- Use browserify to output a UMD compatible module
- The abyssa internal modules have clearer dependencies (require calls at the top)
- Get rid or Bower, which is redundant when using NPM/browserify
- The default build file (abyssa.js) is now the one without embedded dependencies
  • Loading branch information...
1 parent 0197a98 commit 1e8006c4ebc1d302b08df5a531d5d9a948d63bac @AlexGalays committed Nov 5, 2013
View
@@ -1,2 +1 @@
-node_modules
-bower_components
+node_modules
View
@@ -2,52 +2,60 @@ module.exports = function(grunt) {
var banner = '/* <%= pkg.name %> <%= pkg.version %> - <%= pkg.description %> */\n\n';
- var libFiles = [
- 'lib/signals.js',
- 'lib/crossroads.js',
- 'lib/when.js',
- 'lib/history.iegte8.js',
- ];
-
- var srcFiles = [
- 'src/header.js',
- 'src/util.js',
- 'src/StateWithParams.js',
- 'src/Transition.js',
- 'src/State.js',
- 'src/Router.js',
- 'src/anchorClicks.js',
- 'src/footer.js'
+ var dependencies = [
+ 'when',
+ 'signals',
+ 'crossroads',
+ 'html5-history-api/history.iegte8'
];
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
+
+ browserify: {
+ build: {
+ files: {'target/abyssa.js': ['src/main.js']},
+ options: {
+ standalone: 'Abyssa',
+ ignore: dependencies
+ }
+ },
+ buildWithDeps: {
+ files: {'target/abyssa-with-deps.js': ['src/main.js'] },
+ options: {
+ standalone: 'Abyssa'
+ }
+ }
+ },
+
concat: {
options: {
banner: banner
},
- buildWithDeps: {
- src: libFiles.concat(srcFiles),
- dest: 'target/<%= pkg.name %>.js'
+ build: {
+ src: ['target/abyssa.js'],
+ dest: 'target/abyssa.js'
},
- buildWithoutDeps: {
- src: srcFiles,
- dest: 'target/<%= pkg.name %>-nodeps.js'
+ buildWithDeps: {
+ src: ['target/abyssa-with-deps.js'],
+ dest: 'target/abyssa-with-deps.js'
}
},
+
uglify: {
options: {
banner: banner
},
- buildWithDeps: {
- src: 'target/<%= pkg.name %>.js',
- dest: 'target/<%= pkg.name %>.min.js'
+ build: {
+ src: 'target/abyssa.js',
+ dest: 'target/abyssa.min.js'
},
- buildWithoutDeps: {
- src: 'target/<%= pkg.name %>-nodeps.js',
- dest: 'target/<%= pkg.name %>-nodeps.min.js'
+ buildWithDeps: {
+ src: 'target/abyssa-with-deps.js',
+ dest: 'target/abyssa-with-deps.min.js'
}
},
+
watch: {
all: {
files: ['src/*.js'],
@@ -59,7 +67,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks('grunt-browserify');
- grunt.registerTask('default', ['concat', 'uglify']);
+ grunt.registerTask('default', ['browserify', 'concat', 'uglify']);
grunt.registerTask('dev', ['default', 'watch']);
};
View
@@ -1,25 +0,0 @@
-{
- "name": "abyssa",
- "version": "1.2.4",
- "description": "A stateful router library for single page applications",
- "keywords": ["routes", "routing", "router", "hierarchical", "stateful", "pushState"],
- "main": "target/abyssa.js",
- "homepage": "https://github.com/AlexGalays/abyssa-js/",
- "author": {
- "name": "Alexandre Galays",
- "url": "https://github.com/AlexGalays/"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/AlexGalays/abyssa-js.git"
- },
- "licenses": [
- "http://www.opensource.org/licenses/mit-license.php"
- ],
- "dependencies": {
- "when": "2.5.1",
- "js-signals": "1.0.0",
- "crossroads.js": "0.12.0",
- "html5-history-api": "9be1cdadcd22435fb73850209f665a192248e3e4"
- }
-}
Oops, something went wrong.

0 comments on commit 1e8006c

Please sign in to comment.