mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-25 10:19:30 -05:00
chore: update shell-env to 4.x.x and import as an ESM-only package via tsx
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/* eslint-disable padding-line-between-statements */
|
||||
// created by autobarrel, do not modify directly
|
||||
|
||||
export * from './graphqlTypeUtils'
|
||||
export * from './nexusTypegenUtils'
|
||||
@@ -1,6 +1,5 @@
|
||||
import Promise from 'bluebird'
|
||||
import execa from 'execa'
|
||||
import shellEnv from 'shell-env'
|
||||
import _ from 'lodash'
|
||||
import debugModule from 'debug'
|
||||
const log = debugModule('cypress:server:exec')
|
||||
@@ -45,6 +44,22 @@ export const run = (projectRoot: string, options: any) => {
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
/**
|
||||
* To address https://gitlab.com/gitlab-org/security-products/gemnasium-db/-/blob/master/npm/execa/GMS-2020-2.yml
|
||||
* We needed to update shell-env from 3.x.x to 4.x.x. However, shell-env 4.x.x is an ESM-only package and cannot be
|
||||
* used purely in a CJS environment through require().
|
||||
*
|
||||
* To resolve this, we need to use the tsImport function from 'tsx' to import the shell-env package.
|
||||
* This function is a wrapper around the import function that allows us to import ESM-only packages in a CJS environment.
|
||||
* Normally, you can await import() an ESM-only package in a CJS environment. However, since this is TypeScript with a CJS target,
|
||||
* all import statements, even dynamic ones, are compiled down to require() statements and is the reason we cannot leverage that
|
||||
* technique here.
|
||||
*
|
||||
* Once @packages/server is converted to ESM, we can remove this and use import() directly at the top of the file.
|
||||
*/
|
||||
const { tsImport } = require('tsx/esm/api')
|
||||
const { shellEnv } = await tsImport('shell-env', __filename) as typeof import('shell-env')
|
||||
|
||||
const shellVariables = await shellEnv()
|
||||
const env = _.merge({}, shellVariables, process.env, options.env)
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
"sanitize-filename": "1.6.3",
|
||||
"send": "0.19.0",
|
||||
"serialize-error": "^7.0.1",
|
||||
"shell-env": "3.0.1",
|
||||
"shell-env": "4.0.1",
|
||||
"signal-exit": "3.0.7",
|
||||
"squirrelly": "7.9.2",
|
||||
"strip-ansi": "6.0.1",
|
||||
@@ -195,6 +195,7 @@
|
||||
"ssestream": "1.0.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-loader": "9.5.2",
|
||||
"tsx": "4.20.6",
|
||||
"tsconfig-paths": "3.10.1",
|
||||
"webpack": "^5.88.2",
|
||||
"ws": "5.2.4",
|
||||
|
||||
@@ -14246,10 +14246,10 @@ default-resolution@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/default-resolution/-/default-resolution-2.0.0.tgz#bcb82baa72ad79b426a76732f1a81ad6df26d684"
|
||||
integrity sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=
|
||||
|
||||
default-shell@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/default-shell/-/default-shell-1.0.1.tgz#752304bddc6174f49eb29cb988feea0b8813c8bc"
|
||||
integrity sha1-dSMEvdxhdPSespy5iP7qC4gTyLw=
|
||||
default-shell@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/default-shell/-/default-shell-2.2.0.tgz#31481c19747bfe59319b486591643eaf115a1864"
|
||||
integrity sha512-sPpMZcVhRQ0nEMDtuMJ+RtCxt7iHPAMBU+I4tAlo5dU1sjRpNax0crj6nR3qKpvVnckaQ9U38enXcwW9nZJeCw==
|
||||
|
||||
defaults@^1.0.3:
|
||||
version "1.0.3"
|
||||
@@ -28146,14 +28146,14 @@ shebang-regex@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
||||
|
||||
shell-env@3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/shell-env/-/shell-env-3.0.1.tgz#515a62f6cbd5e139365be2535745e8e53438ce77"
|
||||
integrity sha512-b09fpMipAQ9ObwvIeKoQFLDXcEcCpYUUZanlad4OYQscw2I49C/u97OPQg9jWYo36bRDn62fbe07oWYqovIvKA==
|
||||
shell-env@4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/shell-env/-/shell-env-4.0.1.tgz#883302d9426095d398a39b102a851adb306b8cb8"
|
||||
integrity sha512-w3oeZ9qg/P6Lu6qqwavvMnB/bwfsz67gPB3WXmLd/n6zuh7TWQZtGa3iMEdmua0kj8rivkwl+vUjgLWlqZOMPw==
|
||||
dependencies:
|
||||
default-shell "^1.0.1"
|
||||
execa "^1.0.0"
|
||||
strip-ansi "^5.2.0"
|
||||
default-shell "^2.0.0"
|
||||
execa "^5.1.1"
|
||||
strip-ansi "^7.0.1"
|
||||
|
||||
shell-quote@^1.6.1, shell-quote@^1.7.3, shell-quote@^1.8.1:
|
||||
version "1.8.1"
|
||||
|
||||
Reference in New Issue
Block a user