Skip to content

Commit

Permalink
docs: updated typing for args handler (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Nov 23, 2022
1 parent ffce33a commit ddc6357
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
"execa": "^6.1.0",
"extract-zip": "^2.0.1",
"fs-extra": "^10.0.0",
"gh-pages": "^4.0.0",
"globby": "^13.1.1",
"it-glob": "^1.0.1",
"kleur": "^4.1.4",
Expand Down
14 changes: 8 additions & 6 deletions src/cmds/docs.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import { loadUserConfig } from '../config/user.js'
import docs from '../docs.js'
import docsCmd from '../docs.js'

/**
* @typedef {import("yargs").Argv} Argv
* @typedef {import("yargs").ArgumentsCamelCase} Arguments
* @typedef {import("yargs").CommandModule} CommandModule
*/
const EPILOG = `
Typescript config file is required to generated docs. Try \`aegir ts --preset config > tsconfig.json\`
`

/** @type {CommandModule} */
export default {
command: 'docs',
desc: 'Generate documentation from TS type declarations.',
describe: 'Generate documentation from TS type declarations.',
/**
* @param {Argv} yargs
*/
builder: async (yargs) => {
const userConfig = await loadUserConfig()

yargs
return yargs
.epilog(EPILOG)
.example('aegir docs', 'Build HTML documentation.')
.example('aegir docs -p', 'Build HTML documentation and publish to Github Pages.')
Expand All @@ -37,9 +39,9 @@ export default {
})
},
/**
* @param {(import("../types").GlobalOptions & import("../types").DocsOptions) | undefined} argv
* @param {any} argv
*/
async handler (argv) {
await docs.run(argv)
await docsCmd.run(argv)
}
}
2 changes: 1 addition & 1 deletion src/docs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { hasTsconfig, fromAegir, fromRoot, readJson } from './utils'
import { hasTsconfig, fromAegir, fromRoot, readJson } from './utils.js'
import Listr from 'listr'
import kleur from 'kleur'
import fs from 'fs-extra'
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import lintCmd from './cmds/lint.js'
import releaseCmd from './cmds/release.js'
import testDependantCmd from './cmds/test-dependant.js'
import testCmd from './cmds/test.js'
import docsCmd from './cmds/docs.js'

/**
* @typedef {import('./types').BuildOptions} BuildOptions
Expand Down Expand Up @@ -81,6 +82,7 @@ async function main () {
res.command(checkProjectCmd)
res.command(checkCmd)
res.command(cleanCmd)
res.command(docsCmd)
res.command(dependencyCheckCmd)
res.command(lintPackageJsonCmd)
res.command(lintCmd)
Expand Down

0 comments on commit ddc6357

Please sign in to comment.