Leaflet/Jakefile.js

73 lines
1.9 KiB
JavaScript
Raw Normal View History

2012-12-18 01:15:19 +08:00
/*
2013-02-01 21:17:08 +08:00
Leaflet building, testing and linting scripts.
2011-12-12 08:32:53 +08:00
2012-12-18 01:15:19 +08:00
To use, install Node, then run the following commands in the project root:
2011-12-12 08:32:53 +08:00
2012-12-18 01:15:19 +08:00
npm install -g jake
2013-02-08 01:00:15 +08:00
npm install
2012-07-12 15:39:22 +08:00
2013-02-08 01:00:15 +08:00
To check the code for errors and build Leaflet from source, run "jake".
Trying out Leafdoc comments in L.Marker Added Leafdoc comments to Layer.js Leafdoc comments for Popup, Layer Leafdoc comments: L.Evented, inheritances, minor tilelayer Leafdoc comments: gridlayer & tilelayer options Leafdoc comments: tilelayer, marker drag Typos Leafdoc: switch to shorthand method params Leafdoc: Switch to shorthands in marker drag, WMS. Leafdoc: Vector layers Leafdoc: Layer group, feature group, geojson Leafdoc: LatLng, Point, Bounds, Icons. Leafdoc: Controls. Leafdoc: DOM & utils. Leafdoc: "jake docs" now builds the documentation Leafdoc: Commit actual templates instead of symlinks Leafdoc: Fix broken build, have jake print out uglifyjs errors Leafdoc: Several L.Map bits. Leafdoc: Map handlers Leafdoc: Map events, L.CRS, misc. fixes Leafdoc: Fixed ordering of classes by using new leafdoc features Leafdoc: Misc bits at the bottom of the docs 🍂doc: Map panes 🍂doc: CRSs, projections and their templates 🍂doc: miniclasses for map methods' options Leafdoc: Cleanup L.Class, mark uninheritable sections, use Leafdoc 0.3.0 🍂doc: miniclasses for event types, bump to Leafdoc 1.0.0 🍂doc: Make linter happy after branch rebase 🍂doc: Tweaked headers for inherited stuff. 🍂doc: Tweaking section headers (white, padding, triangles) Leafdoc: upgrade to 1.2, document SVG&Canvas, and misc bits 🍂doc: minor CSS tweaks, version in filename, typo. Add missing bits - supersedes #4105, #4065, #4031 🍂doc: moved sections around, minor typos & fixes Typo about LocationEvent
2015-08-13 02:51:04 +08:00
To run the tests, run "jake test". To build the documentation, run "jake docs".
2012-02-13 22:25:57 +08:00
2012-12-18 01:15:19 +08:00
For a custom build, open build/build.html in the browser and follow the instructions.
*/
2012-02-13 22:25:57 +08:00
var build = require('./build/build.js'),
Trying out Leafdoc comments in L.Marker Added Leafdoc comments to Layer.js Leafdoc comments for Popup, Layer Leafdoc comments: L.Evented, inheritances, minor tilelayer Leafdoc comments: gridlayer & tilelayer options Leafdoc comments: tilelayer, marker drag Typos Leafdoc: switch to shorthand method params Leafdoc: Switch to shorthands in marker drag, WMS. Leafdoc: Vector layers Leafdoc: Layer group, feature group, geojson Leafdoc: LatLng, Point, Bounds, Icons. Leafdoc: Controls. Leafdoc: DOM & utils. Leafdoc: "jake docs" now builds the documentation Leafdoc: Commit actual templates instead of symlinks Leafdoc: Fix broken build, have jake print out uglifyjs errors Leafdoc: Several L.Map bits. Leafdoc: Map handlers Leafdoc: Map events, L.CRS, misc. fixes Leafdoc: Fixed ordering of classes by using new leafdoc features Leafdoc: Misc bits at the bottom of the docs 🍂doc: Map panes 🍂doc: CRSs, projections and their templates 🍂doc: miniclasses for map methods' options Leafdoc: Cleanup L.Class, mark uninheritable sections, use Leafdoc 0.3.0 🍂doc: miniclasses for event types, bump to Leafdoc 1.0.0 🍂doc: Make linter happy after branch rebase 🍂doc: Tweaked headers for inherited stuff. 🍂doc: Tweaking section headers (white, padding, triangles) Leafdoc: upgrade to 1.2, document SVG&Canvas, and misc bits 🍂doc: minor CSS tweaks, version in filename, typo. Add missing bits - supersedes #4105, #4065, #4031 🍂doc: moved sections around, minor typos & fixes Typo about LocationEvent
2015-08-13 02:51:04 +08:00
buildDocs = require('./build/docs'),
2016-04-18 16:10:27 +08:00
git = require('git-rev');
2012-02-13 22:25:57 +08:00
2015-01-29 01:33:45 +08:00
function hint(msg, args) {
return function () {
console.log(msg);
2015-01-29 01:33:45 +08:00
jake.exec('node node_modules/eslint/bin/eslint.js ' + args,
{printStdout: true}, function () {
console.log('\tCheck passed.\n');
complete();
});
};
}
2016-04-18 16:10:27 +08:00
// Returns the version string in package.json, plus a semver build metadata if
// this is not an official release
function calculateVersion(officialRelease, callback) {
var version = require('./package.json').version;
if (officialRelease) {
callback(version);
} else {
git.short(function(str) {
callback (version + '+' + str);
});
}
}
2015-01-29 01:33:45 +08:00
desc('Check Leaflet source for errors with ESLint');
task('lint', {async: true}, hint('Checking for JS errors...', 'src'));
2015-01-29 01:33:45 +08:00
desc('Check Leaflet specs source for errors with ESLint');
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/suites'));
2011-12-13 03:48:20 +08:00
desc('Combine and compress Leaflet source files');
2016-04-18 16:10:27 +08:00
task('build', {async: true}, function (compsBase32, buildName, officialRelease) {
calculateVersion(officialRelease, function(v){
build.build(complete, v, compsBase32, buildName);
});
});
2013-02-01 21:17:08 +08:00
desc('Run PhantomJS tests');
task('test', ['lint', 'lintspec'], {async: true}, function () {
build.test(complete);
});
Trying out Leafdoc comments in L.Marker Added Leafdoc comments to Layer.js Leafdoc comments for Popup, Layer Leafdoc comments: L.Evented, inheritances, minor tilelayer Leafdoc comments: gridlayer & tilelayer options Leafdoc comments: tilelayer, marker drag Typos Leafdoc: switch to shorthand method params Leafdoc: Switch to shorthands in marker drag, WMS. Leafdoc: Vector layers Leafdoc: Layer group, feature group, geojson Leafdoc: LatLng, Point, Bounds, Icons. Leafdoc: Controls. Leafdoc: DOM & utils. Leafdoc: "jake docs" now builds the documentation Leafdoc: Commit actual templates instead of symlinks Leafdoc: Fix broken build, have jake print out uglifyjs errors Leafdoc: Several L.Map bits. Leafdoc: Map handlers Leafdoc: Map events, L.CRS, misc. fixes Leafdoc: Fixed ordering of classes by using new leafdoc features Leafdoc: Misc bits at the bottom of the docs 🍂doc: Map panes 🍂doc: CRSs, projections and their templates 🍂doc: miniclasses for map methods' options Leafdoc: Cleanup L.Class, mark uninheritable sections, use Leafdoc 0.3.0 🍂doc: miniclasses for event types, bump to Leafdoc 1.0.0 🍂doc: Make linter happy after branch rebase 🍂doc: Tweaked headers for inherited stuff. 🍂doc: Tweaking section headers (white, padding, triangles) Leafdoc: upgrade to 1.2, document SVG&Canvas, and misc bits 🍂doc: minor CSS tweaks, version in filename, typo. Add missing bits - supersedes #4105, #4065, #4031 🍂doc: moved sections around, minor typos & fixes Typo about LocationEvent
2015-08-13 02:51:04 +08:00
desc('Build documentation');
task('docs', {}, function() {
buildDocs();
});
task('default', ['test', 'build']);
2013-01-30 22:06:19 +08:00
jake.addListener('complete', function () {
process.exit();
});