From 4ac239c81541996010c14fc47af395b72878bc7c Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Sun, 12 Apr 2020 11:39:57 +0300 Subject: [PATCH] fix: add build process to package, make compatible with npx --- bin/{cli.js => cli.cjs} | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) rename bin/{cli.js => cli.cjs} (90%) diff --git a/bin/cli.js b/bin/cli.cjs similarity index 90% rename from bin/cli.js rename to bin/cli.cjs index 40131af..f01d4e2 100644 --- a/bin/cli.js +++ b/bin/cli.cjs @@ -6,7 +6,7 @@ const path = require('path') const { createJSBundle } = require('../scripts/build-bundle-global') if (args.global && args.outfile) { - let outputFilepath = path.join(process.cwd(), args.outfile) + const outputFilepath = path.join(process.cwd(), args.outfile) createJSBundle({ outputFilepath diff --git a/package.json b/package.json index 22431f9..ab8597e 100644 --- a/package.json +++ b/package.json @@ -3,19 +3,20 @@ "version": "0.0.0-development", "description": "Inject JS to the DOM to find vulnerable JavaScript libraries", "bin": { - "js-vulns-detector": "./bin/cli.js" + "js-vulns-detector": "./bin/cli.cjs" }, "engines": { "node": ">=10.0.0" }, "type": "module", "scripts": { - "build": "node ./bin/cli.js --global --outfile dist/bundle-global.js", + "build": "node ./bin/cli.cjs --global --outfile dist/bundle-global.js", "lint": "eslint src/* && npm run lint:lockfile", "lint:lockfile": "lockfile-lint --path package-lock.json --type npm --validate-https --allowed-hosts npm yarn", "lint:fix": "eslint . --fix", "format": "prettier --config .prettierrc.js --write '**/*.js'", "test": "jest", + "prepare": "npm run build", "test:watch": "jest --watch", "coverage:view": "open-cli coverage/lcov-report/index.html", "semantic-release": "semantic-release"