mirror of
https://github.com/photonstorm/phaser
synced 2024-11-15 01:17:43 +00:00
ce02d3402f
- Initial support for generating PIXI-combined documentation - Includes yuidoc-to-jsdoc for generating pixi-jsdoc.js - Creates doc (using pixidoc + builddoc) tasks - Adds sourceproxy JSDoc plugin to map in corrected file/line meta - Added yuidocjs as a dev-dependency
58 lines
No EOL
1.4 KiB
JavaScript
58 lines
No EOL
1.4 KiB
JavaScript
/**
|
|
* Generates the appropriate JSDoc from some (PIXI) YUIDoc.
|
|
* This could be turned into a more general pacakge.
|
|
*
|
|
* Requires: yuidocjs
|
|
*/
|
|
'use strict';
|
|
|
|
function generateYuiDoc (sourcePaths, grunt) {
|
|
|
|
var Y = require('yuidocjs');
|
|
|
|
var options = {
|
|
parseOnly: true,
|
|
quiet: true,
|
|
paths: sourcePaths
|
|
};
|
|
|
|
return (new Y.YUIDoc(options)).run();
|
|
}
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
grunt.registerTask('pixidoc', 'Generates JSDoc from the PIXI YUIdocs', function () {
|
|
|
|
var sources = ['C:/code/ph/phaser/src/pixi'];
|
|
var output = 'docs/pixi-jsdoc.js';
|
|
|
|
var yui2jsdoc = require('./yuidoc-to-jsdoc/converter');
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
// Right now yuidocsjs requires an absolute path so it emits an
|
|
// absolute path in the jsdoc (or the JSDoc will error on missing files)
|
|
sources = sources.map(function (source) {
|
|
return path.resolve(source);
|
|
});
|
|
|
|
var data = generateYuiDoc(sources);
|
|
|
|
if (!data) {
|
|
grunt.fail.warn("PIXI YUIDoc not generated - nothing to do")
|
|
return;
|
|
}
|
|
|
|
// Fake in namespace (current limitation)
|
|
var header =
|
|
"/**\n" +
|
|
"* @namespace PIXI\n" +
|
|
"*/";
|
|
|
|
var res = yui2jsdoc.convert(data);
|
|
var flat = res.join("\n");
|
|
fs.writeFileSync(output, header + "\n" + flat);
|
|
|
|
});
|
|
|
|
}; |