diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..0b76b29 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,33 @@ +module.exports = { + 'env': { + 'commonjs': true, + 'es6': true, + 'node': true + }, + 'extends': 'eslint:recommended', + 'globals': { + 'Atomics': 'readonly', + 'SharedArrayBuffer': 'readonly' + }, + 'parserOptions': { + 'ecmaVersion': 2018 + }, + 'rules': { + 'indent': [ + 'error', + 4 + ], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always' + ] + } +}; \ No newline at end of file diff --git a/.gitignore b/.gitignore index cdf8037..bb14eca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ node_modules/ coverage npm-debug.log +.nyc_output/ +package-lock.json + diff --git a/.mocharc.js b/.mocharc.js new file mode 100644 index 0000000..1bb971f --- /dev/null +++ b/.mocharc.js @@ -0,0 +1,5 @@ +module.exports = { + extension: ['.spec.js'], + recursive: true, + reporter: 'spec' +} diff --git a/.travis.yml b/.travis.yml index 7ab9726..0570f30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: node_js node_js: - - 0.10 + - 6 script: "npm run-script travis" after_success: " [--allow-missing-option][--option-as-json]] ') - .option('help', { - alias: 'h', - description: 'This help text.', - type: 'boolean' - }) - .option('ignore', { - alias: 'i', - description: 'Absolute path or glob pattern for ignoring included files.', - type: 'string' - }) - .option('lint', { - alias: 'l', - description: 'Lint the input file and report any errors.', - type: 'boolean' - }) - .option('extract-option', { - alias: 'o', - description: 'Extract the value of an option.', - type: 'string' - }) - .option('option-as-json', { - alias: 'j', - description: 'The extracted value will be extracted as JSON.', - type: 'boolean' - }) - .option('public', { - alias: 'p', - description: 'Only values in #public objects will be extracted.', - type: 'boolean' - }) - .option('json', { type: 'boolean' }) - .option('allow-missing-option', { - alias: 'm', - description: 'Do not fail when no such value is present.', - type: 'boolean' - }) - .option('allowmissing', { type: 'boolean' }); - -var argv = argp.argv; +const oconf = require('../lib/index'); +const { Command } = require('commander'); +const program = new Command(); + +program + .name('oconf') + .usage('[--lint|--extract-option