-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docz-core): add docz init command
- Loading branch information
1 parent
cb5e4ae
commit 2cd87ee
Showing
6 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { dev } from './dev' | ||
export { build } from './build' | ||
export { serve } from './serve' | ||
export { init } from './init' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
process.setMaxListeners(Infinity) | ||
|
||
import { Arguments } from 'yargs' | ||
import { finds } from 'load-cfg' | ||
import findUp from 'find-up' | ||
|
||
import { parseConfig } from '../config/docz' | ||
import { getIsFirstInstall, getIsDoczRepo } from '../bundler/machine/actions' | ||
import { | ||
ensureDirs, | ||
createResources, | ||
installDeps, | ||
} from '../bundler/machine/services' | ||
|
||
export const init = async (args: Arguments<any>) => { | ||
const doczrcFilepath = await findUp(finds('docz')) | ||
const config = await parseConfig(args) | ||
const isFirstInstall = getIsFirstInstall() | ||
const isDoczRepo = getIsDoczRepo() | ||
await ensureDirs() | ||
const serverMachineContext = { | ||
args: config, | ||
isDoczRepo, | ||
firstInstall: isFirstInstall, | ||
doczrcFilepath, | ||
} | ||
await createResources(serverMachineContext) | ||
await installDeps(serverMachineContext) | ||
console.log() | ||
console.log(`✅ Docz is ready to go `) | ||
console.log() | ||
console.log(`💻 yarn docz dev`) | ||
console.log(`⛏ yarn docz build`) | ||
console.log(`👀 yarn docz serve`) | ||
console.log() | ||
} |
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