1 | 'use strict'
|
2 |
|
3 | const EPILOG = `
|
4 | Presets:
|
5 | \`check\` Runs the type checker with your local config (without writing any files). .
|
6 | \`types\` Emits type declarations for \`['src/**/*', 'package.json']\` to \`dist\` folder.
|
7 | \`docs\` Generates documentation based on type declarations to the \`docs\` folder.
|
8 | \`config\` Prints base config to stdout.
|
9 |
|
10 | Note:
|
11 | Check out the documentation for JSDoc based TS types here: https://github.com/ipfs/aegir/blob/master/md/ts-jsdoc.md
|
12 |
|
13 | Supports options forwarding with '--' for more info check https://www.typescriptlang.org/docs/handbook/compiler-options.html
|
14 | `
|
15 | module.exports = {
|
16 | command: 'ts',
|
17 | desc: 'Typescript command with presets for specific tasks.',
|
18 | builder: (yargs) => {
|
19 | yargs
|
20 | .epilog(EPILOG)
|
21 | .example('aegir ts --preset config > tsconfig.json', 'Add a base tsconfig.json to the current repo.')
|
22 | .options({
|
23 | preset: {
|
24 | type: 'string',
|
25 | choices: ['config', 'check', 'types', 'docs'],
|
26 | describe: 'Preset to run',
|
27 | alias: 'p'
|
28 | },
|
29 | include: {
|
30 | type: 'array',
|
31 | describe: 'Values are merged into the local TS config include property.',
|
32 | default: []
|
33 | }
|
34 | })
|
35 | },
|
36 | handler (argv) {
|
37 | const ts = require('../src/ts')
|
38 | return ts(argv)
|
39 | }
|
40 | }
|