contentful-sdk-jsdoc
Advanced tools
Comparing version 1.2.3 to 2.0.0
@@ -0,5 +1,5 @@ | ||
/*global env: true */ | ||
'use strict'; | ||
var doop = require('jsdoc/util/doop'); | ||
var env = require('jsdoc/env'); | ||
var fs = require('jsdoc/fs'); | ||
@@ -139,3 +139,2 @@ var helper = require('jsdoc/util/templateHelper'); | ||
var params = f.params ? addParamAttributes(f.params) : []; | ||
f.signature = util.format( '%s(%s)', (f.signature || ''), params.join(', ') ); | ||
@@ -210,7 +209,7 @@ } | ||
function generate(title, docs, filename, resolveLinks) { | ||
function generate(type, title, docs, filename, resolveLinks) { | ||
resolveLinks = resolveLinks === false ? false : true; | ||
var docData = { | ||
env: env, | ||
type: type, | ||
title: title, | ||
@@ -248,4 +247,3 @@ docs: docs | ||
generate('Source: ' + sourceFiles[file].shortened, [source], sourceOutfile, | ||
false); | ||
generate('Source', sourceFiles[file].shortened, [source], sourceOutfile, false); | ||
}); | ||
@@ -298,18 +296,42 @@ } | ||
if (items.length) { | ||
if (items && items.length) { | ||
var itemsNav = ''; | ||
items.forEach(function(item) { | ||
var methods = find({kind:'function', memberof: item.longname}); | ||
var members = find({kind:'member', memberof: item.longname}); | ||
var docdash = env && env.conf && env.conf.docdash || {}; | ||
if ( !hasOwnProp.call(item, 'longname') ) { | ||
itemsNav += '<li>' + linktoFn('', item.name) + '</li>'; | ||
} | ||
else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { | ||
var displayName; | ||
if (env.conf.templates.default.useLongnameInNav) { | ||
displayName = item.longname; | ||
} else { | ||
displayName = item.name; | ||
itemsNav += '<li>' + linktoFn('', item.name); | ||
itemsNav += '</li>'; | ||
} else if ( !hasOwnProp.call(itemsSeen, item.longname) ) { | ||
itemsNav += '<li>' + linktoFn(item.longname, item.name.replace(/^module:/, '')); | ||
if (docdash.static && members.find(function (m) { return m.scope === 'static'; } )) { | ||
itemsNav += "<ul class='members'>"; | ||
members.forEach(function (member) { | ||
if (!member.scope === 'static') return; | ||
itemsNav += "<li data-type='member'>"; | ||
itemsNav += linkto(member.longname, member.name); | ||
itemsNav += "</li>"; | ||
}); | ||
itemsNav += "</ul>"; | ||
} | ||
itemsNav += '<li>' + linktoFn(item.longname, displayName.replace(/\b(module|event):/g, '')) + '</li>'; | ||
if (methods.length) { | ||
itemsNav += "<ul class='methods'>"; | ||
methods.forEach(function (method) { | ||
itemsNav += "<li data-type='method'>"; | ||
itemsNav += linkto(method.longname, method.name); | ||
itemsNav += "</li>"; | ||
}); | ||
itemsNav += "</ul>"; | ||
} | ||
itemsNav += '</li>'; | ||
itemsSeen[item.longname] = true; | ||
@@ -347,4 +369,6 @@ } | ||
* @param {array<object>} members.interfaces | ||
* @return {string} The HTML for the navigation sidebar. | ||
* @return {s | ||
ring} The HTML for the navigation sidebar. | ||
*/ | ||
function buildNav(members) { | ||
@@ -355,5 +379,5 @@ var nav = '<h2><a href="index.html">Home</a></h2>'; | ||
nav += buildMemberNav(members.classes, 'Classes', seen, linkto); | ||
nav += buildMemberNav(members.modules, 'Modules', {}, linkto); | ||
nav += buildMemberNav(members.externals, 'Externals', seen, linktoExternal); | ||
nav += buildMemberNav(members.classes, 'Classes', seen, linkto); | ||
nav += buildMemberNav(members.events, 'Events', seen, linkto); | ||
@@ -393,2 +417,3 @@ nav += buildMemberNav(members.namespaces, 'Namespaces', seen, linkto); | ||
exports.publish = function(taffyData, opts, tutorials) { | ||
var docdash = env && env.conf && env.conf.docdash || {}; | ||
data = taffyData; | ||
@@ -420,3 +445,4 @@ | ||
data = helper.prune(data); | ||
data.sort('longname, version, since'); | ||
docdash.sort !== false && data.sort('longname, version, since'); | ||
helper.addEventListeners(data); | ||
@@ -468,3 +494,2 @@ | ||
outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') ); | ||
env.package = packageInfo; | ||
} | ||
@@ -497,7 +522,4 @@ fs.mkPath(outdir); | ||
staticFilePaths.forEach(function(filePath) { | ||
var extraStaticFiles; | ||
var extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); | ||
filePath = path.resolve(env.pwd, filePath); | ||
extraStaticFiles = staticFileScanner.scan([filePath], 10, staticFileFilter); | ||
extraStaticFiles.forEach(function(fileName) { | ||
@@ -567,4 +589,5 @@ var sourcePath = fs.toDir(filePath); | ||
// output pretty-printed source files by default | ||
var outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false ? true : | ||
false; | ||
var outputSourceFiles = conf.default && conf.default.outputSourceFiles !== false | ||
? true | ||
: false; | ||
@@ -588,9 +611,11 @@ // add template helpers | ||
if (members.globals.length) { generate('Global', [{kind: 'globalobj'}], globalUrl); } | ||
if (members.globals.length) { | ||
generate('', 'Global', [{kind: 'globalobj'}], globalUrl); | ||
} | ||
// index page displays information from package.json and lists files | ||
var files = find({kind: 'file'}), | ||
packages = find({kind: 'package'}); | ||
var files = find({kind: 'file'}); | ||
var packages = find({kind: 'package'}); | ||
generate(opts.mainpagetitle || 'Home', | ||
generate('', 'Home', | ||
packages.concat( | ||
@@ -612,3 +637,3 @@ [{kind: 'mainpage', readme: opts.readme, longname: (opts.mainpagetitle) ? opts.mainpagetitle : 'Main Page'}] | ||
if (myModules.length) { | ||
generate('Module: ' + myModules[0].name, myModules, helper.longnameToUrl[longname]); | ||
generate('Module', myModules[0].name, myModules, helper.longnameToUrl[longname]); | ||
} | ||
@@ -618,3 +643,3 @@ | ||
if (myClasses.length) { | ||
generate('Class: ' + myClasses[0].name, myClasses, helper.longnameToUrl[longname]); | ||
generate('Class', myClasses[0].name, myClasses, helper.longnameToUrl[longname]); | ||
} | ||
@@ -624,3 +649,3 @@ | ||
if (myNamespaces.length) { | ||
generate('Namespace: ' + myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]); | ||
generate('Namespace', myNamespaces[0].name, myNamespaces, helper.longnameToUrl[longname]); | ||
} | ||
@@ -630,3 +655,3 @@ | ||
if (myMixins.length) { | ||
generate('Mixin: ' + myMixins[0].name, myMixins, helper.longnameToUrl[longname]); | ||
generate('Mixin', myMixins[0].name, myMixins, helper.longnameToUrl[longname]); | ||
} | ||
@@ -636,3 +661,3 @@ | ||
if (myExternals.length) { | ||
generate('External: ' + myExternals[0].name, myExternals, helper.longnameToUrl[longname]); | ||
generate('External', myExternals[0].name, myExternals, helper.longnameToUrl[longname]); | ||
} | ||
@@ -642,3 +667,3 @@ | ||
if (myInterfaces.length) { | ||
generate('Interface: ' + myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]); | ||
generate('Interface', myInterfaces[0].name, myInterfaces, helper.longnameToUrl[longname]); | ||
} | ||
@@ -656,8 +681,7 @@ }); | ||
var tutorialPath = path.join(outdir, filename), | ||
html = view.render('tutorial.tmpl', tutorialData); | ||
var tutorialPath = path.join(outdir, filename); | ||
var html = view.render('tutorial.tmpl', tutorialData); | ||
// yes, you can use {@link} in tutorials too! | ||
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a> | ||
fs.writeFileSync(tutorialPath, html, 'utf8'); | ||
@@ -673,3 +697,4 @@ } | ||
} | ||
saveChildren(tutorials); | ||
}; |
{ | ||
"name": "contentful-sdk-jsdoc", | ||
"version":"2.0.0", | ||
"description": "JSDoc template and config for the Contentful JS SDKs", | ||
@@ -22,5 +23,5 @@ "homepage": "https://www.contentful.com/developers/docs/javascript/", | ||
"devDependencies": { | ||
"cz-conventional-changelog": "^1.1.5", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"jsdoc": "^3.4.0", | ||
"semantic-release": "^4.3.5" | ||
"semantic-release": "^6.3.2" | ||
}, | ||
@@ -31,4 +32,3 @@ "config": { | ||
} | ||
}, | ||
"version": "1.2.3" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1285
88711
28
2