forked from deepstreamIO/deepstream.io-client-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
95 lines (84 loc) · 2.27 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var derequire = require( 'derequire' );
module.exports = function( grunt ) {
var dereqCallback = function( err, src, next ) {
if( err ) {
throw err;
}
next( err, derequire( src ) );
};
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
browserify: {
dist: {
files: {
'dist/deepstream.js': [ 'src/client.js' ]
},
options: {
postBundleCB: dereqCallback,
ignore: [ './src/tcp/tcp-connection.js' ],
browserifyOptions: {
standalone: 'deepstream',
//'builtins': []
}
}
},
live: {
files: {
'dist/deepstream.js': [ 'src/client.js' ]
},
options: {
watch: true,
keepAlive: true,
postBundleCB: dereqCallback,
ignore: [ './src/tcp/tcp-connection.js' ],
browserifyOptions: {
standalone: 'deepstream',
}
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> (c)<%= grunt.template.today("yyyy") %> deepstreamHub GmbH, with parts (c)<%= grunt.template.today("yyyy") %> Joyent and contributers @licence <%= pkg.license %>*/\n'
},
dist: {
files: {
'dist/deepstream.min.js': [ 'dist/deepstream.js' ]
}
}
},
exec: {
runUnitTests: 'npm run-script watch',
runUnitTestsOnce: 'npm test'
},
_release: {
options: {
beforeBump: [ 'build' ],
additionalFiles: [ 'bower.json' ],
github: {
repo: 'deepstreamIO/deepstream.io-client-js',
usernameVar: 'GITHUB_USERNAME',
passwordVar: 'GITHUB_PASSWORD'
}
}
}
} );
grunt.loadNpmTasks( 'grunt-browserify' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-exec' );
grunt.loadNpmTasks( 'grunt-release' );
grunt.renameTask( 'release', '_release' );
grunt.registerTask( 'dev', 'Browserifies the files on every change to src', [ 'browserify:live' ] );
grunt.registerTask( 'test-unit', [ 'exec:runUnitTests' ] );
grunt.registerTask( 'just-build', 'Browserifies, tests and minifies the client file', [
'browserify:dist',
'uglify:dist'
] );
grunt.registerTask( 'build', 'Browserifies, tests and minifies the client file', [
'browserify:dist',
'exec:runUnitTestsOnce',
'uglify:dist'
] );
grunt.registerTask( 'default', [ 'build' ] );
grunt.registerTask( 'release', [ 'build', '_release' ] );
};