diff --git a/.gitignore b/.gitignore index de4d1f0..c4f24f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.vscode dist node_modules diff --git a/src/config.ts b/src/config.ts index 113ae0f..e982af0 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,14 +1,14 @@ -interface Settings { - [key: string]: any, - product?: 'assets_swtor_de_de' | 'assets_swtor_en_us' | 'assets_swtor_fr_fr' | 'assets_swtor_main' | 'assets_swtor_test_de_de' | 'assets_swtor_test_en_us' | 'assets_swtor_test_fr_fr' | 'assets_swtor_test_main' | 'eualas' | 'movies_de_de' | 'movies_en_us' | 'movies_fr_fr' | 'patcher2014' | 'patcher2017' | 'retailclient_betatest' | 'retailclient_cstraining' | 'retailclient_liveeptest' | 'retailclient_publictest' | 'retailclient_squadron157' | 'retailclient_swtor' - release?: number, //TODO: allow 'current', but how will we know what current version is? - from?: number, - outputType?: 'info' | 'file', //whether to just show JSON information, or actually write files into a directory +interface ISettings { + [key: string]: any; + product?: 'assets_swtor_de_de' | 'assets_swtor_en_us' | 'assets_swtor_fr_fr' | 'assets_swtor_main' | 'assets_swtor_test_de_de' | 'assets_swtor_test_en_us' | 'assets_swtor_test_fr_fr' | 'assets_swtor_test_main' | 'eualas' | 'movies_de_de' | 'movies_en_us' | 'movies_fr_fr' | 'patcher2014' | 'patcher2017' | 'retailclient_betatest' | 'retailclient_cstraining' | 'retailclient_liveeptest' | 'retailclient_publictest' | 'retailclient_squadron157' | 'retailclient_swtor'; + release?: number; //TODO: allow 'current', but how will we know what current version is? + from?: number; + outputType?: 'info' | 'file'; //whether to just show JSON information, or actually write files into a directory } -const allowedProducts: Settings["product"][] = ['assets_swtor_de_de', 'assets_swtor_en_us', 'assets_swtor_fr_fr', 'assets_swtor_main', 'assets_swtor_test_de_de', 'assets_swtor_test_en_us', 'assets_swtor_test_fr_fr', 'assets_swtor_test_main', 'eualas', 'movies_de_de', 'movies_en_us', 'movies_fr_fr', 'patcher2014', 'patcher2017', 'retailclient_betatest', 'retailclient_cstraining', 'retailclient_liveeptest', 'retailclient_publictest', 'retailclient_squadron157', 'retailclient_swtor']; +const allowedProducts: Array = ['assets_swtor_de_de', 'assets_swtor_en_us', 'assets_swtor_fr_fr', 'assets_swtor_main', 'assets_swtor_test_de_de', 'assets_swtor_test_en_us', 'assets_swtor_test_fr_fr', 'assets_swtor_test_main', 'eualas', 'movies_de_de', 'movies_en_us', 'movies_fr_fr', 'patcher2014', 'patcher2017', 'retailclient_betatest', 'retailclient_cstraining', 'retailclient_liveeptest', 'retailclient_publictest', 'retailclient_squadron157', 'retailclient_swtor']; -const settings: Settings = {}; +const settings: ISettings = {}; /** Sets the given setting to the given value. Throws an error if key is invalid, or value doesn't match the key. */ export const set = (key: string, value: any) => { @@ -16,8 +16,8 @@ export const set = (key: string, value: any) => { case 'product': //TODO: need to verify input (one of allowed products) if (typeof value !== 'string') { throw new Error(`product must be a string but it's a "${typeof value}".`); } - if (!allowedProducts.includes(value as Settings["product"])) { throw new Error(`"${value}" is not an allowed product.`); } - settings.product = value as Settings["product"]; + if (!allowedProducts.includes(value as ISettings['product'])) { throw new Error(`"${value}" is not an allowed product.`); } + settings.product = value as ISettings['product']; break; case 'release': //verify input (must be a number >=0, and >settings.from) diff --git a/src/index.ts b/src/index.ts index 5f2a154..3455040 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,5 @@ import * as config from './config'; -console.log('Hello world!'); - //TODO: read arguments from command-line instead: process.argv config.set('product', 'assets_swtor_en_us'); config.set('release', 120); diff --git a/src/tslint.json b/src/tslint.json new file mode 100644 index 0000000..fdf4be6 --- /dev/null +++ b/src/tslint.json @@ -0,0 +1,14 @@ +{ + "defaultSeverity": "error", + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": { + "comment-format": false, + "max-line-length": false, + "no-bitwise": false, + "quotemark": [true, "single"] + }, + "rulesDirectory": [] +}