Skip to content

Commit

Permalink
global config property to ignore private members
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Wehrstedt committed Jan 16, 2018
1 parent 7c454de commit 2d3193c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Changelog

# v0.8.6
New features in this release:
- You can ignore private members by default by adding the property "ignorePrivateMembers"
to the jsconfig.json

# v0.8.3
Bugfixes:
- Not all supported items were added to their parent member
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $> jsdoc -d <target-dir>/<filename>.d.ts
**Important: If you want to change the file name of the result file your path has to end with the file ending ```d.ts```**

## Options
* **ignorePrivateMembers** Determines if private members should be omitted or not
* **ignoreScopes** Array with scope names which should not be parsed. Possible values
```
[
Expand Down Expand Up @@ -75,6 +76,7 @@ module.exports = function(taggedVersion, latestVersion) {
* @interface
* @since
* @module (function and variable declarations)
* @private (not completed yet)

## Ignored Tags
* @file
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@otris/jsdoc-tsd",
"version": "0.8.5",
"version": "0.8.6",
"description": "JSDoc Template for generate typescript definition files from JSDoc comments",
"main": "src-out/core/publish.js",
"repository": {
Expand Down
9 changes: 5 additions & 4 deletions src/core/jsdoc-tsd-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export class JSDocTsdParser {
this.config.ignoreScopes = [];
}

if (typeof this.config.ignorePrivateMembers === "undefined") {
this.config.ignorePrivateMembers = false;
}

if (typeof this.config.versionComparator !== "function" && (typeof this.config.versionComparator !== "string" || this.config.versionComparator === "")) {
this.config.versionComparator = (taggedVersion: string, latestVersion: string): boolean => {
if (taggedVersion.match(/v?([0-9]+\.){2}[0-9]+/i)) {
Expand Down Expand Up @@ -96,7 +100,7 @@ export class JSDocTsdParser {
jsdocItems.forEach((item) => {
if (!this.evaluateSinceTag(item.since)) {
this.rejectedItems.push(item.longname);
} else if (!item.ignore && this.config.ignoreScopes.indexOf(item.scope) === -1 && (!item.access || item.access !== "private")) {
} else if (!item.ignore && this.config.ignoreScopes.indexOf(item.scope) === -1 && !(this.config.ignorePrivateMembers && item.access === "private")) {
let addItem = true;
let addJsDocComment = true;
let parsedItem: dom.DeclarationBase = {};
Expand Down Expand Up @@ -188,9 +192,6 @@ export class JSDocTsdParser {
let domTopLevelDeclarations: { [key: string]: dom.TopLevelDeclaration } = {};

for (let jsdocItem of this.jsdocItems) {
if (jsdocItem.longname === "lcmContractTermHelper.ContractTermReminderConfiguration") {
let a = 0;
}
let parentItem = this.findParentItem(jsdocItem, domTopLevelDeclarations);

if (parentItem) {
Expand Down

0 comments on commit 2d3193c

Please sign in to comment.