From a468a31d3067d3d26f6f801add642b8c455e848e Mon Sep 17 00:00:00 2001 From: James George Date: Tue, 10 Mar 2020 12:23:33 +0530 Subject: [PATCH] chore(deps): switch to yargs-parser lib (#3377) * chore: switch to yargs-parser lib * fix: lint * Use named imports from 'path' * Disable camel-case-expansion Co-authored-by: Lukas Taegert-Atkinson Co-authored-by: Lukas Taegert-Atkinson --- LICENSE.md | 62 +++++++++++++++++++++++++++------------------- cli/index.ts | 7 +++--- package-lock.json | 40 ++++++++++++++++++++++-------- package.json | 6 ++--- src/watch/watch.ts | 2 +- 5 files changed, 74 insertions(+), 43 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 8df2facb746..726831dfdc9 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -195,6 +195,13 @@ Repository: micromatch/braces --------------------------------------- +## camelcase +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/camelcase + +--------------------------------------- + ## chokidar License: MIT By: Paul Miller, Elan Shanker @@ -246,6 +253,13 @@ Repository: sindresorhus/date-time --------------------------------------- +## decamelize +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/decamelize + +--------------------------------------- + ## fill-range License: MIT By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling @@ -499,32 +513,6 @@ Repository: https://github.com/calvinmetcalf/minimalistic-assert.git --------------------------------------- -## minimist -License: MIT -By: James Halliday -Repository: git://github.com/substack/minimist.git - -> This software is released under the MIT license: -> -> Permission is hereby granted, free of charge, to any person obtaining a copy of -> this software and associated documentation files (the "Software"), to deal in -> the Software without restriction, including without limitation the rights to -> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -> the Software, and to permit persons to whom the Software is furnished to do so, -> subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in all -> copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ---------------------------------------- - ## normalize-path License: MIT By: Jon Schlinkert, Blaine Bublitz @@ -733,3 +721,25 @@ Repository: micromatch/to-regex-range > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN > THE SOFTWARE. + +--------------------------------------- + +## yargs-parser +License: ISC +By: Ben Coe +Repository: git@github.com:yargs/yargs-parser.git + +> Copyright (c) 2016, Contributors +> +> Permission to use, copy, modify, and/or distribute this software +> for any purpose with or without fee is hereby granted, provided +> that the above copyright notice and this permission notice +> appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +> OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +> LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +> OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/cli/index.ts b/cli/index.ts index e54fcb04502..1243fc45a51 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -1,11 +1,12 @@ import help from 'help.md'; -import minimist from 'minimist'; import { version } from 'package.json'; +import argParser from 'yargs-parser'; import { commandAliases } from '../src/utils/mergeOptions'; import run from './run/index'; -const command = minimist(process.argv.slice(2), { - alias: commandAliases +const command = argParser(process.argv.slice(2), { + alias: commandAliases, + configuration: { 'camel-case-expansion': false } }); if (command.help || (process.argv.length <= 2 && process.stdin.isTTY)) { diff --git a/package-lock.json b/package-lock.json index f4f8e0b4659..c443665ba38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -421,12 +421,6 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", "dev": true }, - "@types/minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=", - "dev": true - }, "@types/node": { "version": "13.9.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.0.tgz", @@ -458,6 +452,12 @@ "@types/node": "*" } }, + "@types/yargs-parser": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", + "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==", + "dev": true + }, "acorn": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", @@ -693,7 +693,7 @@ "integrity": "sha512-IoGZzrUTY5fKXVkgGHw3QeXFMUNBFv+9l8a4QJKG1JhG3nCMHTdEX1DCOg8568E2Q9qvAQIiSokv6Jsgx8p2cA==", "dev": true, "requires": { - "acorn": "^7.1.1", + "acorn": "^6.1.1", "acorn-dynamic-import": "^4.0.0", "acorn-jsx": "^5.0.1", "chalk": "^2.4.2", @@ -3431,6 +3431,16 @@ "requires": { "has-flag": "^3.0.0" } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, @@ -5285,13 +5295,23 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", + "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", "dev": true, "requires": { "camelcase": "^5.0.0", diff --git a/package.json b/package.json index 12e82b40269..a44bbe9f6cf 100644 --- a/package.json +++ b/package.json @@ -70,8 +70,8 @@ "@rollup/plugin-node-resolve": "^7.1.1", "@rollup/plugin-replace": "^2.3.1", "@types/micromatch": "^4.0.1", - "@types/minimist": "^1.2.0", "@types/node": "^13.9.0", + "@types/yargs-parser": "^15.0.0", "acorn": "^7.1.1", "acorn-export-ns-from": "^0.1.0", "acorn-import-meta": "^1.0.0", @@ -99,7 +99,6 @@ "magic-string": "^0.25.7", "markdownlint-cli": "^0.22.0", "micromatch": "^4.0.2", - "minimist": "^1.2.0", "mocha": "^7.1.0", "node-fetch": "^2.6.0", "nyc": "^15.0.0", @@ -125,7 +124,8 @@ "tslib": "^1.11.1", "tslint": "^6.0.0", "typescript": "^3.8.3", - "url-parse": "^1.4.7" + "url-parse": "^1.4.7", + "yargs-parser": "^16.1.0" }, "files": [ "dist/**/*.js", diff --git a/src/watch/watch.ts b/src/watch/watch.ts index 3d7ad03d3ed..2427b8cfd9b 100644 --- a/src/watch/watch.ts +++ b/src/watch/watch.ts @@ -1,4 +1,4 @@ -import path from 'path'; +import * as path from 'path'; import createFilter from 'rollup-pluginutils/src/createFilter'; import { rollupInternal } from '../rollup/rollup'; import {