Created
January 14, 2019 17:29
-
-
Save ramsaylanier/69c6513dac3be43d735a0afa018212fb to your computer and use it in GitHub Desktop.
Module Docs cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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