5

I have an issue with npm and jsdoc. This question is similar to, but not the same as: How do I get my npm module's JSdoc documentation for functions to show up in users' VScode? In my case, the jsdoc info will appear if install the code in a local folder. The issue appears when I use npm install and the code is installed in node_modules.

I have created an npm module that standardizes access to couchdb and cloudant using SQL-like commands (insert, select, update, etc. Every function is prefaced with jsdoc comments, but when this module is require(rddill/cloudant all that shows up when one hovers over it is "any".

  • code from top of module (index.js):
/**
 * CoachCloudant module
 * @module rddill/cloudant
 */

'use strict';
let request = require('request');
let fs = require('fs');
let path = require('path');

module.exports = {
  cloudantAuth: {},
  noSQLCreds: {},
  _credentials: {},

  /**
  * add code to handle IAM based authentication.
  * use test to determine approach.
  * if (typeof (_credentials.apikey !== 'undefined')) {then use IAM, else use existing}
  */

  /**
  * used to set credentials for either Cloudant or CouchDB. This is required because the URL structure for the two
  * databases is different.
  * The passed in JSON structure has an element called 'useCouchDB'. If this value is true, then couchDB is used
  * if this value is false, then Cloudant is used.
  * if this value is null, undefined, or a value other than true or false, then _credentials is set to null
  * and the function returns false.
  * This function returns true on success
  * @returns {Boolean} true on success, false on failure
  */
  setCreds: function() {

I would expect that VSCode would pick this up, but it doesn't. If I simply copy the single js file from the npm module into the project that I'm working on and include it as a local project file, then all of the jsdoc info shows up instantly.

I'm guessing that I'm making a novice error with the npm publish process: npm publish --access public, but sure would like some help. Thanks!

Bob Dill
  • 938
  • 4
  • 12

0 Answers0