Skip to content

Commit

Permalink
fix(build): upgrade to strong-docs@1.7.1
Browse files Browse the repository at this point in the history
This change makes sure typedoc runs with the same configuration as tsc
and tslint do.
  • Loading branch information
raymondfeng committed Jan 30, 2018
1 parent fe59e6b commit fd02e1b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
18 changes: 17 additions & 1 deletion packages/build/bin/generate-apidocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ function run(argv, dryRun) {
}
}

return utils.runCLI('strong-docs/bin/cli', ['-o', 'api-docs'], dryRun);
const apidocsOpts = argv.slice(2);

const args = [];

if (!utils.isOptionSet(apidocsOpts, '--tstarget')) {
const target = utils.getCompilationTarget();
args.push('--tstarget', target);
}
if (!utils.isOptionSet(apidocsOpts, '--tsconfig')) {
const config = utils.getConfigFile('tsconfig.build.json', 'tsconfig.json');
args.push('--tsconfig', config);
}
if (!utils.isOptionSet(apidocsOpts, '--out', '-o')) {
args.push('-o', 'api-docs');
}
args.push(...apidocsOpts);
return utils.runCLI('strong-docs/bin/cli', args, dryRun);
}

module.exports = run;
Expand Down
2 changes: 1 addition & 1 deletion packages/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"nyc": "^11.4.1",
"prettier": "^1.10.2",
"source-map-support": "^0.5.3",
"strong-docs": "^1.6.0",
"strong-docs": "^1.7.1",
"tslint": "^5.9.1",
"typescript": "^2.6.2"
},
Expand Down
24 changes: 24 additions & 0 deletions packages/build/test/integration/scripts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,30 @@ describe('build', () => {
});
});

it('honors --tsconfig for apidocs', () => {
var run = require('../../bin/generate-apidocs');
var command = run(
['node', 'bin/generate-apidocs', '--tsconfig', 'tsconfig.my.json'],
true
);
assert(
command.indexOf('--tsconfig tsconfig.my.json') !== -1,
'--tsconfig should be honored'
);
});

it('honors --tstarget for apidocs', () => {
var run = require('../../bin/generate-apidocs');
var command = run(
['node', 'bin/generate-apidocs', '--tstarget', 'es2017'],
true
);
assert(
command.indexOf('--tstarget es2017') !== -1,
'--tstarget should be honored'
);
});

it('runs tslint against ts files', done => {
var run = require('../../bin/run-tslint');
var childProcess = run(['node', 'bin/run-tslint']);
Expand Down

0 comments on commit fd02e1b

Please sign in to comment.