Skip to content

Commit

Permalink
Merge pull request #77 from buehler/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
buehler authored Jul 5, 2018
2 parents 5e4fa1b + 596e150 commit 9165171
Show file tree
Hide file tree
Showing 57 changed files with 933 additions and 217 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ matrix:

environment:
matrix:
- nodejs_version: "9"
- nodejs_version: "8"
- nodejs_version: "10"

install:
- ps: Install-Product node $env:nodejs_version
Expand All @@ -18,5 +17,6 @@ test_script:
- npm test
- npm install -g codecov
- codecov
- npm run build

build: off
21 changes: 13 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ language: node_js
stages:
- name: test
if: tag IS blank
- name: build
if: tag IS blank
- name: deploy
if: branch = master AND type != pull_request

cache:
directories:
- node_modules

matrix:
fast_finish: true

Expand All @@ -15,24 +21,23 @@ notifications:
jobs:
include:
- stage: test
node_js: '9'
after_success:
- npm i -g codecov
- codecov
- stage: test
node_js: '8'
node_js: '10'
after_success:
- npm i -g codecov
- codecov
- stage: build
node_js: '10'
script:
- npm run build
- stage: deploy
node_js: '9'
node_js: '10'
script: npm run typedoc
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN
local_dir: ./docs
- stage: deploy
node_js: '9'
node_js: '10'
before_script: npm run build
script: npm run semantic-release
2 changes: 1 addition & 1 deletion config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"declaration": true,
"sourceMap": false,
"importHelpers": true,
"strictNullChecks": true,
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noUnusedLocals": true,
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@
},
"homepage": "https://github.com/TypeScript-Heroes/node-typescript-parser#readme",
"devDependencies": {
"@smartive/tslint-config": "^3.0.1",
"@types/jest": "^22.2.2",
"@smartive/tslint-config": "^4.0.0",
"@types/jest": "^23.1.4",
"@types/lodash-es": "^4.17.0",
"@types/mock-fs": "^3.6.30",
"@types/node": "^9.6.2",
"@types/node": "^10.5.1",
"del-cli": "^1.1.0",
"jest": "^22.4.3",
"mock-fs": "^4.4.2",
"semantic-release": "^15.1.5",
"ts-jest": "^22.4.2",
"tslint": "^5.9.1",
"tsutils": "^2.26.0",
"jest": "^23.3.0",
"mock-fs": "^4.5.0",
"semantic-release": "^15.6.3",
"ts-jest": "^23.0.0",
"tslint": "^5.10.0",
"tsutils": "^2.27.2",
"typedoc": "^0.11.1"
},
"dependencies": {
"lodash": "^4.17.5",
"lodash-es": "^4.17.8",
"tslib": "^1.9.0",
"typescript": "^2.8.1"
"lodash": "^4.17.10",
"lodash-es": "^4.17.10",
"tslib": "^1.9.3",
"typescript": "^2.9.2"
}
}
3 changes: 3 additions & 0 deletions src/DeclarationIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ export class DeclarationIndex {
): void {
exportedLib.declarations
.forEach((o) => {
if (!tsExport.specifiers) {
return;
}
const ex = tsExport.specifiers.find(s => s.specifier === o.name);
if (!ex) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/Node.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/**
* Base class for all nodes / declarations / imports / etc. in the extension.
* Contains basic information about the node.
*
*
* @export
* @interface Node
*/
export interface Node {
/**
* The starting character of the node in the document.
*
*
* @type {number}
* @memberof Node
*/
start?: number;

/**
* The ending character of the node in the document.
*
*
* @type {number}
* @memberof Node
*/
Expand Down
6 changes: 3 additions & 3 deletions src/SymbolSpecifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Clonable } from './clonable/Clonable';
/**
* Class for symbols that are contained in a named import or export or anywhere. Basically an aliased object.
* (i.e. import {SYMBOL} from '...').
*
*
* @export
* @class SymbolSpecifier
* @implements {Clonable}
Expand All @@ -13,9 +13,9 @@ export class SymbolSpecifier implements Clonable<SymbolSpecifier> {

/**
* Clones the current resolve specifier and returns a new instance with the same properties.
*
*
* @returns {SymbolSpecifier}
*
*
* @memberof SymbolSpecifier
*/
public clone(): SymbolSpecifier {
Expand Down
1 change: 0 additions & 1 deletion src/TypescriptParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export class TypescriptParser {
return file;
}


/**
* Recursive function that runs through the AST of a source and parses the nodes.
* Creates the class / function / etc declarations and instanciates a new module / namespace
Expand Down
6 changes: 3 additions & 3 deletions src/clonable/Clonable.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/**
* Interface for clonable objects. The clone() method creates a deep clone of the object.
*
*
* @export
* @template T
* @interface Clonable
*/
export interface Clonable<T> {
/**
* Create a deep clone of this object.
*
*
* @returns {T}
*
*
* @memberof Clonable
*/
clone(): T;
Expand Down
2 changes: 1 addition & 1 deletion src/code-generators/TypescriptCodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export type Generators = { [name: string]: (generatable: Generatable, options: T
* Hash with all possible (yet implemented) generators.
*/
export const GENERATORS: Generators = {
[SymbolSpecifier.name]: generateSymbolSpecifier,
[SymbolSpecifier.name]: generateSymbolSpecifier as any,
[MethodDeclaration.name]: generateMethodDeclaration,
[ParameterDeclaration.name]: generateParameterDeclaration,
[PropertyDeclaration.name]: generatePropertyDeclaration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { TypescriptGenerationOptions } from '../TypescriptGenerationOptions';

/**
* Generates typescript code for an external module import.
*
*
* @export
* @param {ExternalModuleImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
* @param {ExternalModuleImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
*/
export function generateExternalModuleImport(
imp: ExternalModuleImport,
Expand Down
8 changes: 4 additions & 4 deletions src/code-generators/typescript-generators/namespaceImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { TypescriptGenerationOptions } from '../TypescriptGenerationOptions';

/**
* Generates typescript code for a namespace import
*
*
* @export
* @param {NamespaceImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
* @param {NamespaceImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
*/
export function generateNamespaceImport(
imp: NamespaceImport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { ParameterDeclaration } from '../../declarations/ParameterDeclaration';

/**
* Generates typescript code for parameters.
*
*
* @export
* @param {ParameterDeclaration} parameter
* @returns {string}
* @param {ParameterDeclaration} parameter
* @returns {string}
*/
export function generateParameterDeclaration(parameter: ParameterDeclaration): string {
return `${parameter.name}${parameter.type ? `: ${parameter.type}` : ''}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { TypescriptGenerationOptions } from '../TypescriptGenerationOptions';

/**
* Generates typescript code for a class property.
*
*
* @export
* @param {PropertyDeclaration} property
* @param {TypescriptGenerationOptions} { tabSize }
* @returns {string}
* @param {PropertyDeclaration} property
* @param {TypescriptGenerationOptions} { tabSize }
* @returns {string}
*/
export function generatePropertyDeclaration(
property: PropertyDeclaration,
Expand Down
8 changes: 4 additions & 4 deletions src/code-generators/typescript-generators/stringImport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { TypescriptGenerationOptions } from '../TypescriptGenerationOptions';

/**
* Generates typescript code for a string import.
*
*
* @export
* @param {StringImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
* @param {StringImport} imp
* @param {TypescriptGenerationOptions} { stringQuoteStyle, eol }
* @returns {string}
*/
export function generateStringImport(imp: StringImport, { stringQuoteStyle, eol }: TypescriptGenerationOptions): string {
return `import ${stringQuoteStyle}${imp.libraryName}${stringQuoteStyle}${eol}`;
Expand Down
6 changes: 3 additions & 3 deletions src/code-generators/typescript-generators/symbolSpecifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { SymbolSpecifier } from '../../SymbolSpecifier';

/**
* Generates typescript code for a symbol specifier.
*
*
* @export
* @param {SymbolSpecifier} specifier
* @returns {string}
* @param {SymbolSpecifier} specifier
* @returns {string}
*/
export function generateSymbolSpecifier(specifier: SymbolSpecifier): string {
return `${specifier.specifier}${specifier.alias ? ` as ${specifier.alias}` : ''}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { VariableDeclaration } from '../../declarations/VariableDeclaration';

/**
* Generates typescript code for a variable.
*
*
* @export
* @param {VariableDelcaration} variable
* @returns {string}
* @param {VariableDelcaration} variable
* @returns {string}
*/
export function generateVariableDelcaration(variable: VariableDeclaration): string {
return `${variable.name}${variable.type ? `: ${variable.type}` : ''}`;
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/ClassDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PropertyDeclaration } from './PropertyDeclaration';
* @implements {GenericDeclaration}
*/
export class ClassDeclaration implements ClassLikeDeclaration, ExportableDeclaration, GenericDeclaration {
public ctor: ConstructorDeclaration;
public ctor: ConstructorDeclaration | undefined;
public accessors: AccessorDeclaration[] = [];
public properties: PropertyDeclaration[] = [];
public methods: MethodDeclaration[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/ConstructorDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { VariableDeclaration } from './VariableDeclaration';

/**
* Constructor declaration that is contained in a class.
*
*
* @export
* @class ConstructorDeclaration
* @implements {CallableDeclaration}
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/DeclarationInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Declaration } from './Declaration';
/**
* Class that defines information about a declaration.
* Contains the declaration and the origin of the declaration.
*
*
* @export
* @class DeclarationInfo
*/
Expand Down
4 changes: 2 additions & 2 deletions src/declarations/DeclarationVisibility.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Returns the visibility string for a given enum value.
*
*
* @param {DeclarationVisibility} [visibility]
* @returns {string}
*/
Expand All @@ -19,7 +19,7 @@ export function getVisibilityText(visibility?: DeclarationVisibility): string {

/**
* Visibility of a class or interface property, as well as a method.
*
*
* @export
* @enum {number}
*/
Expand Down
6 changes: 3 additions & 3 deletions src/declarations/DefaultDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { Declaration, ExportableDeclaration } from './Declaration';
* Default declaration. Is used when a file exports something as its default.
* Primary use is to ask the user about a name for the default export.
* Is kind of an abstract declaration since there is no real declaration.
*
*
* @export
* @class DefaultDeclaration
* @implements {ExportableDeclaration}
*/
export class DefaultDeclaration implements ExportableDeclaration {
public readonly isExported: boolean = true;

private exported: Declaration;
private exported: Declaration | undefined;

public get exportedDeclaration(): Declaration {
if (!this.exported) {
this.exported = this.resource.declarations.find(o => o.name === this.name) !;
this.exported = this.resource.declarations.find(o => o.name === this.name)!;
}

return this.exported;
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/EnumDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ExportableDeclaration } from './Declaration';

/**
* Enum declaration.
*
*
* @export
* @class EnumDeclaration
* @implements {ExportableDeclaration}
Expand Down
2 changes: 1 addition & 1 deletion src/declarations/FunctionDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { VariableDeclaration } from './VariableDeclaration';
/**
* Function declaration. Like the MethodDeclaration it contains the base info about the function
* and additional stuff.
*
*
* @export
* @class FunctionDeclaration
* @implements {CallableDeclaration}
Expand Down
Loading

0 comments on commit 9165171

Please sign in to comment.