vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
2.6 KiB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
  1. /**
  2. * Jake build script
  3. */
  4. var jake = require('jake'),
  5. fs = require('fs'),
  6. path = require('path');
  7. require('jake-utils');
  8. /**
  9. * default task
  10. */
  11. desc('Execute all tasks: build all libraries');
  12. task('default', ['vis'], function () {
  13. console.log('done');
  14. });
  15. /**
  16. * vis.js, vis.css
  17. */
  18. desc('Build the visualization library vis.js');
  19. task('vis', function () {
  20. var VIS = './vis.js';
  21. var VIS_MIN = './vis.min.js';
  22. var VIS_CSS = './vis.css';
  23. // concatenate the script files
  24. concat({
  25. dest: VIS,
  26. src: [
  27. './src/header.js',
  28. './src/util.js',
  29. './src/events.js',
  30. './src/timestep.js',
  31. './src/dataset.js',
  32. './src/stack.js',
  33. './src/range.js',
  34. './src/controller.js',
  35. './src/component/component.js',
  36. './src/component/panel.js',
  37. './src/component/rootpanel.js',
  38. './src/component/timeaxis.js',
  39. './src/component/itemset.js',
  40. './src/component/item/*.js',
  41. './src/visualization/timeline.js',
  42. './lib/moment.js'
  43. ],
  44. separator: '\n'
  45. });
  46. // concatenate the css files
  47. concat({
  48. dest: VIS_CSS,
  49. src: [
  50. './src/component/css/panel.css',
  51. './src/component/css/item.css',
  52. './src/component/css/timeaxis.css'
  53. ],
  54. separator: '\n'
  55. });
  56. // minify javascript
  57. minify({
  58. src: VIS,
  59. dest: VIS_MIN,
  60. header: read('./src/header.js')
  61. });
  62. // update version number and stuff in the javascript files
  63. [VIS, VIS_MIN].forEach(function (file) {
  64. replace({
  65. replacements: [
  66. {pattern: '@@name', replacement: 'vis.js'},
  67. {pattern: '@@date', replacement: today()},
  68. {pattern: '@@version', replacement: version()}
  69. ],
  70. src: file
  71. });
  72. });
  73. console.log('created vis.js library');
  74. });
  75. /**
  76. * Recursively remove a directory and its files
  77. * https://gist.github.com/tkihira/2367067
  78. * @param {String} dir
  79. */
  80. var rmdir = function(dir) {
  81. var list = fs.readdirSync(dir);
  82. for(var i = 0; i < list.length; i++) {
  83. var filename = path.join(dir, list[i]);
  84. var stat = fs.statSync(filename);
  85. if(filename == "." || filename == "..") {
  86. // pass these files
  87. } else if(stat.isDirectory()) {
  88. // rmdir recursively
  89. rmdir(filename);
  90. } else {
  91. // rm fiilename
  92. fs.unlinkSync(filename);
  93. }
  94. }
  95. fs.rmdirSync(dir);
  96. };