Make the concat list explicit
Since I decided to preen mocha and chai, we can no longer generate the concat file list from the preen config. We must instead explicitly list the modules we want to concatenate. I placed this config in bower.json so that most of the time, we won't need to change the Gruntfile. Also added a concatenation task for test page dependencies.
This commit is contained in:
parent
756fdd2383
commit
6b034e951a
6 changed files with 10922 additions and 49 deletions
16
Gruntfile.js
16
Gruntfile.js
|
@ -1,9 +1,9 @@
|
|||
module.exports = function(grunt) {
|
||||
|
||||
// build the concat config from the preen config
|
||||
var bower = grunt.file.readJSON('bower.json');
|
||||
var components = [];
|
||||
for (component in grunt.file.readJSON('bower.json').preen) {
|
||||
components.push('components/' + component + '/**/*.js');
|
||||
for (i in bower.concat.app) {
|
||||
components.push('components/' + bower.concat.app[i] + '/**/*.js');
|
||||
}
|
||||
|
||||
grunt.initConfig({
|
||||
|
@ -12,7 +12,15 @@ module.exports = function(grunt) {
|
|||
src: components,
|
||||
dest: 'js/components.js',
|
||||
},
|
||||
},
|
||||
test: {
|
||||
src: [
|
||||
'components/mocha/mocha.js',
|
||||
'components/chai/chai.js',
|
||||
'test/_test.js'
|
||||
],
|
||||
dest: 'test/test.js',
|
||||
}
|
||||
}
|
||||
});
|
||||
grunt.loadNpmTasks('grunt-preen');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
|
|
10
README.md
10
README.md
|
@ -59,12 +59,14 @@ actually use from the new package, e.g.:
|
|||
...
|
||||
}
|
||||
```
|
||||
If you'd like to add the new dependency to js/components.js to be included on
|
||||
all html pages, simply append the package name to the concat.app list in
|
||||
`bower.json`. Take care to insert it in the order you would like it
|
||||
concatenated.
|
||||
|
||||
Now, run `grunt` to delete unused package files and concatenate the remaining
|
||||
javascript files into `js/components.js`. Note that packages will be
|
||||
concatenated **in the order** that they are listed in the preen config.
|
||||
Now, run `grunt` to delete unused package files and build `js/components.js`.
|
||||
|
||||
Finally, stage and commit changes to bower.json, `js/bower_components.js`,
|
||||
Finally, stage and commit changes to bower.json, `js/components.js`,
|
||||
and `components/`. The latter should be limited to files we actually use.
|
||||
|
||||
Tests
|
||||
|
|
65
bower.json
65
bower.json
|
@ -5,52 +5,41 @@
|
|||
"license": "GPLV3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"backbone": "~1.1.2",
|
||||
"jquery": "liliakai/jquery#2.1.1-ajax-nativetransport",
|
||||
"underscore": "~1.7.0",
|
||||
"backbone": "~1.1.2",
|
||||
"protobuf": "~3.8.0",
|
||||
"bootstrap": "~3.3.0",
|
||||
"jquery": "liliakai/jquery#2.1.1-ajax-nativetransport",
|
||||
"mustache": "~0.8.2",
|
||||
"qrcode": "git://github.com/davidshimjs/qrcodejs.git"
|
||||
},
|
||||
"preen": {
|
||||
"jquery": [
|
||||
"dist/jquery.js"
|
||||
],
|
||||
"long": [
|
||||
"dist/Long.js"
|
||||
],
|
||||
"bytebuffer": [
|
||||
"dist/ByteBufferAB.js"
|
||||
],
|
||||
"protobuf": [
|
||||
"dist/ProtoBuf.js"
|
||||
],
|
||||
"mustache": [
|
||||
"mustache.js"
|
||||
],
|
||||
"underscore": [
|
||||
"underscore.js"
|
||||
],
|
||||
"backbone": [
|
||||
"backbone.js"
|
||||
],
|
||||
"bootstrap": [
|
||||
"dist/css/bootstrap.css"
|
||||
],
|
||||
"qrcode": [
|
||||
"qrcode.js"
|
||||
],
|
||||
"mocha": [
|
||||
"mocha.js",
|
||||
"mocha.css"
|
||||
],
|
||||
"chai": [
|
||||
"chai.js"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~2.0.1",
|
||||
"chai": "~1.9.2"
|
||||
},
|
||||
"preen": {
|
||||
"jquery" : [ "dist/jquery.js" ],
|
||||
"long" : [ "dist/Long.js" ],
|
||||
"bytebuffer" : [ "dist/ByteBufferAB.js" ],
|
||||
"protobuf" : [ "dist/ProtoBuf.js" ],
|
||||
"mustache" : [ "mustache.js" ],
|
||||
"underscore" : [ "underscore.js" ],
|
||||
"backbone" : [ "backbone.js" ],
|
||||
"qrcode" : [ "qrcode.js" ],
|
||||
"mocha" : [ "mocha.js", "mocha.css" ],
|
||||
"chai" : [ "chai.js" ],
|
||||
"bootstrap" : [ "dist/css/bootstrap.css" ]
|
||||
},
|
||||
"concat": {
|
||||
"app": [
|
||||
"jquery",
|
||||
"long",
|
||||
"bytebuffer",
|
||||
"protobuf",
|
||||
"mustache",
|
||||
"underscore",
|
||||
"backbone",
|
||||
"qrcode"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
2
test/_test.js
Normal file
2
test/_test.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
mocha.setup("bdd");
|
||||
window.assert = chai.assert;
|
|
@ -119,8 +119,7 @@
|
|||
</form>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="../components/mocha/mocha.js"></script>
|
||||
<script type="text/javascript" src="../components/chai/chai.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="blanket_mocha.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../js-deps/nacl-common.js"></script>
|
||||
|
@ -157,7 +156,6 @@
|
|||
|
||||
<script type="text/javascript" src="fake_api.js"></script>
|
||||
<script type="text/javascript" src="testvectors.js"></script>
|
||||
<script type="text/javascript" src="test.js"></script>
|
||||
<script type="text/javascript" src="crypto_test.js"></script>
|
||||
<script type="text/javascript" src="views/message_view_test.js"></script>
|
||||
<script type="text/javascript" src="views/list_view_test.js"></script>
|
||||
|
|
10874
test/test.js
10874
test/test.js
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue