Skip to content

Commit

Permalink
feat: primitive TypeScript support (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Wagner <[email protected]>
  • Loading branch information
buschtoens and RobbieTheWagner authored Apr 8, 2020
1 parent dd3aaf3 commit 6840182
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/broccoli/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const generateESDocJsonApi = require("../preprocessors/generate-esdoc-jsonapi");
module.exports = class DocsGenerator extends CachingWriter {
constructor(inputNodes, options) {
let defaults = {
cacheInclude: [/\.js$/]
cacheInclude: [/\.(?:js|ts)$/]
};

super([inputNodes], Object.assign(defaults, options));
Expand Down
8 changes: 4 additions & 4 deletions lib/preprocessors/generate-esdoc-jsonapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const Serializer = require('../serializers/main');

function normalizePaths(doc) {
if (doc.kind === 'file') {
doc.name = doc.name ? doc.name.substr(doc.name.indexOf('/') + 1).replace(/(\/index)?\.js/, '') : undefined;
doc.name = doc.name ? doc.name.substr(doc.name.indexOf('/') + 1).replace(/(\/index)?\.(?:js|ts)/, '') : undefined;
} else {
doc.longname = doc.longname ? doc.longname.substr(doc.longname.indexOf('/') + 1).replace(/(\/index)?\.js/, '') : undefined;
doc.memberof = doc.memberof ? doc.memberof.substr(doc.memberof.indexOf('/') + 1).replace(/(\/index)?\.js/, '') : undefined;
doc.importPath = doc.importPath ? doc.importPath.substr(doc.importPath.indexOf('/') + 1).replace(/(\/index)?\.js/, '') : undefined;
doc.longname = doc.longname ? doc.longname.substr(doc.longname.indexOf('/') + 1).replace(/(\/index)?\.(?:js|ts)/, '') : undefined;
doc.memberof = doc.memberof ? doc.memberof.substr(doc.memberof.indexOf('/') + 1).replace(/(\/index)?\.(?:js|ts)/, '') : undefined;
doc.importPath = doc.importPath ? doc.importPath.substr(doc.importPath.indexOf('/') + 1).replace(/(\/index)?\.(?:js|ts)/, '') : undefined;
}
}

Expand Down
6 changes: 4 additions & 2 deletions lib/preprocessors/generate-esdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const tmp = require('tmp');

const ESDOC_CONFIG = {
source: './',
includes: ['\\.(?:js|ts)$'],
excludes: [
"(node_modules|tests|tmp)"
],
Expand All @@ -25,7 +26,8 @@ const ESDOC_CONFIG = {
dynamicImport: true
}
},
{ name: 'esdoc-accessor-plugin' }
{ name: 'esdoc-accessor-plugin' },
{ name: 'esdoc-typescript-plugin', option: { enable: true } }
]
};

Expand Down Expand Up @@ -70,4 +72,4 @@ module.exports = function generateESDoc(inputPath) {

throw e;
}
}
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"esdoc": "pzuraq/esdoc#015a342",
"esdoc-accessor-plugin": "^1.0.0",
"esdoc-ecmascript-proposal-plugin": "^1.0.0",
"esdoc-typescript-plugin": "^1.0.1",
"fs-extra": "^5.0.0",
"json-api-serializer": "^1.11.0",
"lodash": "^4.17.5",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2679,6 +2679,13 @@ esdoc-ecmascript-proposal-plugin@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/esdoc-ecmascript-proposal-plugin/-/esdoc-ecmascript-proposal-plugin-1.0.0.tgz#390dc5656ba8a2830e39dba3570d79138df2ffd9"

esdoc-typescript-plugin@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/esdoc-typescript-plugin/-/esdoc-typescript-plugin-1.0.1.tgz#d4b929677f2ee5587a86ec70e766537040b98662"
integrity sha512-QV9rdis5PkypVK1fh2wuESZPQZUVjTwt4hj97Pivb9M8wGPMOTxYu5ofkyGWm3xgNL+K0VxZY6TGEO07kfGAtg==
dependencies:
typescript "^2.8.3"

esdoc@pzuraq/esdoc#015a342:
version "1.0.4"
resolved "https://codeload.github.com/pzuraq/esdoc/tar.gz/015a3426b2e53b2b0270a9c00133780db3f1d144"
Expand Down Expand Up @@ -6647,6 +6654,11 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

typescript@^2.8.3:
version "2.9.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==

uc.micro@^1.0.1, uc.micro@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.5.tgz#0c65f15f815aa08b560a61ce8b4db7ffc3f45376"
Expand Down

0 comments on commit 6840182

Please sign in to comment.