Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

73 lines
1.9KB

  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". To build the documentation, run "jake docs".
  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. buildDocs = require('./build/docs'),
  12. git = require('git-rev');
  13. function hint(msg, args) {
  14. return function () {
  15. console.log(msg);
  16. jake.exec('node node_modules/eslint/bin/eslint.js ' + args,
  17. {printStdout: true}, function () {
  18. console.log('\tCheck passed.\n');
  19. complete();
  20. });
  21. };
  22. }
  23. // Returns the version string in package.json, plus a semver build metadata if
  24. // this is not an official release
  25. function calculateVersion(officialRelease, callback) {
  26. var version = require('./package.json').version;
  27. if (officialRelease) {
  28. callback(version);
  29. } else {
  30. git.short(function(str) {
  31. callback (version + '+' + str);
  32. });
  33. }
  34. }
  35. desc('Check Leaflet source for errors with ESLint');
  36. task('lint', {async: true}, hint('Checking for JS errors...', 'src'));
  37. desc('Check Leaflet specs source for errors with ESLint');
  38. task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/suites'));
  39. desc('Combine and compress Leaflet source files');
  40. task('build', {async: true}, function (compsBase32, buildName, officialRelease) {
  41. calculateVersion(officialRelease, function(v){
  42. build.build(complete, v, compsBase32, buildName);
  43. });
  44. });
  45. desc('Run PhantomJS tests');
  46. task('test', ['lint', 'lintspec'], {async: true}, function () {
  47. build.test(complete);
  48. });
  49. desc('Build documentation');
  50. task('docs', {}, function() {
  51. buildDocs();
  52. });
  53. task('default', ['test', 'build']);
  54. jake.addListener('complete', function () {
  55. process.exit();
  56. });