From f5828d1fe6d431ca2a2ff2a91a29de055d90994d Mon Sep 17 00:00:00 2001 From: BeAmazedVariable Date: Fri, 8 Oct 2021 23:07:19 -0400 Subject: [PATCH] Adding config.json and support default configuration --- README.md | 9 ++++++++- src/argv.ts | 2 ++ src/config.json | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/config.json diff --git a/README.md b/README.md index c98dfe2..b426ad0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **OSD_SSG** is a static site generator, implemented as part of Seneca College's OSD600 course. -> An *SSG* is a tool for generating a complete HTML web site from raw data and files, without having to author any HTML by hand. Imagine that you have a folder of text files that you want to turn into a website. An SSG allows you to enter a simple command that creates .html output files from a given set of input files. +> An _SSG_ is a tool for generating a complete HTML web site from raw data and files, without having to author any HTML by hand. Imagine that you have a folder of text files that you want to turn into a website. An SSG allows you to enter a simple command that creates .html output files from a given set of input files. ## Demo @@ -19,6 +19,7 @@ Options: -s, --stylesheet Custom stylesheet [string] -h, --help Show help [boolean] -v, --version Show version number [boolean] + -c,--config Use default configuration in config file [string] ``` ## Features @@ -39,6 +40,12 @@ exe ts-node src/index.ts -i Sherlock\ Holmes\ Selected\ Stories\ / -r -e -s src/styles/retro.css ``` +Using config file: + +``` +ts-node .\src\index.ts --config .\src\config.json +``` + ## Authors - [@Dukemanh](https://www.github.com/dukemanh) diff --git a/src/argv.ts b/src/argv.ts index cd1b5ef..e75f417 100644 --- a/src/argv.ts +++ b/src/argv.ts @@ -67,6 +67,8 @@ const argv = yargs logError(error?.message || msg); process.exit(9); }) + .config() + .alias('config', 'c') .help() .alias('help', 'h') .version() diff --git a/src/config.json b/src/config.json new file mode 100644 index 0000000..360a31a --- /dev/null +++ b/src/config.json @@ -0,0 +1,7 @@ +{ + "input": "./Sherlock-Holmes-Selected-Stories", + "output":"./dist", + "lang" : "en-CA", + "stylesheet" : "./src/styles/index.css" + +} \ No newline at end of file