Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/src/workflows/workflows/@main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ linux-x64:
- equal: [ develop, << pipeline.git.branch >> ]
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/merge_gql_package_w_data_context', << pipeline.git.branch >> ]
- equal: [ 'chore/bundle_package_root', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand Down
10 changes: 5 additions & 5 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3718,7 +3718,7 @@ workflows:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/merge_gql_package_w_data_context
- chore/bundle_package_root
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down Expand Up @@ -3775,7 +3775,7 @@ workflows:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/merge_gql_package_w_data_context
- chore/bundle_package_root
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down Expand Up @@ -3843,7 +3843,7 @@ workflows:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/merge_gql_package_w_data_context
- chore/bundle_package_root
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down Expand Up @@ -4331,7 +4331,7 @@ workflows:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/merge_gql_package_w_data_context
- chore/bundle_package_root
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down Expand Up @@ -5168,7 +5168,7 @@ workflows:
- update-v8-snapshot-cache-on-develop
- << pipeline.git.branch >>
- equal:
- chore/merge_gql_package_w_data_context
- chore/bundle_package_root
- << pipeline.git.branch >>
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
Expand Down
2 changes: 1 addition & 1 deletion .cursor/BUGBOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Essential rules for reviewing code changes in the Cypress monorepo.
- Focus: Scaffolding logic, template accuracy, project initialization

### Utility Packages (Lower Priority)
- **@packages/root**: Root package (dummy package)
- **@packages/root**: Root package
- Focus: Monorepo setup, package coordination
- **@packages/example**: Example project
- Focus: Example accuracy, documentation quality, test examples
Expand Down
2 changes: 1 addition & 1 deletion guides/esm-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
- [x] packages/reporter ✅ **COMPLETED**
- [ ] packages/resolve-dist **PARTIAL** - entry point is JS
- [ ] packages/rewriter **PARTIAL** - entry point is JS
- [ ] packages/root
- [x] packages/root ✅ **COMPLETED**
- [x] packages/runner ✅ **COMPLETED**
- [ ] packages/scaffold-config **PARTIAL** - entry point is JS
- [ ] packages/server **PARTIAL** - many source/test files in JS. highest priority
Expand Down
2 changes: 2 additions & 0 deletions packages/root/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
index.js
index.mjs
5 changes: 5 additions & 0 deletions packages/root/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Purpose

Bundles the monorepo root `package.json` as an installable package, allowing `@packages/root` to be installed in any context without having an absolute reference to the root `package.json`

In order to accomplish this, `rollup` is used to bundle the `package.json`, as packages may be interpreted in place or be installed inside the `node_modules` directory. This package builds an `index.mjs` file for packages using `vite`/ ES Modules and an `index.js` file for any CommonJS entry points.
1 change: 0 additions & 1 deletion packages/root/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/root/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pkg from '../../package.json'

export default pkg
15 changes: 14 additions & 1 deletion packages/root/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
{
"name": "@packages/root",
"version": "0.0.0-development",
"description": "dummy package pointing at the root package",
"description": "bundles the root package.json as an installable package",
"main": "index.js",
"scripts": {
"build": "yarn build:cjs && yarn build:esm",
"build:cjs": "rimraf index.js && rollup -c rollup.config.mjs -f cjs -o index.js",
"build:esm": "rimraf index.mjs && rollup -c rollup.config.mjs -f esm -o index.mjs",
"build:prod": "yarn build"
},
"devDependencies": {
"@rollup/plugin-json": "^6.1.0",
"rimraf": "^6.0.1",
"rollup": "^4.52.0",
"typescript": "^5.6.3"
},
"module": "index.mjs",
"nx": {}
}
7 changes: 7 additions & 0 deletions packages/root/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import json from '@rollup/plugin-json'

export default {
input: 'index.ts',
// inlines the root package.json into the bundle
plugins: [json()],
}
5 changes: 5 additions & 0 deletions packages/root/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"resolveJsonModule": true,
}
}
15 changes: 8 additions & 7 deletions scripts/binary/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ export async function buildCypressApp (options: BuildCypressAppOpts) {
if (!keepBuild) {
log('#buildPackages')

// Update the root package.json with the next app version so that it is snapshot properly
// as well as make sure @packages/root is built with the correct version
fs.writeJSONSync(path.join(CY_ROOT_DIR, 'package.json'), {
...jsonRoot,
version,
}, { spaces: 2 })

await execa('yarn', ['lerna', 'run', 'build', '--concurrency', '4'], {
stdio: 'inherit',
cwd: CY_ROOT_DIR,
Expand Down Expand Up @@ -226,7 +233,7 @@ require('./packages/server/index.js')
}

export async function packageElectronApp (options: BuildCypressAppOpts) {
const { platform, version, skipSigning = false } = options
const { platform, skipSigning = false } = options

log('#removeCyAndBinFolders')
await del([
Expand Down Expand Up @@ -260,12 +267,6 @@ export async function packageElectronApp (options: BuildCypressAppOpts) {

console.log(`output folder: ${outputFolder}`)

// Update the root package.json with the next app version so that it is snapshot properly
fs.writeJSONSync(path.join(CY_ROOT_DIR, 'package.json'), {
...jsonRoot,
version,
}, { spaces: 2 })

try {
await electronBuilder.build({
publish: 'never',
Expand Down
Loading
Loading