diff --git a/bin/cli.js b/bin/cli.js index d103335..16b9f7c 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -2,7 +2,6 @@ import commandLineArgs from 'command-line-args' import commandLineUsage from 'command-line-usage' import jsdoc2md from 'jsdoc-to-markdown' -import omit from 'lodash.omit' import assert from 'assert' import fs from 'fs' import loadConfig from 'config-master' @@ -33,7 +32,8 @@ if (options.help) { /* jsdoc2md --config */ if (options.config) { - console.log(JSON.stringify(omit(options, 'config'), null, ' ')) + delete options.config + console.log(JSON.stringify(options, null, ' ')) process.exit(0) } diff --git a/dist/index.cjs b/dist/index.cjs index c4a10e3..a0b2ed3 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -111,8 +111,9 @@ class JsdocToMarkdown { * @returns {Promise} * @category async */ - clear () { - return jsdocApi.cache.clear().then(() => dmd.cache.clear()) + async clear () { + await jsdocApi.cache.clear(); + await dmd.cache.clear(); } /** @@ -121,23 +122,19 @@ class JsdocToMarkdown { * @returns {object} * @category async */ - getNamepaths (options) { - return this.getTemplateData(options) - .then(data => { - const namepaths = {}; - const kinds = [ - 'module', 'class', 'constructor', 'mixin', 'member', - 'namespace', 'constant', 'function', 'event', 'typedef', 'external' - ]; - kinds.forEach(kind => { - namepaths[kind] = data - .filter(identifier => { - return identifier.kind === kind - }) - .map(identifier => identifier.longname); - }); - return namepaths - }) + async getNamepaths (options) { + const data = await this.getTemplateData(options); + const namepaths = {}; + const kinds = [ + 'module', 'class', 'constructor', 'mixin', 'member', + 'namespace', 'constant', 'function', 'event', 'typedef', 'external' + ]; + for (const kind of kinds) { + namepaths[kind] = data + .filter(identifier => identifier.kind === kind) + .map(identifier => identifier.longname); + } + return namepaths } } diff --git a/index.js b/index.js index 8decaaf..727a716 100644 --- a/index.js +++ b/index.js @@ -90,8 +90,9 @@ class JsdocToMarkdown { * @returns {Promise} * @category async */ - clear () { - return jsdocApi.cache.clear().then(() => dmd.cache.clear()) + async clear () { + await jsdocApi.cache.clear() + await dmd.cache.clear() } /** @@ -100,23 +101,19 @@ class JsdocToMarkdown { * @returns {object} * @category async */ - getNamepaths (options) { - return this.getTemplateData(options) - .then(data => { - const namepaths = {} - const kinds = [ - 'module', 'class', 'constructor', 'mixin', 'member', - 'namespace', 'constant', 'function', 'event', 'typedef', 'external' - ] - kinds.forEach(kind => { - namepaths[kind] = data - .filter(identifier => { - return identifier.kind === kind - }) - .map(identifier => identifier.longname) - }) - return namepaths - }) + async getNamepaths (options) { + const data = await this.getTemplateData(options) + const namepaths = {} + const kinds = [ + 'module', 'class', 'constructor', 'mixin', 'member', + 'namespace', 'constant', 'function', 'event', 'typedef', 'external' + ] + for (const kind of kinds) { + namepaths[kind] = data + .filter(identifier => identifier.kind === kind) + .map(identifier => identifier.longname) + } + return namepaths } } diff --git a/package-lock.json b/package-lock.json index 2f0d0b9..f013cf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "command-line-args": "^6.0.0", "command-line-usage": "^7.0.3", "config-master": "^3.1.0", - "dmd": "next", + "dmd": "^7.0.0", "jsdoc-api": "^9.3.0", "jsdoc-parse": "^6.2.3", "walk-back": "^5.1.1" @@ -345,9 +345,9 @@ } }, "node_modules/dmd": { - "version": "7.0.0-3", - "resolved": "https://registry.npmjs.org/dmd/-/dmd-7.0.0-3.tgz", - "integrity": "sha512-tm3idP7m02bUkmurbX3d+JJp2zwGAdTfc011Xxzq322+XmgWYv7/vGlurO3yMpC3KI/GpNtFfocUPg61e8+LUQ==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/dmd/-/dmd-7.0.0.tgz", + "integrity": "sha512-VfttRYZmGDidK7aBrcHHt+HQ9iD5waNH9v4q4PRFlBEYdXwdVMmSLayXNu3KzTW3JXgmNiX3eTuMbqk3ioAkjg==", "license": "MIT", "dependencies": { "array-back": "^6.2.2", @@ -358,7 +358,6 @@ "marked": "^14.1.0", "object-get": "^2.1.1", "reduce-unique": "^2.0.1", - "test-value": "^3.0.0", "walk-back": "^5.1.1" }, "engines": { @@ -937,37 +936,6 @@ "node": ">=12.17" } }, - "node_modules/test-value": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/test-value/-/test-value-3.0.0.tgz", - "integrity": "sha512-sVACdAWcZkSU9x7AOmJo5TqE+GyNJknHaHsMrR6ZnhjVlVN9Yx6FjHrsKZ3BjIpPCT68zYesPWkakrNupwfOTQ==", - "license": "MIT", - "dependencies": { - "array-back": "^2.0.0", - "typical": "^2.6.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/test-value/node_modules/array-back": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", - "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", - "license": "MIT", - "dependencies": { - "typical": "^2.6.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/test-value/node_modules/typical": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", - "integrity": "sha512-ofhi8kjIje6npGozTip9Fr8iecmYfEbS06i0JnIg+rh51KakryWF4+jX8lLKZVhy6N+ID45WYSFCxPOdTWCzNg==", - "license": "MIT" - }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", diff --git a/package.json b/package.json index 542e84c..b4ce886 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "command-line-args": "^6.0.0", "command-line-usage": "^7.0.3", "config-master": "^3.1.0", - "dmd": "next", + "dmd": "^7.0.0", "jsdoc-api": "^9.3.0", "jsdoc-parse": "^6.2.3", "walk-back": "^5.1.1"