diff --git a/.github/actions/run-c3-e2e/action.yml b/.github/actions/run-c3-e2e/action.yml index b9f72354098c..cca0388d2d4b 100644 --- a/.github/actions/run-c3-e2e/action.yml +++ b/.github/actions/run-c3-e2e/action.yml @@ -1,9 +1,12 @@ name: "Run C3 E2E Tests" description: "Runs the C3 E2E tests on npm, pnpm, and bun" inputs: - package-manager: + packageManager: description: "Which package manager to run the tests with" required: true + packageManagerVersion: + description: "Which package manager version to run the tests with" + required: true quarantine: description: "Whether to run the tests in quarantine mode" required: false @@ -20,11 +23,11 @@ inputs: runs: using: "composite" steps: - - if: ${{ matrix.pm == 'bun' }} - name: Install Bun ${{ env.bun-version }} + - if: ${{ inputs.packageManager == 'bun' }} + name: Install Bun ${{ inputs.packageManagerVersion }} uses: oven-sh/setup-bun@v1 with: - bun-version: ${{ env.bun-version }} + bun-version: ${{ inputs.packageManagerVersion }} # Needed because gatsby requires git - name: Configure Git @@ -36,21 +39,18 @@ runs: - name: E2E Tests id: run-e2e shell: bash - continue-on-error: true - run: pnpm run --filter create-cloudflare test:e2e:${{ inputs.package-manager }} + run: pnpm run test:e2e --filter create-cloudflare env: CLOUDFLARE_API_TOKEN: ${{ inputs.apiToken }} CLOUDFLARE_ACCOUNT_ID: ${{ inputs.accountId }} E2E_QUARANTINE: ${{ inputs.quarantine }} FRAMEWORK_CLI_TO_TEST: ${{ inputs.framework }} + TEST_PM: ${{ inputs.packageManager }} + TEST_PM_VERSION: ${{ inputs.packageManagerVersion }} - name: Upload Logs uses: actions/upload-artifact@v3 + if: always() with: name: e2e-logs-${{matrix.os}} path: packages/create-cloudflare/.e2e-logs - - - name: Fail if errors detected - shell: bash - if: ${{ steps.run-e2e.outcome == 'failure' }} - run: exit 1 diff --git a/.github/workflows/c3-e2e-dependabot.yml b/.github/workflows/c3-e2e-dependabot.yml index c36883178de0..584286befcf8 100644 --- a/.github/workflows/c3-e2e-dependabot.yml +++ b/.github/workflows/c3-e2e-dependabot.yml @@ -44,11 +44,17 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - pm: [npm, pnpm, bun, yarn] + pm: + [ + { name: npm, version: "0.0.0" }, + { name: pnpm, version: "9.0.0" }, + { name: bun, version: "1.0.3" }, + { name: yarn, verison: "1.0.0" }, + ] # include a single windows test with pnpm include: - os: windows-latest - pm: pnpm + pm: { name: pnpm, version: "9.0.0" } runs-on: ${{ matrix.os }} steps: - name: Checkout Repo @@ -58,11 +64,17 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies + with: + turbo-api: ${{ secrets.TURBO_API }} + turbo-team: ${{ secrets.TURBO_TEAM }} + turbo-token: ${{ secrets.TURBO_TOKEN }} + turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} - name: E2E Tests uses: ./.github/actions/run-c3-e2e with: - package-manager: ${{ matrix.pm }} + packageManager: ${{ matrix.pm.name }} + packageManagerVersion: ${{ matrix.pm.version }} framework: ${{ needs.get-dependabot-bumped-framework.outputs.bumped-framework-cli }} accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/c3-e2e-quarantine.yml b/.github/workflows/c3-e2e-quarantine.yml index cc9760c08a2a..f6d76ad99571 100644 --- a/.github/workflows/c3-e2e-quarantine.yml +++ b/.github/workflows/c3-e2e-quarantine.yml @@ -10,8 +10,7 @@ on: - main paths: - packages/create-cloudflare/** -env: - bun-version: 1.0.3 + jobs: e2e: timeout-minutes: 30 @@ -23,7 +22,12 @@ jobs: strategy: matrix: os: [ubuntu-latest] - pm: [npm, pnpm, bun] + pm: + [ + { name: npm, version: "0.0.0" }, + { name: pnpm, version: "9.0.0" }, + { name: bun, version: "1.0.3" }, + ] runs-on: ${{ matrix.os }} steps: - name: Checkout Repo @@ -33,11 +37,17 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies + with: + turbo-api: ${{ secrets.TURBO_API }} + turbo-team: ${{ secrets.TURBO_TEAM }} + turbo-token: ${{ secrets.TURBO_TOKEN }} + turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} - name: E2E Tests uses: ./.github/actions/run-c3-e2e with: - package-manager: ${{ matrix.pm }} + packageManager: ${{ matrix.pm.name}} + packageManagerVersion: ${{ matrix.pm.version }} quarantine: true accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/c3-e2e.yml b/.github/workflows/c3-e2e.yml index 3b703911f352..0544b2ca4d3f 100644 --- a/.github/workflows/c3-e2e.yml +++ b/.github/workflows/c3-e2e.yml @@ -10,8 +10,6 @@ on: - main paths: - packages/create-cloudflare/** -env: - bun-version: 1.0.3 jobs: e2e: @@ -27,11 +25,17 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - pm: [npm, pnpm, bun, yarn] + pm: + [ + { name: npm, version: "0.0.0" }, + { name: pnpm, version: "9.0.0" }, + { name: bun, version: "1.0.3" }, + { name: yarn, verison: "1.0.0" }, + ] # include a single windows test with pnpm include: - os: windows-latest - pm: pnpm + pm: { name: pnpm, version: "9.0.0" } runs-on: ${{ matrix.os }} steps: - name: Checkout Repo @@ -41,13 +45,25 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-dependencies + with: + turbo-api: ${{ secrets.TURBO_API }} + turbo-team: ${{ secrets.TURBO_TEAM }} + turbo-token: ${{ secrets.TURBO_TOKEN }} + turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }} + + - name: Build + run: pnpm run build + env: + NODE_ENV: "production" + CI_OS: ${{ runner.os }} - name: E2E Tests uses: ./.github/actions/run-c3-e2e env: NPM_PUBLISH_TOKEN: NOT_USED with: - package-manager: ${{ matrix.pm }} + packageManager: ${{ matrix.pm.name }} + packageManagerVersion: ${{ matrix.pm.version }} quarantine: false accountId: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }} apiToken: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 6cfc1ac8c999..c46b25017e59 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -51,7 +51,7 @@ jobs: NODE_ENV: "production" - name: Run tests - run: pnpm run test:e2e + run: pnpm run test:e2e --filter=wrangler env: CLOUDFLARE_API_TOKEN: ${{ secrets.TEST_CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.TEST_CLOUDFLARE_ACCOUNT_ID }} diff --git a/.github/workflows/prereleases.yml b/.github/workflows/prereleases.yml index 233120245540..92d8da06f934 100644 --- a/.github/workflows/prereleases.yml +++ b/.github/workflows/prereleases.yml @@ -45,7 +45,7 @@ jobs: NODE_OPTIONS: "--max_old_space_size=8192" - name: Publish wrangler@beta to NPM - run: pnpm publish --tag beta + run: pnpm --filter wrangler publish --tag beta env: NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} # this is the "test/staging" key for sparrow analytics @@ -53,13 +53,11 @@ jobs: ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} SENTRY_DSN: "https://9edbb8417b284aa2bbead9b4c318918b@sentry10.cfdata.org/583" ALGOLIA_PUBLIC_KEY: ${{ secrets.ALGOLIA_PUBLIC_KEY }} - working-directory: packages/wrangler - name: Publish create-cloudflare@beta to NPM - run: pnpm publish --tag beta + run: pnpm --filter create-cloudflare publish --tag beta env: NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - working-directory: packages/create-cloudflare - name: Get Package Version run: echo "WRANGLER_VERSION=$(npm view wrangler@beta version)" >> $GITHUB_ENV diff --git a/package.json b/package.json index 44f083e65f95..76635424f3df 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "prettify": "prettier . --write --ignore-unknown", "test": "vitest run --no-file-parallelism && dotenv -- turbo test --filter=wrangler --filter=miniflare --filter=kv-asset-handler --filter=@cloudflare/vitest-pool-workers --filter=@cloudflare/vitest-pool-workers-examples", "test:ci": "dotenv -- turbo test:ci --concurrency 1", - "test:e2e": "dotenv -- turbo test:e2e --log-order=stream --filter=wrangler", + "test:e2e": "dotenv -- turbo test:e2e --log-order=stream", "test:watch": "turbo test:watch", "type:tests": "dotenv -- turbo type:tests", "gen:package": "turbo gen package" diff --git a/packages/cli/package.json b/packages/cli/package.json index f80d9250194a..0bc2aa8cc40c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -31,7 +31,6 @@ "chalk": "^2.4.2", "esbuild": "^0.17.12", "log-update": "^5.0.1", - "pnpm": "^8.6.11", "undici": "5.28.4" } } diff --git a/packages/create-cloudflare/package.json b/packages/create-cloudflare/package.json index f75af8b840ab..882b48424a33 100644 --- a/packages/create-cloudflare/package.json +++ b/packages/create-cloudflare/package.json @@ -32,10 +32,7 @@ "check:type": "tsc", "lint": "eslint", "prepublishOnly": "pnpm -w run build", - "test:e2e:npm": "pnpm run build && cross-env TEST_PM=npm vitest run --config ./vitest-e2e.config.ts", - "test:e2e:pnpm": "pnpm run build && cross-env TEST_PM=pnpm vitest run --config ./vitest-e2e.config.ts", - "test:e2e:bun": "pnpm run build && cross-env TEST_PM=bun vitest run --config ./vitest-e2e.config.ts", - "test:e2e:yarn": "pnpm run build && cross-env TEST_PM=yarn vitest run --config ./vitest-e2e.config.ts", + "test:e2e": "vitest run --config ./vitest-e2e.config.ts", "test:unit": "vitest run --config ./vitest.config.ts", "test:unit:watch": "vitest --config ./vitest.config.ts", "watch": "node -r esbuild-register scripts/build.ts --watch", @@ -76,7 +73,6 @@ "indent-string": "^5.0.0", "magic-string": "^0.30.5", "open": "^8.4.0", - "pnpm": "^8.10.0", "recast": "^0.22.0", "semver": "^7.5.1", "undici": "5.28.4", @@ -84,8 +80,7 @@ "which-pm-runs": "^1.1.0", "wrangler": "workspace:*", "wrap-ansi": "^9.0.0", - "yargs": "^17.7.1", - "yarn": "^1.22.19" + "yargs": "^17.7.1" }, "engines": { "node": ">=18.14.1" diff --git a/packages/create-cloudflare/src/helpers/packageManagers.ts b/packages/create-cloudflare/src/helpers/packageManagers.ts index 21abed5640b4..7e2dca95e4e7 100644 --- a/packages/create-cloudflare/src/helpers/packageManagers.ts +++ b/packages/create-cloudflare/src/helpers/packageManagers.ts @@ -3,7 +3,6 @@ import path from "path"; import { brandColor, dim } from "@cloudflare/cli/colors"; import semver from "semver"; import whichPmRuns from "which-pm-runs"; -import { devDependencies } from "../../package.json"; import { runCommand } from "./command"; import type { C3Context } from "types"; @@ -23,29 +22,10 @@ export const detectPackageManager = () => { let { name, version } = pmInfo ?? { name: "npm", version: "0.0.0" }; - if (process.env.TEST_PM) { - switch (process.env.TEST_PM) { - case "pnpm": - name = "pnpm"; - version = devDependencies["pnpm"].replace("^", ""); - process.env.npm_config_user_agent = "pnpm"; - break; - case "yarn": - name = "yarn"; - version = devDependencies["yarn"].replace("^", ""); - process.env.npm_config_user_agent = "yarn"; - break; - case "bun": - name = "bun"; - version = "1.0.0"; - process.env.npm_config_user_agent = "bun"; - break; - case "npm": - name = "npm"; - version = "0.0.0"; - process.env.npm_config_user_agent = "npm"; - break; - } + if (process.env.TEST_PM && process.env.TEST_PM_VERSION) { + name = process.env.TEST_PM as PmName; + version = process.env.TEST_PM_VERSION; + process.env.npm_config_user_agent = name; } switch (name) { diff --git a/packages/create-cloudflare/turbo.json b/packages/create-cloudflare/turbo.json index b95b1bf457c1..de1e79910774 100644 --- a/packages/create-cloudflare/turbo.json +++ b/packages/create-cloudflare/turbo.json @@ -4,7 +4,13 @@ "pipeline": { "build": { - "env": ["VITEST", "TEST_PM", "npm_config_user_agent", "CI"], + "env": [ + "VITEST", + "TEST_PM", + "TEST_PM_VERSION", + "npm_config_user_agent", + "CI" + ], "outputs": ["dist/**"] }, "test:e2e:*": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea0e1390982b..d51fde9f6529 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -761,9 +761,6 @@ importers: log-update: specifier: ^5.0.1 version: 5.0.1 - pnpm: - specifier: ^8.6.11 - version: 8.6.11 undici: specifier: 5.28.4 version: 5.28.4 @@ -872,9 +869,6 @@ importers: open: specifier: ^8.4.0 version: 8.4.0 - pnpm: - specifier: ^8.10.0 - version: 8.10.2 recast: specifier: ^0.22.0 version: 0.22.0 @@ -899,9 +893,6 @@ importers: yargs: specifier: ^17.7.1 version: 17.7.1 - yarn: - specifier: ^1.22.19 - version: 1.22.19 packages/edge-preview-authenticated-proxy: devDependencies: @@ -9570,16 +9561,6 @@ packages: resolution: {integrity: sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - pnpm@8.10.2: - resolution: {integrity: sha512-B4IJPVumx62UYggbwe8HdQFqS0EJ7KHh/tzqbxEBQ69fUJk9s2xCfU+oxivjkgoyJNsS2nGdJGyhndnxgEjDPA==} - engines: {node: '>=16.14'} - hasBin: true - - pnpm@8.6.11: - resolution: {integrity: sha512-jqknppuj45tDzJsLcLqkAxytBHZXIx9JTYkGNq0/7pSRggpio9wRxTDj4NA2ilOHPlJ5BVjB5Ij5dx65woMi5A==} - engines: {node: '>=16.14'} - hasBin: true - polished@4.2.2: resolution: {integrity: sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==} engines: {node: '>=10'} @@ -21756,10 +21737,6 @@ snapshots: dependencies: irregular-plurals: 3.5.0 - pnpm@8.10.2: {} - - pnpm@8.6.11: {} - polished@4.2.2: dependencies: '@babel/runtime': 7.22.5