@@ -34,6 +34,7 @@ program
3434// ARGUMENTS PARSING AND SETUP
3535
3636program . parse ( process . argv )
37+ const options = program . opts ( )
3738
3839if ( ! input || fs . lstatSync ( input ) . isDirectory ( ) ) {
3940 input = autodetectMasterFile ( input )
@@ -59,14 +60,14 @@ if (!output) {
5960const outputPath = path . resolve ( output )
6061
6162var tempDir
62- if ( program . temp ) {
63- var validTempPath = fs . existsSync ( program . temp ) && fs . statSync ( program . temp ) . isDirectory ( )
63+ if ( options . temp ) {
64+ var validTempPath = fs . existsSync ( options . temp ) && fs . statSync ( options . temp ) . isDirectory ( )
6465
6566 if ( validTempPath ) {
66- tempDir = path . resolve ( program . temp )
67+ tempDir = path . resolve ( options . temp )
6768 } else {
6869 console . error ( colors . red ( 'ReLaXed error: Could not find specified --temp directory: ' +
69- program . temp ) )
70+ options . temp ) )
7071 process . exit ( 1 )
7172 }
7273} else {
@@ -77,16 +78,16 @@ const tempHTMLPath = path.join(tempDir, inputFilenameNoExt + '_temp.htm')
7778
7879// Default and additional watch locations
7980let watchLocations = [ inputDir ]
80- if ( program . watch ) {
81- watchLocations = watchLocations . concat ( program . watch )
81+ if ( options . watch ) {
82+ watchLocations = watchLocations . concat ( options . watch )
8283}
8384
84- let locals = parseLocals ( program . locals , inputDir )
85+ let locals = parseLocals ( options . locals , inputDir )
8586
8687// Google Chrome headless configuration
8788const puppeteerConfig = {
8889 headless : true ,
89- args : ( ! program . sandbox ? [ '--no-sandbox' ] : [ ] ) . concat ( [
90+ args : ( ! options . sandbox ? [ '--no-sandbox' ] : [ ] ) . concat ( [
9091 '--disable-translate' ,
9192 '--disable-extensions' ,
9293 '--disable-sync'
@@ -104,7 +105,7 @@ const relaxedGlobals = {
104105 busy : false ,
105106 config : { } ,
106107 configPlugins : [ ] ,
107- basedir : program . basedir || inputDir
108+ basedir : options . basedir || inputDir
108109}
109110
110111var updateConfig = async function ( ) {
@@ -114,7 +115,7 @@ var updateConfig = async function () {
114115 if ( configPath . endsWith ( '.json' ) ) {
115116 relaxedGlobals . config = JSON . parse ( data )
116117 } else {
117- relaxedGlobals . config = yaml . safeLoad ( data )
118+ relaxedGlobals . config = yaml . load ( data )
118119 }
119120 }
120121 await plugins . updateRegisteredPlugins ( relaxedGlobals , inputDir )
@@ -141,7 +142,7 @@ async function main () {
141142
142143 await build ( inputPath )
143144
144- if ( program . buildOnce ) {
145+ if ( options . buildOnce ) {
145146 process . exit ( 0 )
146147 } else {
147148 watch ( )
@@ -163,7 +164,7 @@ async function build (filepath) {
163164
164165 var updatedLocals = false
165166 if ( isLastLocalJsonPath ( filepath ) ) {
166- locals = parseLocals ( program . locals , inputDir )
167+ locals = parseLocals ( options . locals , inputDir )
167168 updatedLocals = true
168169 }
169170
0 commit comments