Gruntfile.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. var path = require('path');
  4. // These plugins provide necessary tasks.
  5. grunt.loadNpmTasks('grunt-contrib-requirejs');
  6. grunt.loadNpmTasks('amber-dev');
  7. // Default task.
  8. grunt.registerTask('default', ['amberc:all']);
  9. grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
  10. grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
  11. // Project configuration.
  12. grunt.initConfig({
  13. // Metadata.
  14. // pkg: grunt.file.readJSON(''),
  15. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  16. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  17. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  18. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  19. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  20. // task configuration
  21. amberc: {
  22. options: {
  23. amber_dir: path.join(__dirname, "bower_components", "amber"),
  24. library_dirs: ['src'],
  25. closure_jar: ''
  26. },
  27. all: {
  28. src: [
  29. 'src/Benchfib.st', 'src/Examples.st', 'src/IDE.st' // list all sources in dependency order
  30. // list all tests in dependency order
  31. ],
  32. amd_namespace: 'amber-attic',
  33. libraries: ['Web']
  34. }
  35. },
  36. amdconfig: {app: {dest: 'config.js'}},
  37. requirejs: {
  38. deploy: {options: {
  39. mainConfigFile: "config.js",
  40. onBuildWrite: function (moduleName, path, contents) {
  41. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  42. },
  43. pragmas: {
  44. excludeIdeData: true,
  45. excludeDebugContexts: true
  46. },
  47. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  48. out: "the.js"
  49. }},
  50. devel: {options: {
  51. mainConfigFile: "config.js",
  52. onBuildWrite: function (moduleName, path, contents) {
  53. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  54. },
  55. include: ['config', 'node_modules/requirejs/require'],
  56. out: "the.js"
  57. }}
  58. }
  59. });
  60. };