diff --git a/npm/create-cypress-tests/package.json b/npm/create-cypress-tests/package.json index e52091e85c9f..7b6c5d0ba0d1 100644 --- a/npm/create-cypress-tests/package.json +++ b/npm/create-cypress-tests/package.json @@ -40,7 +40,6 @@ "copy": "0.3.2", "mocha": "7.1.1", "mock-fs": "5.1.1", - "shx": "0.3.3", "snap-shot-it": "7.9.3", "typescript": "^4.7.4" }, diff --git a/package.json b/package.json index 5a168fda3807..c8a1778796d9 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,6 @@ "@typescript-eslint/eslint-plugin": "4.18.0", "@typescript-eslint/parser": "4.18.0", "@urql/introspection": "^0.3.0", - "arg": "4.1.2", "ascii-table": "0.0.9", "autobarrel": "^1.1.0", "aws-sdk": "2.814.0", @@ -195,7 +194,6 @@ "semantic-release-monorepo": "7.0.3", "semver": "7.3.2", "shelljs": "0.8.5", - "shx": "0.3.3", "sinon": "7.3.2", "snap-shot-it": "7.9.3", "start-server-and-test": "1.10.8", diff --git a/scripts/binary/move-binaries.ts b/scripts/binary/move-binaries.ts index 2b4a8a67e243..6effc892df1e 100644 --- a/scripts/binary/move-binaries.ts +++ b/scripts/binary/move-binaries.ts @@ -4,9 +4,8 @@ import { s3helpers } from './s3-api' const debug = require('debug')('cypress:binary') import la from 'lazy-ass' import is from 'check-more-types' -// using "arg" module for parsing CLI arguments -// because it plays really nicely with TypeScript -import arg from 'arg' + +import minimist from 'minimist' import pluralize from 'pluralize' // inquirer-confirm is missing type definition @@ -112,36 +111,38 @@ export const prompts = { */ export const moveBinaries = async (args = []) => { debug('moveBinaries with args %o', args) - const options = arg({ - '--s3bucket': String, - '--s3folder': String, - '--commit': String, - '--version': String, + + const supportedOptions = [ + 's3bucket', + 's3folder', + 'commit', + 'version', // optional, if passed, only the binary for that platform will be moved - '--platformArch': String, - // aliases - '--sha': '--commit', - '-v': '--version', - }, { - argv: args.slice(2), + 'platformArch', + ] + + const options = minimist(args.slice(2), { + string: supportedOptions, + alias: { + commit: ['sha'], + version: ['v'], + }, }) debug('moveBinaries with options %o', options) - // @ts-ignore - la(is.commitId(options['--commit']), 'missing or invalid commit SHA', options) - // @ts-ignore - la(is.semver(options['--version']), 'missing version to collect', options) + la(is.commitId(options.commit), 'missing or invalid commit SHA', options) + la(is.semver(options.version), 'missing version to collect', options) const releaseOptions: ReleaseInformation = { - commit: options['--commit'], - version: options['--version'], + commit: options.commit, + version: options.version, } const credentials = await uploadUtils.getS3Credentials() const aws = { - 'bucket': options['--s3bucket'] || uploadUtils.S3Configuration.bucket, - 'folder': options['--s3folder'] || uploadUtils.S3Configuration.releaseFolder, + bucket: options.s3bucket || uploadUtils.S3Configuration.bucket, + folder: options.s3folder || uploadUtils.S3Configuration.releaseFolder, } const s3 = s3helpers.makeS3(credentials) @@ -151,8 +152,8 @@ export const moveBinaries = async (args = []) => { let platforms: platformArch[] = uploadUtils.getValidPlatformArchs() as platformArch[] - if (options['--platformArch']) { - const onlyPlatform = options['--platformArch'] + if (options.platformArch) { + const onlyPlatform = options.platformArch console.log('only moving single platform %s', onlyPlatform) la(uploadUtils.isValidPlatformArch(onlyPlatform), 'invalid platform-arch', onlyPlatform) diff --git a/scripts/sanitize.js b/scripts/sanitize.js index 15dbded11763..da8e9c7763da 100644 --- a/scripts/sanitize.js +++ b/scripts/sanitize.js @@ -1,9 +1,9 @@ // call this script to sanitize output of the command // AFTER converting ANSI escape codes into HTML tags -const arg = require('arg') +const minimist = require('minimist') -const args = arg({ - '--type': String, +const args = minimist(process.argv.slice(2), { + string: ['cli-info'], }) const sanitizeCliInfo = () => { @@ -42,10 +42,10 @@ const sanitizeCliInfo = () => { }) } -switch (args['--type']) { +switch (args.type) { case 'cli-info': sanitizeCliInfo() break default: - throw new Error(`Unknown STDOUT type to sanitize "${args['--type']}"`) + throw new Error(`Unknown STDOUT type to sanitize "${args.type}"`) } diff --git a/yarn.lock b/yarn.lock index 99448576b2d8..9993e196b22b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8689,11 +8689,6 @@ arg@4.1.0: resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0" integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg== -arg@4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064" - integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== - arg@4.1.3, arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -26663,7 +26658,7 @@ shell-quote@^1.6.1: resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.3.tgz#aa40edac170445b9a431e17bb62c0b881b9c4123" integrity sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw== -shelljs@0.8.5, shelljs@^0.8.4: +shelljs@0.8.5: version "0.8.5" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== @@ -26681,14 +26676,6 @@ shiki@^0.9.12: onigasm "^2.2.5" vscode-textmate "5.2.0" -shx@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/shx/-/shx-0.3.3.tgz#681a88c7c10db15abe18525349ed474f0f1e7b9f" - integrity sha512-nZJ3HFWVoTSyyB+evEKjJ1STiixGztlqwKLTUNV5KqMWtGey9fTd4KU1gdZ1X9BV6215pswQ/Jew9NsuS/fNDA== - dependencies: - minimist "^1.2.3" - shelljs "^0.8.4" - side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"