From 33554fc782cda72cbf8323e9d814f8c069433763 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Fri, 26 Sep 2025 13:15:00 -0400 Subject: [PATCH 1/3] feat: bun support --- .../src/data/ProjectLifecycleManager.ts | 4 +++ .../src/sources/WizardDataSource.ts | 1 + packages/graphql/schemas/schema.graphql | 1 + system-tests/lib/dep-installer/bun.ts | 21 ++++++++++++ system-tests/lib/dep-installer/index.ts | 20 +++++++++-- system-tests/lib/dep-installer/pnpm.ts | 23 +++++++++++++ .../bun-component-testing/cypress.config.ts | 13 +++++++ .../cypress/component/bun-component.cy.tsx | 34 +++++++++++++++++++ .../cypress/tsconfig.json | 21 ++++++++++++ .../bun-component-testing/package.json | 15 ++++++++ .../bun-component-testing/tsconfig.json | 21 ++++++++++++ .../bun-with-deps/cypress/e2e/bun-test.cy.js | 15 ++++++++ .../cypress/fixtures/bun-test.html | 10 ++++++ .../projects/bun-with-deps/package.json | 11 ++++++ .../cypress/e2e/workspace-test.cy.js | 16 +++++++++ .../cypress/fixtures/workspace-test.html | 10 ++++++ .../projects/bun-workspace/package.json | 10 ++++++ .../bun-workspace/packages/app/package.json | 10 ++++++ .../bun-workspace/packages/shared/index.js | 8 +++++ .../packages/shared/package.json | 8 +++++ .../projects/pristine-bun/package.json | 8 +++++ .../scripts/bootstrap-docker-container.sh | 3 ++ system-tests/test/bun_cli_spec.ts | 33 ++++++++++++++++++ system-tests/test/bun_spec.ts | 18 ++++++++++ system-tests/test/bun_typescript_spec.ts | 20 +++++++++++ system-tests/test/bun_workspace_spec.ts | 18 ++++++++++ 26 files changed, 369 insertions(+), 3 deletions(-) create mode 100644 system-tests/lib/dep-installer/bun.ts create mode 100644 system-tests/lib/dep-installer/pnpm.ts create mode 100644 system-tests/projects/bun-component-testing/cypress.config.ts create mode 100644 system-tests/projects/bun-component-testing/cypress/component/bun-component.cy.tsx create mode 100644 system-tests/projects/bun-component-testing/cypress/tsconfig.json create mode 100644 system-tests/projects/bun-component-testing/package.json create mode 100644 system-tests/projects/bun-component-testing/tsconfig.json create mode 100644 system-tests/projects/bun-with-deps/cypress/e2e/bun-test.cy.js create mode 100644 system-tests/projects/bun-with-deps/cypress/fixtures/bun-test.html create mode 100644 system-tests/projects/bun-with-deps/package.json create mode 100644 system-tests/projects/bun-workspace/cypress/e2e/workspace-test.cy.js create mode 100644 system-tests/projects/bun-workspace/cypress/fixtures/workspace-test.html create mode 100644 system-tests/projects/bun-workspace/package.json create mode 100644 system-tests/projects/bun-workspace/packages/app/package.json create mode 100644 system-tests/projects/bun-workspace/packages/shared/index.js create mode 100644 system-tests/projects/bun-workspace/packages/shared/package.json create mode 100644 system-tests/projects/pristine-bun/package.json create mode 100644 system-tests/test/bun_cli_spec.ts create mode 100644 system-tests/test/bun_spec.ts create mode 100644 system-tests/test/bun_typescript_spec.ts create mode 100644 system-tests/test/bun_workspace_spec.ts diff --git a/packages/data-context/src/data/ProjectLifecycleManager.ts b/packages/data-context/src/data/ProjectLifecycleManager.ts index 84c14cd83f5..f7acf2b4a39 100644 --- a/packages/data-context/src/data/ProjectLifecycleManager.ts +++ b/packages/data-context/src/data/ProjectLifecycleManager.ts @@ -199,6 +199,10 @@ export class ProjectLifecycleManager { return 'pnpm' } + if (fs.existsSync(path.join(projectRoot, 'bun.lockb'))) { + return 'bun' + } + return 'npm' } diff --git a/packages/data-context/src/sources/WizardDataSource.ts b/packages/data-context/src/sources/WizardDataSource.ts index 69864d9e9cc..61c88549dc3 100644 --- a/packages/data-context/src/sources/WizardDataSource.ts +++ b/packages/data-context/src/sources/WizardDataSource.ts @@ -33,6 +33,7 @@ export class WizardDataSource { 'npm': 'npm install -D', 'pnpm': 'pnpm add -D', 'yarn': 'yarn add -D', + 'bun': 'bun add -D', } as const const deps = (await this.ctx.wizard.packagesToInstall()) diff --git a/packages/graphql/schemas/schema.graphql b/packages/graphql/schemas/schema.graphql index ecb460e3bd9..820602e7f46 100644 --- a/packages/graphql/schemas/schema.graphql +++ b/packages/graphql/schemas/schema.graphql @@ -1695,6 +1695,7 @@ enum PackageManagerEnum { npm pnpm yarn + bun } """ diff --git a/system-tests/lib/dep-installer/bun.ts b/system-tests/lib/dep-installer/bun.ts new file mode 100644 index 00000000000..11e185307a8 --- /dev/null +++ b/system-tests/lib/dep-installer/bun.ts @@ -0,0 +1,21 @@ +import path from 'path' +import tempDir from 'temp-dir' +import { homedir } from 'os' + +export function getBunCommand (opts: { + updateLockFile: boolean + isCI: boolean + runScripts: boolean +}): string { + let cmd = 'bun install' + + if (!opts.runScripts) cmd += ' --ignore-scripts' + + if (!opts.updateLockFile) cmd += ' --frozen-lockfile' + + // Bun uses different cache structure than npm/yarn + if (opts.isCI) cmd += ` --cache=${homedir()}/.bun/install/cache` + else cmd += ` --cache=${path.join(tempDir, 'cy-system-tests-bun-cache', String(Date.now()))}` + + return cmd +} diff --git a/system-tests/lib/dep-installer/index.ts b/system-tests/lib/dep-installer/index.ts index b22ff4296f4..af92ac09832 100644 --- a/system-tests/lib/dep-installer/index.ts +++ b/system-tests/lib/dep-installer/index.ts @@ -4,6 +4,8 @@ import execa from 'execa' import { cyTmpDir, projectPath, projects, root } from '../fixtures' import { getYarnCommand } from './yarn' import { getNpmCommand } from './npm' +import { getBunCommand } from './bun' +import { getPnpmCommand } from './pnpm' type Dependencies = Record @@ -83,8 +85,18 @@ async function copyNodeModulesFromCache (tmpNodeModulesDir: string, cacheDir: st async function getLockFilename (dir: string) { const hasYarnLock = !!await fs.stat(path.join(dir, 'yarn.lock')).catch(() => false) const hasNpmLock = !!await fs.stat(path.join(dir, 'package-lock.json')).catch(() => false) + const hasPnpmLock = !!await fs.stat(path.join(dir, 'pnpm-lock.yaml')).catch(() => false) + const hasBunLock = !!await fs.stat(path.join(dir, 'bun.lockb')).catch(() => false) - if (hasYarnLock && hasNpmLock) throw new Error(`The example project at '${dir}' has conflicting lockfiles. Only use one package manager's lockfile per project.`) + const lockfileCount = [hasYarnLock, hasNpmLock, hasPnpmLock, hasBunLock].filter(Boolean).length + + if (lockfileCount > 1) { + throw new Error(`The example project at '${dir}' has conflicting lockfiles. Only use one package manager's lockfile per project.`) + } + + if (hasBunLock) return 'bun.lockb' + + if (hasPnpmLock) return 'pnpm-lock.yaml' if (hasNpmLock) return 'package-lock.json' @@ -197,6 +209,8 @@ export async function scaffoldProjectNodeModules ({ const lockFilename = await getLockFilename(projectDir) const hasYarnLock = lockFilename === 'yarn.lock' + const hasPnpmLock = lockFilename === 'pnpm-lock.yaml' + const hasBunLock = lockFilename === 'bun.lockb' // 1. Ensure there is a cache directory set up for this test project's `node_modules`. await ensureCacheDir(cacheNodeModulesDir) @@ -226,8 +240,8 @@ export async function scaffoldProjectNodeModules ({ log(`Writing ${lockFilename} with fixed relative paths to temp dir`) await restoreLockFileRelativePaths({ projectDir, lockFilePath, relativePathToMonorepoRoot }) - // 5. Run `yarn/npm install`. - const getCommandFn = hasYarnLock ? getYarnCommand : getNpmCommand + // 5. Run `yarn/npm/bun/pnpm install`. + const getCommandFn = hasBunLock ? getBunCommand : (hasYarnLock ? getYarnCommand : (hasPnpmLock ? getPnpmCommand : getNpmCommand)) const cmd = getCommandFn({ updateLockFile, yarnV311: pkgJson._cyYarnV311, diff --git a/system-tests/lib/dep-installer/pnpm.ts b/system-tests/lib/dep-installer/pnpm.ts new file mode 100644 index 00000000000..8d1437c6987 --- /dev/null +++ b/system-tests/lib/dep-installer/pnpm.ts @@ -0,0 +1,23 @@ +import path from 'path' +import tempDir from 'temp-dir' +import { homedir } from 'os' + +export function getPnpmCommand (opts: { + yarnV311: boolean + updateLockFile: boolean + isCI: boolean + runScripts: boolean +}): string { + let cmd = 'pnpm install' + + if (opts.yarnV311) throw new Error('_cyYarnV311 is not supported with PNPM.') + + if (!opts.runScripts) cmd += ' --ignore-scripts' + + if (!opts.updateLockFile) cmd += ' --frozen-lockfile' + + if (opts.isCI) cmd += ` --store-dir=${homedir()}/.pnpm-store` + else cmd += ` --store-dir=${path.join(tempDir, 'cy-system-tests-pnpm-store', String(Date.now()))}` + + return cmd +} diff --git a/system-tests/projects/bun-component-testing/cypress.config.ts b/system-tests/projects/bun-component-testing/cypress.config.ts new file mode 100644 index 00000000000..66a92f1b96e --- /dev/null +++ b/system-tests/projects/bun-component-testing/cypress.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + component: { + devServer: { + framework: 'react', + bundler: 'webpack', + }, + }, + e2e: { + baseUrl: 'http://localhost:5000', + }, +}) diff --git a/system-tests/projects/bun-component-testing/cypress/component/bun-component.cy.tsx b/system-tests/projects/bun-component-testing/cypress/component/bun-component.cy.tsx new file mode 100644 index 00000000000..0252393149b --- /dev/null +++ b/system-tests/projects/bun-component-testing/cypress/component/bun-component.cy.tsx @@ -0,0 +1,34 @@ +import React from 'react' +import { mount } from '@cypress/react' + +describe('Bun Component Test', () => { + it('should render a simple React component', () => { + const TestComponent = () => ( +
+

Hello from Bun!

+

This component is tested using Bun package manager

+
+ ) + + mount() + cy.contains('Hello from Bun!').should('be.visible') + cy.contains('This component is tested using Bun package manager').should('be.visible') + }) + + it('should work with TypeScript', () => { + interface Props { + message: string + } + + const TypeScriptComponent: React.FC = ({ message }) => ( +
+

TypeScript Component

+

{message}

+
+ ) + + mount() + cy.contains('TypeScript Component').should('be.visible') + cy.contains('Bun + TypeScript + Cypress').should('be.visible') + }) +}) diff --git a/system-tests/projects/bun-component-testing/cypress/tsconfig.json b/system-tests/projects/bun-component-testing/cypress/tsconfig.json new file mode 100644 index 00000000000..00c42a58af0 --- /dev/null +++ b/system-tests/projects/bun-component-testing/cypress/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "es6"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": [ + "**/*" + ] +} diff --git a/system-tests/projects/bun-component-testing/package.json b/system-tests/projects/bun-component-testing/package.json new file mode 100644 index 00000000000..31e3f910645 --- /dev/null +++ b/system-tests/projects/bun-component-testing/package.json @@ -0,0 +1,15 @@ +{ + "name": "bun-component-testing", + "version": "0.0.0-test", + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@cypress/react": "0.0.0-development", + "@cypress/webpack-dev-server": "0.0.0-development", + "@types/react": "^18.2.0", + "@types/react-dom": "^18.2.0", + "typescript": "^5.6.3" + } +} diff --git a/system-tests/projects/bun-component-testing/tsconfig.json b/system-tests/projects/bun-component-testing/tsconfig.json new file mode 100644 index 00000000000..3a9ac85c737 --- /dev/null +++ b/system-tests/projects/bun-component-testing/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "es6"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx" + }, + "include": [ + "cypress/**/*" + ] +} diff --git a/system-tests/projects/bun-with-deps/cypress/e2e/bun-test.cy.js b/system-tests/projects/bun-with-deps/cypress/e2e/bun-test.cy.js new file mode 100644 index 00000000000..76f6bd5a295 --- /dev/null +++ b/system-tests/projects/bun-with-deps/cypress/e2e/bun-test.cy.js @@ -0,0 +1,15 @@ +describe('Bun E2E Test', () => { + it('should work with bun package manager', () => { + cy.visit('/cypress/fixtures/bun-test.html') + cy.contains('Bun Test Page').should('be.visible') + }) + + it('should be able to use lodash imported via bun', () => { + // This test verifies that dependencies installed via bun are available + const _ = require('lodash') + + expect(_.isArray).to.be.a('function') + expect(_.isArray([])).to.be.true + expect(_.isArray({})).to.be.false + }) +}) diff --git a/system-tests/projects/bun-with-deps/cypress/fixtures/bun-test.html b/system-tests/projects/bun-with-deps/cypress/fixtures/bun-test.html new file mode 100644 index 00000000000..9ee91471363 --- /dev/null +++ b/system-tests/projects/bun-with-deps/cypress/fixtures/bun-test.html @@ -0,0 +1,10 @@ + + + + Bun Test Page + + +

Bun Test Page

+

This page is used for testing Bun package manager integration with Cypress.

+ + diff --git a/system-tests/projects/bun-with-deps/package.json b/system-tests/projects/bun-with-deps/package.json new file mode 100644 index 00000000000..1397f4fbf04 --- /dev/null +++ b/system-tests/projects/bun-with-deps/package.json @@ -0,0 +1,11 @@ +{ + "name": "bun-with-deps", + "version": "0.0.0-test", + "dependencies": { + "lodash": "^4.17.21" + }, + "devDependencies": { + "@types/lodash": "^4.14.225", + "typescript": "^5.6.3" + } +} diff --git a/system-tests/projects/bun-workspace/cypress/e2e/workspace-test.cy.js b/system-tests/projects/bun-workspace/cypress/e2e/workspace-test.cy.js new file mode 100644 index 00000000000..8f96de63071 --- /dev/null +++ b/system-tests/projects/bun-workspace/cypress/e2e/workspace-test.cy.js @@ -0,0 +1,16 @@ +describe('Bun Workspace Test', () => { + it('should work with bun workspace dependencies', () => { + cy.visit('/cypress/fixtures/workspace-test.html') + cy.contains('Workspace Test Page').should('be.visible') + }) + + it('should be able to import workspace packages', () => { + // This test verifies that workspace dependencies are properly resolved + const { sharedFunction, useLodash } = require('@bun-workspace/shared') + + expect(sharedFunction).to.be.a('function') + expect(sharedFunction()).to.equal('Hello from shared package!') + expect(useLodash).to.be.a('function') + expect(useLodash()).to.equal('Lodash is available') + }) +}) diff --git a/system-tests/projects/bun-workspace/cypress/fixtures/workspace-test.html b/system-tests/projects/bun-workspace/cypress/fixtures/workspace-test.html new file mode 100644 index 00000000000..19f74261ccc --- /dev/null +++ b/system-tests/projects/bun-workspace/cypress/fixtures/workspace-test.html @@ -0,0 +1,10 @@ + + + + Workspace Test Page + + +

Workspace Test Page

+

This page is used for testing Bun workspace integration with Cypress.

+ + diff --git a/system-tests/projects/bun-workspace/package.json b/system-tests/projects/bun-workspace/package.json new file mode 100644 index 00000000000..76d6e4c96e0 --- /dev/null +++ b/system-tests/projects/bun-workspace/package.json @@ -0,0 +1,10 @@ +{ + "name": "bun-workspace", + "version": "0.0.0-test", + "devDependencies": { + "typescript": "^5.6.3" + }, + "workspaces": [ + "packages/*" + ] +} diff --git a/system-tests/projects/bun-workspace/packages/app/package.json b/system-tests/projects/bun-workspace/packages/app/package.json new file mode 100644 index 00000000000..37a08fe6196 --- /dev/null +++ b/system-tests/projects/bun-workspace/packages/app/package.json @@ -0,0 +1,10 @@ +{ + "name": "@bun-workspace/app", + "version": "0.0.0-test", + "dependencies": { + "@bun-workspace/shared": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.6.3" + } +} diff --git a/system-tests/projects/bun-workspace/packages/shared/index.js b/system-tests/projects/bun-workspace/packages/shared/index.js new file mode 100644 index 00000000000..0ee63065a48 --- /dev/null +++ b/system-tests/projects/bun-workspace/packages/shared/index.js @@ -0,0 +1,8 @@ +export const sharedFunction = () => { + return 'Hello from shared package!' +} + +export const useLodash = () => { + // This will be available through the workspace dependency + return 'Lodash is available' +} diff --git a/system-tests/projects/bun-workspace/packages/shared/package.json b/system-tests/projects/bun-workspace/packages/shared/package.json new file mode 100644 index 00000000000..bcd95dc803e --- /dev/null +++ b/system-tests/projects/bun-workspace/packages/shared/package.json @@ -0,0 +1,8 @@ +{ + "name": "@bun-workspace/shared", + "version": "0.0.0-test", + "main": "index.js", + "dependencies": { + "lodash": "^4.17.21" + } +} diff --git a/system-tests/projects/pristine-bun/package.json b/system-tests/projects/pristine-bun/package.json new file mode 100644 index 00000000000..b2b67565ac4 --- /dev/null +++ b/system-tests/projects/pristine-bun/package.json @@ -0,0 +1,8 @@ +{ + "name": "pristine-bun", + "version": "0.0.0-test", + "devDependencies": { + "typescript": "5.6.3" + }, + "_cySkipDepInstall": true +} diff --git a/system-tests/scripts/bootstrap-docker-container.sh b/system-tests/scripts/bootstrap-docker-container.sh index babf03b17ee..ca25e2b49f7 100755 --- a/system-tests/scripts/bootstrap-docker-container.sh +++ b/system-tests/scripts/bootstrap-docker-container.sh @@ -38,6 +38,9 @@ export CYPRESS_CACHE_FOLDER=/tmp/CYPRESS_CACHE_FOLDER/ if [ "$USE_YARN_TO_INSTALL_CYPRESS_BINARY" = true ]; then # if using yarn to install the built cypress binary, we can just install the tarball that is in the monorepo root directory yarn add cypress@file:$TARBALL_PATH +elif [ "$USE_BUN_TO_INSTALL_CYPRESS_BINARY" = true ]; then + # if using bun to install the built cypress binary, we can just install the tarball that is in the monorepo root directory + bun add cypress@file:$TARBALL_PATH else export npm_config_cache=/tmp/npm_config_cache/ export npm_config_package_lock=false diff --git a/system-tests/test/bun_cli_spec.ts b/system-tests/test/bun_cli_spec.ts new file mode 100644 index 00000000000..0fc2ae428c8 --- /dev/null +++ b/system-tests/test/bun_cli_spec.ts @@ -0,0 +1,33 @@ +import systemTests from '../lib/system-tests' + +describe('bun CLI commands', () => { + systemTests.setup() + + systemTests.it('can run cypress open with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-with-deps', + command: 'bunx cypress open', + }) + + systemTests.it('can run cypress run with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-with-deps', + command: 'bunx cypress run', + }) + + systemTests.it('can install cypress binary with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-with-deps', + command: 'bunx cypress install', + }) + + systemTests.it('can verify cypress installation with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-with-deps', + command: 'bunx cypress verify', + }) +}) diff --git a/system-tests/test/bun_spec.ts b/system-tests/test/bun_spec.ts new file mode 100644 index 00000000000..c96c93c20c2 --- /dev/null +++ b/system-tests/test/bun_spec.ts @@ -0,0 +1,18 @@ +import systemTests from '../lib/system-tests' + +describe('e2e bun package manager', () => { + systemTests.setup() + + systemTests.it('can install dependencies and run basic tests', { + snapshot: false, + browser: 'electron', + project: 'bun-with-deps', + }) + + systemTests.it('can handle component testing with bun', { + snapshot: false, + browser: 'chrome', + project: 'bun-component-testing', + testingType: 'component', + }) +}) diff --git a/system-tests/test/bun_typescript_spec.ts b/system-tests/test/bun_typescript_spec.ts new file mode 100644 index 00000000000..371b5ab8c81 --- /dev/null +++ b/system-tests/test/bun_typescript_spec.ts @@ -0,0 +1,20 @@ +import systemTests from '../lib/system-tests' + +describe('bun TypeScript support', () => { + systemTests.setup() + + systemTests.it('can run TypeScript specs with bun', { + snapshot: false, + browser: 'chrome', + project: 'bun-component-testing', + testingType: 'component', + spec: '**/*.cy.ts', + }) + + systemTests.it('can handle TypeScript config files with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-component-testing', + configFile: 'cypress.config.ts', + }) +}) diff --git a/system-tests/test/bun_workspace_spec.ts b/system-tests/test/bun_workspace_spec.ts new file mode 100644 index 00000000000..9fe8db74b82 --- /dev/null +++ b/system-tests/test/bun_workspace_spec.ts @@ -0,0 +1,18 @@ +import systemTests from '../lib/system-tests' + +describe('bun workspace support', () => { + systemTests.setup() + + systemTests.it('can handle bun workspace dependencies', { + snapshot: false, + browser: 'electron', + project: 'bun-workspace', + }) + + systemTests.it('can install workspace dependencies with bun', { + snapshot: false, + browser: 'electron', + project: 'bun-workspace', + command: 'bun install', + }) +}) From aab825fea33f6a766474042b65aa563d8c7b3657 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Fri, 26 Sep 2025 13:52:28 -0400 Subject: [PATCH 2/3] add bun as supported package manager --- packages/graphql/schemas/schema.graphql | 2 +- packages/types/src/constants.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/graphql/schemas/schema.graphql b/packages/graphql/schemas/schema.graphql index 820602e7f46..68db1ec7304 100644 --- a/packages/graphql/schemas/schema.graphql +++ b/packages/graphql/schemas/schema.graphql @@ -1692,10 +1692,10 @@ enum OverLimitActionTypeEnum { } enum PackageManagerEnum { + bun npm pnpm yarn - bun } """ diff --git a/packages/types/src/constants.ts b/packages/types/src/constants.ts index 01a62abcd84..a1e24ef48ca 100644 --- a/packages/types/src/constants.ts +++ b/packages/types/src/constants.ts @@ -20,7 +20,7 @@ export const CODE_LANGUAGES = [ export type CodeLanguage = typeof CODE_LANGUAGES[number] -export const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm'] as const +export const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm', 'bun'] as const export type PackageManager = typeof PACKAGE_MANAGERS[number] From cdb9df3f01ec55633631dbbb5b082a36e41c40a5 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Fri, 26 Sep 2025 15:28:52 -0400 Subject: [PATCH 3/3] add lock files + update --- .../src/data/ProjectLifecycleManager.ts | 2 +- system-tests/lib/dep-installer/index.ts | 6 +-- .../projects/bun-component-testing/bun.lock | 38 +++++++++++++++++++ .../bun-component-testing/package.json | 2 - system-tests/projects/bun-with-deps/bun.lock | 22 +++++++++++ system-tests/projects/bun-workspace/bun.lock | 37 ++++++++++++++++++ 6 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 system-tests/projects/bun-component-testing/bun.lock create mode 100644 system-tests/projects/bun-with-deps/bun.lock create mode 100644 system-tests/projects/bun-workspace/bun.lock diff --git a/packages/data-context/src/data/ProjectLifecycleManager.ts b/packages/data-context/src/data/ProjectLifecycleManager.ts index f7acf2b4a39..37a8bcc8cf7 100644 --- a/packages/data-context/src/data/ProjectLifecycleManager.ts +++ b/packages/data-context/src/data/ProjectLifecycleManager.ts @@ -199,7 +199,7 @@ export class ProjectLifecycleManager { return 'pnpm' } - if (fs.existsSync(path.join(projectRoot, 'bun.lockb'))) { + if (fs.existsSync(path.join(projectRoot, 'bun.lock'))) { return 'bun' } diff --git a/system-tests/lib/dep-installer/index.ts b/system-tests/lib/dep-installer/index.ts index af92ac09832..f49fc5ba433 100644 --- a/system-tests/lib/dep-installer/index.ts +++ b/system-tests/lib/dep-installer/index.ts @@ -86,7 +86,7 @@ async function getLockFilename (dir: string) { const hasYarnLock = !!await fs.stat(path.join(dir, 'yarn.lock')).catch(() => false) const hasNpmLock = !!await fs.stat(path.join(dir, 'package-lock.json')).catch(() => false) const hasPnpmLock = !!await fs.stat(path.join(dir, 'pnpm-lock.yaml')).catch(() => false) - const hasBunLock = !!await fs.stat(path.join(dir, 'bun.lockb')).catch(() => false) + const hasBunLock = !!await fs.stat(path.join(dir, 'bun.lock')).catch(() => false) const lockfileCount = [hasYarnLock, hasNpmLock, hasPnpmLock, hasBunLock].filter(Boolean).length @@ -94,7 +94,7 @@ async function getLockFilename (dir: string) { throw new Error(`The example project at '${dir}' has conflicting lockfiles. Only use one package manager's lockfile per project.`) } - if (hasBunLock) return 'bun.lockb' + if (hasBunLock) return 'bun.lock' if (hasPnpmLock) return 'pnpm-lock.yaml' @@ -210,7 +210,7 @@ export async function scaffoldProjectNodeModules ({ const lockFilename = await getLockFilename(projectDir) const hasYarnLock = lockFilename === 'yarn.lock' const hasPnpmLock = lockFilename === 'pnpm-lock.yaml' - const hasBunLock = lockFilename === 'bun.lockb' + const hasBunLock = lockFilename === 'bun.lock' // 1. Ensure there is a cache directory set up for this test project's `node_modules`. await ensureCacheDir(cacheNodeModulesDir) diff --git a/system-tests/projects/bun-component-testing/bun.lock b/system-tests/projects/bun-component-testing/bun.lock new file mode 100644 index 00000000000..0bd49dd7f2f --- /dev/null +++ b/system-tests/projects/bun-component-testing/bun.lock @@ -0,0 +1,38 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "bun-component-testing", + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0", + }, + "devDependencies": { + "@types/react": "^18.2.0", + "@types/react-dom": "^18.2.0", + "typescript": "^5.6.3", + }, + }, + }, + "packages": { + "@types/prop-types": ["@types/prop-types@15.7.15", "", {}, "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw=="], + + "@types/react": ["@types/react@18.3.24", "", { "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" } }, "sha512-0dLEBsA1kI3OezMBF8nSsb7Nk19ZnsyE1LLhB8r27KbgU5H4pvuqZLdtE+aUkJVoXgTVuA+iLIwmZ0TuK4tx6A=="], + + "@types/react-dom": ["@types/react-dom@18.3.7", "", { "peerDependencies": { "@types/react": "^18.0.0" } }, "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ=="], + + "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + + "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], + + "loose-envify": ["loose-envify@1.4.0", "", { "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, "bin": { "loose-envify": "cli.js" } }, "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q=="], + + "react": ["react@18.3.1", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="], + + "react-dom": ["react-dom@18.3.1", "", { "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" }, "peerDependencies": { "react": "^18.3.1" } }, "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw=="], + + "scheduler": ["scheduler@0.23.2", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="], + + "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="], + } +} diff --git a/system-tests/projects/bun-component-testing/package.json b/system-tests/projects/bun-component-testing/package.json index 31e3f910645..b648eb46443 100644 --- a/system-tests/projects/bun-component-testing/package.json +++ b/system-tests/projects/bun-component-testing/package.json @@ -6,8 +6,6 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@cypress/react": "0.0.0-development", - "@cypress/webpack-dev-server": "0.0.0-development", "@types/react": "^18.2.0", "@types/react-dom": "^18.2.0", "typescript": "^5.6.3" diff --git a/system-tests/projects/bun-with-deps/bun.lock b/system-tests/projects/bun-with-deps/bun.lock new file mode 100644 index 00000000000..5b2ac7c4537 --- /dev/null +++ b/system-tests/projects/bun-with-deps/bun.lock @@ -0,0 +1,22 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "bun-with-deps", + "dependencies": { + "lodash": "^4.17.21", + }, + "devDependencies": { + "@types/lodash": "^4.14.225", + "typescript": "^5.6.3", + }, + }, + }, + "packages": { + "@types/lodash": ["@types/lodash@4.17.20", "", {}, "sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA=="], + + "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + + "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="], + } +} diff --git a/system-tests/projects/bun-workspace/bun.lock b/system-tests/projects/bun-workspace/bun.lock new file mode 100644 index 00000000000..a015c908424 --- /dev/null +++ b/system-tests/projects/bun-workspace/bun.lock @@ -0,0 +1,37 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "name": "bun-workspace", + "devDependencies": { + "typescript": "^5.6.3", + }, + }, + "packages/app": { + "name": "@bun-workspace/app", + "version": "0.0.0-test", + "dependencies": { + "@bun-workspace/shared": "workspace:*", + }, + "devDependencies": { + "typescript": "^5.6.3", + }, + }, + "packages/shared": { + "name": "@bun-workspace/shared", + "version": "0.0.0-test", + "dependencies": { + "lodash": "^4.17.21", + }, + }, + }, + "packages": { + "@bun-workspace/app": ["@bun-workspace/app@workspace:packages/app"], + + "@bun-workspace/shared": ["@bun-workspace/shared@workspace:packages/shared"], + + "lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="], + + "typescript": ["typescript@5.9.2", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A=="], + } +}