Skip to content

Instantly share code, notes, and snippets.

@ramsaylanier
Created January 14, 2019 17:29
Show Gist options
  • Save ramsaylanier/69c6513dac3be43d735a0afa018212fb to your computer and use it in GitHub Desktop.
Save ramsaylanier/69c6513dac3be43d735a0afa018212fb to your computer and use it in GitHub Desktop.
Module Docs cli
const program = require("commander")
const makeServer = require("./server/serve")
const path = require("path")
// gets the config file from the working directory of the application
const getConfig = () => {
const configPath = path.join(process.cwd(), "./module-docs.config.js")
const config = require(configPath)
return config ? config || null
}
// using commander, execute the start command which spins up the express server
program.command("start").action(() => {
const modulePath = path.join(process.cwd(), "./node_modules")
const config = getConfig()
makeServer(modulePath, config)
})
program.parse(process.argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment