diff --git a/.eslintrc.js b/.eslintrc.js index 211f84f..0d9d9c0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,18 +5,14 @@ module.exports = { 'plugin:jsdoc/recommended', 'plugin:jest/style', 'plugin:jest/recommended', + 'plugin:node/recommended-script', ], - parserOptions: { - ecmaVersion: 2018, - sourceType: 'module', - }, plugins: [ 'jest', 'jsdoc', 'spellcheck', ], env: { - es6: true, node: true, 'jest/globals': true, }, diff --git a/.gitignore b/.gitignore index c947e99..a57cb6a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ node_modules/** yarn-error.log yarn.lock + +.eslintcache diff --git a/bin/cywp.js b/bin/cywp.js index c73c541..d38a87a 100644 --- a/bin/cywp.js +++ b/bin/cywp.js @@ -213,9 +213,7 @@ function getConfig () { ? 'please check the \'--project\' path!' : 'create cypress.json or use --path to direct to a valid cypress project' - console.error(`${errorMassage}\n${userHelper}`) - - process.exit(1) + commandFailed(`${errorMassage}\n${userHelper}`) } return checkConfig({ configFile: cypressPath, env: {} }, true) @@ -253,7 +251,5 @@ function commandFailed (errorMessage) { errorMessage = errorMessage.message } - console.error('Error: ' + errorMessage) - - process.exit(1) + throw new Error(errorMessage) } diff --git a/bin/preperdocs.js b/bin/preperdocs.js index d046557..53c84d9 100644 --- a/bin/preperdocs.js +++ b/bin/preperdocs.js @@ -1,4 +1,3 @@ -#!/usr/bin/env node /* eslint-disable spellcheck/spell-checker */ const { resolve, basename } = require('path') diff --git a/package.json b/package.json index 8178561..4fc5545 100644 --- a/package.json +++ b/package.json @@ -14,17 +14,20 @@ "type": "git", "url": "https://github.com/OmriBarZik/cywp.git" }, + "type": "commonjs", "bugs": { "url": "https://github.com/OmriBarZik/cywp/issues" }, "files": [ "src/**", - "bin/**" + "bin/cywp.js" ], "directories": { "lib": "./src ", - "test": "./test", - "bin": "./bin" + "test": "./test" + }, + "bin": { + "cywp": "bin/cywp.js" }, "scripts": { "start": "node index", @@ -42,6 +45,9 @@ "peerDependencies": { "cypress": ">=6.7.x" }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, "dependencies": { "command-exists": "1.2.9", "commander": "8.2.0"