Leaflet/build/docs.js
Andrew e3b049cefd Chore(scripts): Remove jake dependency and use NPM scripts instead (#5828)
* run `docs` via npm

* add shebang line to integrity.js, so npm will resolve node binary automatically

* remove unnecessary build-jake npm script

* add test.js script as replacement of Jakefile.js

* remove Jakefile, remove jake from devDependencies

* update docs

* move scripts to separate directory

* change shebang line from nodejs to js

* change shebang line from js to node

* update docs

* use Karma cli instead of custom test script

* add pretest and test-nolint scripts, remove lint scripts from travis.ci

Run linting scripts in pretest script, this way test script will automatically trigger code linting.

Add test-nolint script to have possibility to run tests without triggering pretest script with linting. This is useful when running tests in different browsers and tere's no sense to lint code more than one time

* replace shebang lines with node executable in npm scripts

* remove note about nodejs symlink in CONTRIBUTING.md
2018-02-05 11:15:32 +04:00

41 lines
1.1 KiB
JavaScript
Executable File

var packageDef = require('../package.json');
function buildDocs() {
console.log('Building Leaflet documentation with Leafdoc');
var LeafDoc = require('leafdoc');
var doc = new LeafDoc({
templateDir: 'build/leafdoc-templates',
showInheritancesWhenEmpty: true,
leadingCharacter: '@'
});
// Note to Vladimir: Iván's never gonna uncomment the following line. He's
// too proud of the little leaves around the code.
//doc.setLeadingChar('@');
// Leaflet uses a couple of non-standard documentable things. They are not
// important enough to be classes/namespaces of their own, and should
// just be listed in a table like the rest of documentables:
doc.registerDocumentable('pane', 'Map panes');
doc.registerDocumentable('projection', 'Defined projections');
doc.registerDocumentable('crs', 'Defined CRSs');
doc.addFile('build/docs-index.leafdoc', false);
doc.addDir('src');
doc.addFile('build/docs-misc.leafdoc', false);
var out = doc.outputStr();
var fs = require('fs');
fs.writeFileSync('dist/reference-' + packageDef.version + '.html', out);
}
if (require.main === module) {
buildDocs();
} else {
module.exports = buildDocs;
}