Skip to content

Commit

Permalink
Rewriting documentation using Leafdoc, introducing Leaflet' build pro…
Browse files Browse the repository at this point in the history
…cess, switching to eslint
  • Loading branch information
Jon West committed Nov 5, 2016
1 parent 22db393 commit ad7befd
Show file tree
Hide file tree
Showing 121 changed files with 7,956 additions and 1,046 deletions.
20 changes: 20 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"rules": {
"no-unused-vars": 0,
"quotes": 0,
"no-shadow": 0,
"no-irregular-whitespace": 0,
"no-console": 0,
"no-extend-native": 0
},
"env": {
"mocha": true
},
"globals": {
"expect": false,
"sinon": false,
"happen": false,
"Hand": false,
"takeScreenshot": true
}
}
24 changes: 24 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- [ ] I'm reporting a bug, not asking for help
- [ ] I've looked at the [documentation](http://leaflet.github.io/Leaflet.draw/dist/reference-0.4.1.html) to make sure the behaviour is documented and expected
- [ ] I'm sure this is a Leaflet Draw code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
- [ ] I've searched through the issues to make sure it's not yet reported

----

## How to reproduce

- Leaflet version I'm using:
- Leaflet Draw version I'm using:
- Browser (with version) I'm using:
- OS/Platform (with version) I'm using:
- step 1
- step 2

## What behaviour I'm expecting and which behaviour I'm seeing

## Minimal example reproducing the issue

- [ ] this example is as simple as possible
- [ ] this example does not rely on any third party code

Using [jsfiddle](https://jsfiddle.net/ddproxy/mvp7hgou/) or another example site.
68 changes: 46 additions & 22 deletions Jakefile.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,70 @@
/*
Leaflet.draw building and linting scripts.
Leaflet.draw building and linting scripts.
To use, install Node, then run the following commands in the project root:
To use, install Node, then run the following commands in the project root:
npm install -g jake
npm install
npm install -g jake
npm install
To check the code for errors and build Leaflet from source, run "jake".
To run the tests, run "jake test".
To check the code for errors and build Leaflet from source, run "jake".
To run the tests, run "jake test". To build the documentation, run "jake docs".
For a custom build, open build/build.html in the browser and follow the instructions.
*/
For a custom build, open build/build.html in the browser and follow the instructions.
*/

var build = require('./build/build.js');
var build = require('./build/build.js'),
buildDocs = require('./build/docs'),
git = require('git-rev');

function hint(msg, paths) {
function hint(msg, args) {
return function () {
console.log(msg);
jake.exec('node node_modules/jshint/bin/jshint -c ' + paths,
{printStdout: true}, function () {
console.log('\tCheck passed.\n');
complete();
});
jake.exec('node node_modules/eslint/bin/eslint.js ' + args,
{printStdout: true}, function () {
console.log('\tCheck passed.\n');
complete();
});
};
}

desc('Check Leaflet.draw source for errors with JSHint');
task('lint', {async: true}, hint('Checking for JS errors...', 'build/hintrc.js src'));
// 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);
});
}
}


desc('Check Leaflet.draw source for errors with ESHint');
task('lint', {async: true}, hint('Checking for JS errors...', 'src'));

desc('Check Leaflet.draw specs source for errors with JSHint');
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/spec.hintrc.js spec/suites'));
desc('Check Leaflet.draw specs source for errors with ESLint');
task('lintspec', {async: true}, hint('Checking for specs JS errors...', 'spec/suites'));

desc('Combine and compress Leaflet.draw source files');
task('build', {async: true}, function () {
build.build(complete);
desc('Combine and compress Leaflet Draw source files');
task('build', {async: true}, function (compsBase32, buildName, officialRelease) {
calculateVersion(officialRelease, function (v) {
build.build(complete, v, compsBase32, buildName);
});
});

desc('Run PhantomJS tests');
task('test', ['lint', 'lintspec'], {async: true}, function () {
build.test(complete);
});

desc('Build documentation');
task('docs', {}, function () {
buildDocs();
});

task('default', ['test', 'build']);

jake.addListener('complete', function () {
Expand Down
2 changes: 1 addition & 1 deletion MIT-LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2012-2016 Jacob Toye and Leaflet
Copyright 2012-2017 Jacob Toye and Leaflet

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
Loading

0 comments on commit ad7befd

Please sign in to comment.