Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace arg devDep with minimist; remove unused shx devDep #26727

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
49 changes: 25 additions & 24 deletions scripts/binary/move-binaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions scripts/sanitize.js
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand Down Expand Up @@ -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}"`)
}
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8689,11 +8689,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.0.tgz#583c518199419e0037abb74062c37f8519e575f0"
integrity sha512-ZWc51jO3qegGkVh8Hwpv636EkbesNV5ZNQPCtRa+0qytRYPEs9IYT9qITY9buezqUH5uqyzlWLcufrzU2rffdg==

[email protected]:
version "4.1.2"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064"
integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==

[email protected], arg@^4.1.0:
version "4.1.3"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
Expand Down Expand Up @@ -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==

[email protected], shelljs@^0.8.4:
[email protected]:
version "0.8.5"
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
Expand All @@ -26681,14 +26676,6 @@ shiki@^0.9.12:
onigasm "^2.2.5"
vscode-textmate "5.2.0"

[email protected]:
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"
Expand Down