mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Always making source file list available to templates
Previously, the list of source files was only added to a package doclet and passed through to the templates if there was a package.json specified. Now, that doclet is always added. If there is no package.json, then only the 'files' property of the doclet will be defined.
This commit is contained in:
parent
279554f1a3
commit
7b12033b5a
10
jsdoc.js
10
jsdoc.js
@ -213,11 +213,11 @@ function main() {
|
||||
|
||||
docs = app.jsdoc.parser.parse(sourceFiles, env.opts.encoding);
|
||||
|
||||
if (packageJson) {
|
||||
var packageDocs = new (require('jsdoc/package').Package)(packageJson);
|
||||
packageDocs.files = sourceFiles || [];
|
||||
docs.push(packageDocs);
|
||||
}
|
||||
//The files are ALWAYS useful for the templates to have
|
||||
//If there is no package.json, just create an empty package
|
||||
var packageDocs = new (require('jsdoc/package').Package)(packageJson);
|
||||
packageDocs.files = sourceFiles || [];
|
||||
docs.push(packageDocs);
|
||||
|
||||
function indexAll(docs) {
|
||||
var lookupTable = {};
|
||||
|
||||
@ -15,6 +15,8 @@
|
||||
@param {string} json - The contents of package.json.
|
||||
*/
|
||||
exports.Package = function(json) {
|
||||
json = json || "{}";
|
||||
|
||||
/** The source files associated with this package.
|
||||
@type {Array<String>}
|
||||
*/
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
namespaces = find({kind: 'namespace'});
|
||||
|
||||
var outdir = opts.destination;
|
||||
if (packageInfo) {
|
||||
if (packageInfo && packageInfo.name) {
|
||||
outdir += '/' + packageInfo.name + '/' + packageInfo.version + '/';
|
||||
}
|
||||
fs.mkPath(outdir);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user