- Timestamp:
- 07/01/13 02:49:04 (12 years ago)
- Location:
- Dev/trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/Gruntfile.js
r466 r469 2 2 */ 3 3 4 var _ = require('underscore'); 5 4 6 module.exports = function(grunt) { 5 7 8 // TASKS 9 10 grunt.registerTask('default', ['compile']); 11 grunt.registerTask('compile', ['jshint:lint-sources' 12 ,'htmlhint:lint' 13 ,'coffeelint:lint' 14 ,'less:compile' 15 ,'usebanner:generated-css' 16 ,'coffee:compile' 17 ,'usebanner:generated-js' 18 ,'jshint:lint-generated' 19 //,'amd-check' // too smart about plugins, r.js can't find them 20 ]); 21 grunt.registerTask('build', ['clean:build' 22 ,'copy:build' 23 ,'dojo:build' 24 ]); 25 grunt.registerTask('deploy', []); 26 27 // FILES AND FOLDERS 28 6 29 var srcDir = 'src/'; 7 30 var buildDir = 'build/'; 8 var developmentDir = buildDir+'development/'; 9 var productionDir = buildDir+'production/'; 31 var coffeeMap = grunt.file.expandMapping( 32 [ 'client/qed-client/**/*.coffee', 'server/**/*.coffee' ], 33 srcDir, 34 { cwd: srcDir, ext: '.js' }); 35 var lessMap = grunt.file.expandMapping( 36 [ 'client/qed-client/css/qed.less' ], 37 srcDir, 38 { cwd: srcDir, ext: '.css' }); 10 39 40 // TASK CONFIG 41 11 42 grunt.initConfig({ 43 'amd-check': { 44 files: [ srcDir+'client/qed-client/**/*.js' ] 45 }, 12 46 clean: { 13 development: { 14 src: [developmentDir] 15 }, 16 production: { 17 src: [productionDir] 18 } 47 build: { src: [buildDir] } 19 48 }, 20 49 coffee: { 21 options: { 22 bare: true 23 }, 24 compile: { 25 files: [{ 26 expand: true, 27 cwd: srcDir, 28 src: ['client/qed-client/**/*.coffee', 'server/**/*.coffee'], 29 dest: developmentDir, 30 ext: '.js' 31 }] 32 } 50 options: { bare: true }, 51 compile: { files: coffeeMap } 33 52 }, 34 53 coffeelint: { 35 compile: { 36 options: require('./'+srcDir+'.coffeelint.json'), 37 files: [{ 38 expand: true, 39 cwd: srcDir, 40 src: ['client/qed-client/**/*.coffee', 'server/**.coffee'] 41 }] 42 } 54 lint: { options: require('./'+srcDir+'.coffeelint.json'), 55 files: coffeeMap } 43 56 }, 44 57 copy: { 45 'client-deps': { 46 files: [{ 47 expand: true, 48 cwd: srcDir, 49 src: ['client/dojo/**', 'client/dijit/**', 'client/dojox/**', 'client/util/**'], 50 dest: developmentDir 51 }] 52 }, 53 'server-deps': { 54 files: [{ 55 expand: true, 56 cwd: srcDir, 57 src: ['node_modules/**'], 58 dest: developmentDir 59 }] 60 }, 61 compile: { 62 files: [{ 63 expand: true, 64 cwd: srcDir, 65 src: ['**', '!**/*.coffee', '!**/*.less', '!node_modules/**', '!client/dojo/**', '!client/dijit/**', '!client/dojox/**', '!client/util/**' ], 66 dest: developmentDir 67 }] 68 }, 69 deploy: { 70 files: [{ 71 expand: true, 72 cwd: developmentDir, 73 src: ['**', '!client/*/**' ], 74 dest: productionDir 75 }] 76 } 58 build: { files: [{ expand: true, 59 cwd: srcDir, 60 src: ['**', '!client/*/**' ], 61 dest: buildDir }]} 77 62 }, 78 63 dojo: { 79 deploy: { 80 options: { 81 dojo: developmentDir+'client/dojo/dojo.js', 82 profile: developmentDir+'client/client.profile.js', 83 releaseDir: '../../../'+productionDir 84 } 85 } 64 build: { options: { dojo: srcDir+'client/dojo/dojo.js', 65 profile: srcDir+'client/client.profile.js', 66 releaseDir: '../../../'+buildDir }} 86 67 }, 87 68 htmlhint: { 88 options: { 89 htmlhintrc: srcDir+".htmlhintrc" 90 }, 91 compile: { 92 files: [{ 93 expand: true, 94 cwd: srcDir, 95 src: ['client/*.html', 'client/qed-client/**/*.html'] 96 }] 97 } 69 options: { htmlhintrc: srcDir+".htmlhintrc" }, 70 lint: { files: [{ expand: true, 71 cwd: srcDir, 72 src: ['client/*.html', 'client/qed-client/**/*.html'] }]} 98 73 }, 99 74 jshint: { 100 options: { 101 jshintrc: srcDir+".jshintrc" 102 }, 103 compile: { 104 files: [{ 105 expand: true, 106 cwd: srcDir, 107 src: ['client/qed-client/**/*.js', 'server/**.js'] 108 }] 109 } 75 'lint-sources': { options: { jshintrc: srcDir+".jshintrc" }, 76 files: { src: [ srcDir+'client/qed-client/**/*.js', srcDir+'server/**/*.js' ].concat(exclude(dest(coffeeMap))) }}, 77 'lint-generated': { options: { jshintrc: srcDir+".jshintrc-generated" }, 78 files: { src: dest(coffeeMap) }} 110 79 }, 111 80 less: { 112 options: { 113 strictImports: false, 114 dumpLineNumbers: "all" 115 }, 116 compile: { 117 files: [{ 118 expand: true, 119 cwd: srcDir, 120 src: ['client/qed-client/css/qed.less'], 121 dest: developmentDir, 122 ext: '.css' 123 }] 124 } 81 options: { strictImports: false, 82 dumpLineNumbers: "all" }, 83 compile: { files: lessMap } 84 }, 85 requirejs: { 86 basePath: srcDir+'client/', 87 packages: [ 88 { name: "dojo", location: "dojo" }, 89 { name: "dijit", location: "dijit" }, 90 { name: "dojox", location: "dojox" }, 91 { name: "qed-client", location: "qed-client" } 92 ] 93 }, 94 usebanner: { 95 'generated-css': { options: { position: 'top', 96 banner: '/* This CSS file is generated. All edits will be lost on recompile. */'}, 97 files: { src: dest(lessMap) }}, 98 'generated-js': { options: { position: 'top', 99 banner: '/* This JS file is generated, All edits will be lost on recompile. */'}, 100 files: { src: dest(coffeeMap) }} 125 101 } 126 102 }); 127 103 104 // LOAD TASKS 105 106 grunt.loadNpmTasks('grunt-amd-check'); 107 grunt.loadNpmTasks('grunt-banner'); 128 108 grunt.loadNpmTasks('grunt-coffeelint'); 129 109 grunt.loadNpmTasks('grunt-contrib-clean'); … … 134 114 grunt.loadNpmTasks('grunt-dojo'); 135 115 grunt.loadNpmTasks('grunt-htmlhint'); 116 grunt.loadTasks('./grunt-tasks'); 136 117 137 // development tasks 138 grunt.registerTask('install-deps', ['copy:server-deps', 'copy:client-deps']); 139 grunt.registerTask('lint', ['jshint:compile', 'htmlhint:compile', 'coffeelint:compile']); 140 grunt.registerTask('compile', ['lint', 'less:compile', 'coffee:compile', 'copy:compile']); 141 grunt.registerTask('build', ['clean:development', 'install-deps', 'compile']); 118 // UTIL FUNCTIONS 142 119 143 // production tasks 144 grunt.registerTask('deploy', ['clean:production', 'copy:deploy', 'dojo:deploy']); 120 function dest(files) { 121 return _.chain(files) 122 .map(function(item){ return item.dest; }) 123 .flatten() 124 .value(); 125 } 145 126 146 // default task is quick compile 147 grunt.registerTask('default', ['compile']); 148 149 // util functions 150 127 function exclude(dest) { 128 return _.map(dest, function(dest){ return '!'+dest; }); 129 } 130 151 131 }; -
Dev/trunk/package.json
r466 r469 14 14 "grunt-contrib-coffee": "~0.7.0", 15 15 "underscore": "~1.4.4", 16 "grunt-coffeelint": "0.0.6" 16 "grunt-coffeelint": "0.0.6", 17 "grunt-banner": "~0.1.4", 18 "grunt-amd-check": "~0.5.2" 17 19 } 18 20 } -
Dev/trunk/src/.jshintrc
r464 r469 3 3 "curly": true, 4 4 "eqeqeq": true, 5 "forin": true, 5 6 "immed": true, 6 7 "indent": 4, … … 8 9 "newcap": true, 9 10 "noarg": true, 11 "noempty": true, 10 12 "undef": true, 11 13 "unused": false, 12 14 "strict": false, 13 " laxcomma": true,15 "trailing": false, 14 16 15 17 "loopfunc": true, … … 17 19 "devel": true, 18 20 "node": true, 21 "browser": true, 22 "couch": true, 19 23 20 24 "globals": {
Note: See TracChangeset
for help on using the changeset viewer.