1- import * as yamlParser from 'js-yaml'
2- import * as path from 'path'
3- import * as fs from 'fs'
4- import * as util from 'util'
1+ import { load } from 'js-yaml'
2+ import { join } from 'path'
3+ import { writeFile , readFile } from 'fs'
4+ import { promisify } from 'util'
55import { parse } from './utils/parse'
66import { getArg } from './utils/args'
77import { getCommits , CommitLogObject } from './utils/commits'
@@ -11,8 +11,8 @@ import { validateSchema } from './utils/validateSchema'
1111import { validateMarkdown } from './utils/validateMarkdown'
1212import * as T from '../typings/tutorial'
1313
14- const write = util . promisify ( fs . writeFile )
15- const read = util . promisify ( fs . readFile )
14+ const write = promisify ( writeFile )
15+ const read = promisify ( readFile )
1616
1717export type BuildConfigOptions = {
1818 text : string // text document from markdown
@@ -60,15 +60,15 @@ async function build (args: string[]) {
6060 }
6161
6262 // path to run build from
63- const localPath = path . join ( process . cwd ( ) , options . dir )
63+ const localPath = join ( process . cwd ( ) , options . dir )
6464
6565 // load markdown and files
6666 let _markdown : string
6767 let _yaml : string
6868 try {
6969 ; [ _markdown , _yaml ] = await Promise . all ( [
70- read ( path . join ( localPath , options . markdown ) , 'utf8' ) ,
71- read ( path . join ( localPath , options . yaml ) , 'utf8' )
70+ read ( join ( localPath , options . markdown ) , 'utf8' ) ,
71+ read ( join ( localPath , options . yaml ) , 'utf8' )
7272 ] )
7373 } catch ( e ) {
7474 console . error ( 'Error reading file:' )
@@ -91,7 +91,7 @@ async function build (args: string[]) {
9191 // parse yaml skeleton config
9292 let skeleton
9393 try {
94- skeleton = yamlParser . load ( _yaml ) as T . TutorialSkeleton
94+ skeleton = load ( _yaml ) as T . TutorialSkeleton
9595 if ( ! skeleton || ! Object . keys ( skeleton ) . length ) {
9696 throw new Error ( `Skeleton at "${ options . yaml } " is invalid` )
9797 }
0 commit comments