From 15f05bdc2784914ff298b0de8e775c17624678bc Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:27:37 +0200 Subject: [PATCH 1/7] refactor(snackager): drop `npm bin` in favor of `which yarn` --- snackager/src/utils/installDependencies.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/snackager/src/utils/installDependencies.ts b/snackager/src/utils/installDependencies.ts index 840c6d516..4f7b62dd0 100644 --- a/snackager/src/utils/installDependencies.ts +++ b/snackager/src/utils/installDependencies.ts @@ -1,5 +1,4 @@ import spawnAsync, { SpawnPromise, SpawnResult } from '@expo/spawn-async'; -import path from 'path'; import logger from '../logger'; import { Package } from '../types'; @@ -39,9 +38,8 @@ export function spawnSafeAsync( } export async function getYarnPackagerAsync(): Promise { - const npmBinOutput = await spawnSafeAsync('npm', ['bin']); - const yarn = path.resolve(npmBinOutput.stdout.trim(), 'yarn'); - return yarn; + const yarnBinaryPath = await spawnSafeAsync('which', ['yarnpkg']); + return yarnBinaryPath.stdout.trim(); } async function installDependencyAsync( From a1049b054948235ca0b6145de3a299a57bbb04df Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:28:53 +0200 Subject: [PATCH 2/7] refactor(snackager): drop npm version limitation --- .github/actions/setup-snackager/action.yml | 6 ------ snackager/Dockerfile | 3 --- 2 files changed, 9 deletions(-) diff --git a/.github/actions/setup-snackager/action.yml b/.github/actions/setup-snackager/action.yml index f975e8d4e..94631d98c 100644 --- a/.github/actions/setup-snackager/action.yml +++ b/.github/actions/setup-snackager/action.yml @@ -15,12 +15,6 @@ runs: node-version: ${{ inputs.node-version }} cache: yarn - # npm v7+ doesn't work well with our monorepo - - name: 🐛 Downgrade npm to v6 - run: npm install --global npm@^6 - working-directory: ../ - shell: bash - - name: 📦 Install dependencies run: yarn install --frozen-lockfile --ignore-scripts shell: bash diff --git a/snackager/Dockerfile b/snackager/Dockerfile index f754b2665..6ead803f5 100644 --- a/snackager/Dockerfile +++ b/snackager/Dockerfile @@ -22,9 +22,6 @@ ENV NODE_OPTIONS --openssl-legacy-provider ARG APP_VERSION ENV APP_VERSION ${APP_VERSION} -# Install system dependencies -RUN npm install --global npm@^6 - # --- Development - Prepare Snackager for development FROM base as development From 2a122a2169072b0cfbf2bb21c8f28bcf27994f53 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:34:08 +0200 Subject: [PATCH 3/7] refactor(snackager): drop yarn as dependency --- snackager/Dockerfile | 3 +++ snackager/package.json | 3 +-- yarn.lock | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/snackager/Dockerfile b/snackager/Dockerfile index 6ead803f5..a26de6805 100644 --- a/snackager/Dockerfile +++ b/snackager/Dockerfile @@ -42,6 +42,9 @@ RUN yarn turbo build --filter "{./snackager}^..." WORKDIR /app/snackager CMD ["yarn", "start"] +# Install yarn globally +RUN npm install --global yarn@^1.22.22 + # --- Deploy - Prepare Snackager for production FROM base as deploy diff --git a/snackager/package.json b/snackager/package.json index 1c1ad20df..1056df801 100644 --- a/snackager/package.json +++ b/snackager/package.json @@ -56,8 +56,7 @@ "source-map-support": "^0.4.15", "targz": "^1.0.1", "validate-npm-package-name": "^3.0.0", - "webpack": "^5.40.0", - "yarn": "^1.22.5" + "webpack": "^5.40.0" }, "devDependencies": { "@google-cloud/secret-manager": "^5.0.1", diff --git a/yarn.lock b/yarn.lock index bc336748a..82371de00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15603,6 +15603,14 @@ sucrase@3.34.0: version "3.34.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.34.0.tgz#1e0e2d8fcf07f8b9c3569067d92fbd8690fb576f" integrity sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.2" + commander "^4.0.0" + glob "7.1.6" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" sudo-block@^3.0.0: version "3.0.0" @@ -17444,11 +17452,6 @@ yargs@~3.10.0: decamelize "^1.0.0" window-size "0.1.0" -yarn@^1.22.5: - version "1.22.10" - resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.10.tgz#c99daa06257c80f8fa2c3f1490724e394c26b18c" - integrity sha512-IanQGI9RRPAN87VGTF7zs2uxkSyQSrSPsju0COgbsKQOOXr5LtcVPeyXWgwVa0ywG3d8dg6kSYKGBuYK021qeA== - ylru@^1.2.0: version "1.2.1" resolved "https://registry.yarnpkg.com/ylru/-/ylru-1.2.1.tgz#f576b63341547989c1de7ba288760923b27fe84f" From 82f365f091924819b44b9139aa594377c32e0a17 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:39:29 +0200 Subject: [PATCH 4/7] chore: rebuild lockfile --- yarn.lock | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 82371de00..db80e856f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4426,7 +4426,7 @@ ansi-to-html@^0.6.14: dependencies: entities "^1.1.2" -any-promise@^1.1.0: +any-promise@^1.0.0, any-promise@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= @@ -12254,6 +12254,15 @@ mv@~2: ncp "~2.0.0" rimraf "~2.4.0" +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + nan@^2.12.1, nan@^2.14.0: version "2.14.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" @@ -15843,6 +15852,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + throat@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" @@ -16060,6 +16083,11 @@ ts-api-utils@^1.0.1: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== +ts-interface-checker@^0.1.9: + version "0.1.13" + resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" + integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== + ts-jest@^26.5.0: version "26.5.0" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.0.tgz#3e3417d91bc40178a6716d7dacc5b0505835aa21" From 80ffe02e9a3eed7abd4c48bde327b36d00c37ed1 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:41:31 +0200 Subject: [PATCH 5/7] chore(snack-runtime): rebuild lockfile --- packages/snack-runtime/yarn.lock | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/snack-runtime/yarn.lock b/packages/snack-runtime/yarn.lock index 26d0013c2..e689b7e40 100644 --- a/packages/snack-runtime/yarn.lock +++ b/packages/snack-runtime/yarn.lock @@ -8801,10 +8801,10 @@ snack-babel-standalone@^4.0.0: resolved "https://registry.yarnpkg.com/snack-babel-standalone/-/snack-babel-standalone-4.0.0.tgz#17ee9134a515af3e2fc44d90598656c0903f665c" integrity sha512-DB01CChul97KielzlP88miUx93E0o6ebnbNa2aah+KIl+vwcXbTuzc55KNNNrGELF5N8rpd74PYi23y/DqemKA== -snack-content@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/snack-content/-/snack-content-2.0.0.tgz#74f0e39467655bce9cec9f513201780471c237c7" - integrity sha512-oDoIuGEd3uSs/8eEdNbj2Jmq9g9iRbagGFpWmb01isKhJmN2s5Maq42I6toOq6mOWCaX69uiNlioOUzlFkt09g== +snack-content@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/snack-content/-/snack-content-3.0.0.tgz#a5d94c7973c5d3aeed82204aec415f393b87d5ec" + integrity sha512-q8y3OivrqEpy7jdahs3UlXGtv3SM2XE/lotMeTkv6FVC1eZ2djcmEQG322jpHwIZ7DzQdk8TT2n8nAk2mSY2dQ== dependencies: semver "^7.3.4" @@ -9117,6 +9117,14 @@ sucrase@3.34.0: version "3.34.0" resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.34.0.tgz#1e0e2d8fcf07f8b9c3569067d92fbd8690fb576f" integrity sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.2" + commander "^4.0.0" + glob "7.1.6" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" sudo-prompt@9.1.1: version "9.1.1" From 2daeeef18ea1569ee5dffe9cdb53b97ea6917b3b Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:44:08 +0200 Subject: [PATCH 6/7] chore(snackager): depend on node image provided yarn --- snackager/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/snackager/Dockerfile b/snackager/Dockerfile index a26de6805..6ead803f5 100644 --- a/snackager/Dockerfile +++ b/snackager/Dockerfile @@ -42,9 +42,6 @@ RUN yarn turbo build --filter "{./snackager}^..." WORKDIR /app/snackager CMD ["yarn", "start"] -# Install yarn globally -RUN npm install --global yarn@^1.22.22 - # --- Deploy - Prepare Snackager for production FROM base as deploy From 8312bc4539bf8376792408c1a14dfbb8d99f7c7b Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 11 Jul 2024 15:46:24 +0200 Subject: [PATCH 7/7] chore(snackager): update git snapshot --- .../src/{__tests__ => __e2e__}/__snapshots__/git.test.ts.snap | 2 +- snackager/src/{__tests__ => __e2e__}/app.test.ts | 0 snackager/src/{__tests__ => __e2e__}/git.test.ts | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename snackager/src/{__tests__ => __e2e__}/__snapshots__/git.test.ts.snap (99%) rename snackager/src/{__tests__ => __e2e__}/app.test.ts (100%) rename snackager/src/{__tests__ => __e2e__}/git.test.ts (100%) diff --git a/snackager/src/__tests__/__snapshots__/git.test.ts.snap b/snackager/src/__e2e__/__snapshots__/git.test.ts.snap similarity index 99% rename from snackager/src/__tests__/__snapshots__/git.test.ts.snap rename to snackager/src/__e2e__/__snapshots__/git.test.ts.snap index 3fafac781..72c89d3ac 100644 --- a/snackager/src/__tests__/__snapshots__/git.test.ts.snap +++ b/snackager/src/__e2e__/__snapshots__/git.test.ts.snap @@ -103,7 +103,7 @@ exports[`git imports repository with app.config.js 1`] = ` }, "description": "some-example @ Jan 1, 2020", "name": "some-example", - "sdkVersion": "51.0.0", + "sdkVersion": "50.0.0", }, }, "headers": { diff --git a/snackager/src/__tests__/app.test.ts b/snackager/src/__e2e__/app.test.ts similarity index 100% rename from snackager/src/__tests__/app.test.ts rename to snackager/src/__e2e__/app.test.ts diff --git a/snackager/src/__tests__/git.test.ts b/snackager/src/__e2e__/git.test.ts similarity index 100% rename from snackager/src/__tests__/git.test.ts rename to snackager/src/__e2e__/git.test.ts