From df589305d0ec17d451038d85b8ccc21f7a3647d2 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Sun, 14 May 2023 17:58:06 +0200 Subject: [PATCH 1/2] fix: use yarn instead of npx with yarn.lock --- dist/index.js | 13 +++++++++---- index.js | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9c46b946e..2e650d75b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -74457,6 +74457,11 @@ const useYarn = () => fs.existsSync(yarnFilename) const usePnpm = () => fs.existsSync(pnpmLockFilename) const useNpm = () => fs.existsSync(packageLockFilename) +let runPrefix = 'npx' +if (useYarn()) { + runPrefix = 'yarn' +} + const lockHash = () => { const lockFilename = useYarn() ? yarnFilename @@ -74635,9 +74640,9 @@ const listCypressBinaries = () => { } core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER) - return io.which('npx', true).then((npxPath) => { + return io.which(runPrefix, true).then((runPath) => { return exec.exec( - quote(npxPath), + quote(runPath), ['cypress', 'cache', 'list'], cypressCommandOptions ) @@ -74654,9 +74659,9 @@ const verifyCypressBinary = () => { } core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER) - return io.which('npx', true).then((npxPath) => { + return io.which(runPrefix, true).then((runPath) => { return exec.exec( - quote(npxPath), + quote(runPath), ['cypress', 'verify'], cypressCommandOptions ) diff --git a/index.js b/index.js index 81311a294..24ee56534 100644 --- a/index.js +++ b/index.js @@ -106,6 +106,11 @@ const useYarn = () => fs.existsSync(yarnFilename) const usePnpm = () => fs.existsSync(pnpmLockFilename) const useNpm = () => fs.existsSync(packageLockFilename) +let runPrefix = 'npx' +if (useYarn()) { + runPrefix = 'yarn' +} + const lockHash = () => { const lockFilename = useYarn() ? yarnFilename @@ -284,9 +289,9 @@ const listCypressBinaries = () => { } core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER) - return io.which('npx', true).then((npxPath) => { + return io.which(runPrefix, true).then((runPath) => { return exec.exec( - quote(npxPath), + quote(runPath), ['cypress', 'cache', 'list'], cypressCommandOptions ) @@ -303,9 +308,9 @@ const verifyCypressBinary = () => { } core.exportVariable('CYPRESS_CACHE_FOLDER', CYPRESS_CACHE_FOLDER) - return io.which('npx', true).then((npxPath) => { + return io.which(runPrefix, true).then((runPath) => { return exec.exec( - quote(npxPath), + quote(runPath), ['cypress', 'verify'], cypressCommandOptions ) From 1dbbe0da61db34ab6865fcc89dc8be53b2f96176 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Tue, 13 Jun 2023 11:02:56 +0200 Subject: [PATCH 2/2] simplify runPrefix code Co-Authored-By: Stokes Player <1702361+warrensplayer@users.noreply.github.com> --- dist/index.js | 5 +---- index.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2e650d75b..b333a0be2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -74457,10 +74457,7 @@ const useYarn = () => fs.existsSync(yarnFilename) const usePnpm = () => fs.existsSync(pnpmLockFilename) const useNpm = () => fs.existsSync(packageLockFilename) -let runPrefix = 'npx' -if (useYarn()) { - runPrefix = 'yarn' -} +const runPrefix = useYarn() ? 'yarn' : 'npx' const lockHash = () => { const lockFilename = useYarn() diff --git a/index.js b/index.js index 24ee56534..529024748 100644 --- a/index.js +++ b/index.js @@ -106,10 +106,7 @@ const useYarn = () => fs.existsSync(yarnFilename) const usePnpm = () => fs.existsSync(pnpmLockFilename) const useNpm = () => fs.existsSync(packageLockFilename) -let runPrefix = 'npx' -if (useYarn()) { - runPrefix = 'yarn' -} +const runPrefix = useYarn() ? 'yarn' : 'npx' const lockHash = () => { const lockFilename = useYarn()