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.

49 lines
1.3KB

  1. /*
  2. Leaflet building, testing and linting scripts.
  3. To use, install Node, then run the following commands in the project root:
  4. npm install -g jake
  5. npm install
  6. To check the code for errors and build Leaflet from source, run "jake".
  7. To run the tests, run "jake test".
  8. For a custom build, open build/build.html in the browser and follow the instructions.
  9. */
  10. var build = require('./build/build.js');
  11. function hint(msg, paths) {
  12. return function () {
  13. console.log(msg);
  14. jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
  15. {printStdout: true}, function () {
  16. console.log('\tCheck passed.\n');
  17. complete();
  18. });
  19. }
  20. }
  21. desc('Check Leaflet source for errors with JSHint');
  22. task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
  23. desc('Check Leaflet specs source for errors with JSHint');
  24. task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
  25. desc('Combine and compress Leaflet source files');
  26. task('build', {async: true}, function () {
  27. build.build(complete);
  28. });
  29. desc('Run PhantomJS tests');
  30. task('test', ['lint', 'lintspec'], {async: true}, function () {
  31. build.test(complete);
  32. });
  33. task('default', ['test', 'build']);
  34. jake.addListener('complete', function () {
  35. process.exit();
  36. });