Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update dependency #128

Merged
merged 2 commits into from Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
979 changes: 439 additions & 540 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions package.json
Expand Up @@ -26,30 +26,32 @@
"dependencies": {
"debug": "^4.1.1",
"dox": "^0.9.0",
"ejs": "^2.6.1",
"ejs": "^3.0.1",
"express": "^4.16.3",
"fs-extra": "^7.0.1",
"fs-extra": "^8.1.0",
"glob": "^7.1.2",
"highlight.js": "^9.15.6",
"highlight.js": "^9.17.1",
"markdown": "^0.5.0",
"marked": "^0.6.2",
"marked": "^0.8.0",
"optimist": "^0.6.0",
"strong-task-emitter": "^0.0.8",
"typedoc": "^0.14.2",
"typedoc": "^0.16.2",
"underscore.string": "^3.3.4"
},
"devDependencies": {
"@types/debug": "^4.1.3",
"@types/ejs": "^2.6.3",
"@types/marked": "^0.6.5",
"@types/node": "^10.7.1",
"@types/underscore.string": "^0.0.36",
"@types/debug": "^4.1.5",
"@types/ejs": "^3.0.0",
"@types/glob": "^7.1.1",
"@types/highlight.js": "^9.12.3",
"@types/marked": "^0.7.2",
"@types/node": "^10.17.13",
"@types/underscore.string": "0.0.38",
"chai": "^4.1.0",
"mocha": "^6.1.2",
"prettier": "^1.16.4",
"source-map-support": "^0.5.12",
"tslint": "^5.15.0",
"typescript": "^3.4.3"
"mocha": "^7.0.0",
"prettier": "^1.19.1",
"source-map-support": "^0.5.16",
"tslint": "^5.20.1",
"typescript": "~3.7.4"
},
"bin": {
"sdocs": "./bin/cli.js"
Expand Down
2 changes: 1 addition & 1 deletion src/doc.ts
Expand Up @@ -4,14 +4,14 @@
// License text available at https://opensource.org/licenses/MIT

import * as ejs from 'ejs';
import * as hljs from 'highlight.js';
import * as marked from 'marked';
import * as path from 'path';
import * as string from 'underscore.string';
import {Annotation} from './annotation';
import {Docs} from './docs';
import {Comment} from './dox';
import {Options, Section} from './ts-helper';
import * as hljs from 'highlight.js';

const dox = require('dox');

Expand Down
2 changes: 1 addition & 1 deletion src/docs.ts
Expand Up @@ -6,13 +6,13 @@
import {exec} from 'child_process';
import * as ejs from 'ejs';
import * as fs from 'fs';
import {sync as glob} from 'glob';
import * as path from 'path';
import * as _ from 'underscore.string';
import {Doc} from './doc';
import {AnyObject, Options, Section} from './ts-helper';
import {TSParser} from './ts-parser';
import {TSConstruct} from './ts-construct';
import {sync as glob} from 'glob';

const TaskEmitter = require('strong-task-emitter');
const COMMENT_TEMPLATE = path.join(__dirname, '../templates/annotation.ejs');
Expand Down
22 changes: 14 additions & 8 deletions src/ts-parser.ts
Expand Up @@ -12,7 +12,7 @@ import {
} from 'typedoc';
import {TSConstruct} from './ts-construct';
import {Node, Options, TSHelper, Section} from './ts-helper';
import {Comment} from 'typedoc/dist/lib/models';
import {Comment, ContainerReflection} from 'typedoc/dist/lib/models';

marked.setOptions({
highlight: function(code) {
Expand Down Expand Up @@ -59,7 +59,8 @@ export class TSParser {
options[i] = config[i];
}
}
this.app = new Application(options);
this.app = new Application();
this.app.bootstrap(options);
}

// Override typedoc.Application.convert() to get errors
Expand Down Expand Up @@ -89,10 +90,8 @@ export class TSParser {
'TypeScript compilation fails. See error messages in the log above.'
);
} else {
// Replace usage of deprecated `project.toObject()`, which is broken with typedoc@0.10.0.
let projectObject = this.app.serializer.projectToObject(project);
let exportedConstructs = this.findExportedConstructs(
projectObject,
project,
this.filePaths
);
exportedConstructs.forEach((node: Node) => {
Expand Down Expand Up @@ -157,9 +156,16 @@ export class TSParser {
};
}

findExportedConstructs(construct: Node, filePaths: string[]): Node[] {
let exportedConstructs: Node[] = [];
function findConstructs(node: Node, files: string[], parent?: Reflection) {
findExportedConstructs(
construct: ContainerReflection,
filePaths: string[]
): ContainerReflection[] {
let exportedConstructs: ContainerReflection[] = [];
function findConstructs(
node: ContainerReflection,
files: string[],
parent?: Reflection
) {
if (parent) {
node.parent = parent;
}
Expand Down
6 changes: 3 additions & 3 deletions templates/docs.ejs
@@ -1,7 +1,7 @@
<% include header %>
<%- include('header'); %>
<div class="row">
<div class="col-lg-3 column scroll-spy-target">
<% include nav %>
<%- include('nav'); %>
</div>
<div class="col-lg-9 col-lg-offset-3 column" data-spy="scroll" data-target=".scroll-spy-target" data-offset="0">
<div class="readability">
Expand All @@ -12,4 +12,4 @@
<div class="intentionally-left-blank"></div>
</div>
</div>
<% include footer %>
<%- include('footer'); %>
4 changes: 2 additions & 2 deletions templates/home.ejs
@@ -1,7 +1,7 @@
<% include header %>
<%- include('header'); %>
<ul>
<% repos.forEach(function (repo) { %>
<li><a href="/<%= repo.repo %>"><%= repo.repo %></a></li>
<% }); %>
</ul>
<% include footer %>
<%- include('footer'); %>
4 changes: 2 additions & 2 deletions templates/tsConstructs/class.ejs
@@ -1,6 +1,6 @@
<section class="code-doc ">
<a name="<%-anchorId%>"></a>
<h3 class="code-ref"><%-kindString%>: <%=name.toLowerCase()%> = new <%-name%>()</h3>
<% include comments %>
<%- include('comments'); %>
</section>
<% include children %>
<%- include('children'); %>
4 changes: 2 additions & 2 deletions templates/tsConstructs/enum.ejs
@@ -1,6 +1,6 @@
<section class="code-doc ">
<a name="<%-anchorId%>"></a>
<h3 class="code-ref"><%-kindString%>: <%-name%></h3>
<% include comments %>
<%- include('comments'); %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure these include statements should be terminated by a semicolon? I would expect something like this:

Suggested change
<%- include('comments'); %>
<%- include('comments') %>

I am not very familiar with EJS, so it's very likely I am wrong.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include(...) is just a JS function call. The trailing ; is optional but I prefer to have it for consistency.

</section>
<% include enum-members %>
<%- include('enum');-members %>
4 changes: 2 additions & 2 deletions templates/tsConstructs/interface.ejs
@@ -1,6 +1,6 @@
<section class="code-doc ">
<a name="<%-anchorId%>"></a>
<h3 class="code-ref"><%-kindString%>: <%-name%></h3>
<% include comments %>
<%- include('comments'); %>
</section>
<% include children %>
<%- include('children'); %>
4 changes: 2 additions & 2 deletions templates/tsConstructs/namespace.ejs
@@ -1,6 +1,6 @@
<section class="code-doc ">
<a name="<%-anchorId%>"></a>
<h3 class="code-ref">Namespace: <%-name%></h3>
<% include comments %>
<%- include('comments'); %>
</section>
<% include namespace-members %>
<%- include('namespace-members'); %>
4 changes: 2 additions & 2 deletions templates/tsConstructs/objectLiteral.ejs
@@ -1,6 +1,6 @@
<section class="code-doc ">
<a name="<%-anchorId%>"></a>
<h3 class="code-ref"><%-kindString%>: <%-name%></h3>
<% include comments %>
<%- include('comments'); %>
</section>
<% include children %>
<%- include('children'); %>
2 changes: 1 addition & 1 deletion templates/tsConstructs/variable.ejs
Expand Up @@ -5,5 +5,5 @@
flags: flags, defaultValue: locals.defaultValue || ''});
%>
<h3 class="code-ref"><%- title %></h3>
<% include comments %>
<%- include('comments'); %>
</section>
8 changes: 3 additions & 5 deletions test/ts-parser.test.js
Expand Up @@ -66,18 +66,16 @@ describe('TypeScript Parser Test', function() {
}
);

it('should report errors if es2016 apis are used with es2015 tsconfig', function() {
// TypeScript 3.7.x no longer reports it as an error
it('should allow es2016 apis used with es2015 tsconfig', function() {
var file = path.join(__dirname, 'fixtures/ts/Greeter.es2016.ts');
var tsFiles = [file];
var tsParser = new TSParser(tsFiles, {
excludeNotExported: false,
tsconfig,
});
var parsedData = tsParser.parse();
expect(parsedData.errors).to.have.length(1);
expect(parsedData.errors[0].messageText).to.eql(
"Property 'includes' does not exist on type 'string[]'."
);
expect(parsedData.errors).to.be.empty;
});

it('should allow Array.includes() with es2016 tsconfig', function() {
Expand Down