You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: make the @packages/scaffold-config an independent bundle without needed ts-node to register entrypoint. Both ESM and CJS distributions are built and types are used as source to be compatible with older styles of commonjs bundling. Types are not shipped with the package. (#32614)
Copy file name to clipboardExpand all lines: guides/esm-migration.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,10 @@
10
10
- Unit tests in package are written in TypeScript
11
11
- Does not include scripts or system test migrations
12
12
13
+
#### Notes
14
+
15
+
When migrating some of these projects away from the `ts-node` entry [see `@packages/scaffold-config` example](https://github.com/cypress-io/cypress/blob/v15.2.0/packages/scaffold-config/index.js), it is somewhat difficult to make separate browser/node entries as the v8-snapshot [tsconfig.json](https://github.com/cypress-io/cypress/blob/v15.2.0/tooling/v8-snapshot/tsconfig.json) is using an older style of module resolution where the `exports` key inside a package's `package.json` is not well supported. Because of this, we need to find ways to bundle code that is needed internally in the browser vs in node without them being a part of the same bundle. This is a temporary work around until we are able to get every package being able to build as an ES Module, which as that point we can re assess how the Cypress binary is being built as well as v8-snapshots, and will allow us to reconfigure this packages to export content in a more proper fashion.
16
+
13
17
#### Status
14
18
15
19
##### NPM Packages
@@ -57,7 +61,7 @@
57
61
-[ ] packages/rewriter **PARTIAL** - entry point is JS
58
62
-[x] packages/root ✅ **COMPLETED**
59
63
-[x] packages/runner ✅ **COMPLETED**
60
-
-[] packages/scaffold-config **PARTIAL** - entry point is JS
64
+
-[x] packages/scaffold-config ✅ **COMPLETED**
61
65
-[ ] packages/server **PARTIAL** - many source/test files in JS. highest priority
62
66
-[ ] packages/socket **PARTIAL** - entry point is JS. Tests are JS
The process for adding a new library/framework/bundler is as follows:
25
25
26
26
1. Add your framework in [`src/frameworks.ts`](./src/frameworks.ts).
27
27
2. Any new dependencies are declared in [`src/constants.ts`](./src/constants.ts). Don't forget to add a description.
28
-
3. Ensure your project has the correct library and bundler detected with a test in [`test/unit/detect.spec.ts`](./test/unit/detect.spec.ts).
28
+
3. Ensure your project has the correct library and bundler detected with a test in [`test/unit/detect.spec.ts`](./test/detect.spec.ts).
29
29
3. Add a new project with the correct `cypress.config.js` and `package.json` to [system-tests/projects](../../system-tests/projects). It should be `<name>-configured`, which is a working example with some specs. Ensure it will run on CI by adding it to [`component_testing_spec.ts`](../../system-tests/test/component_testing_spec.ts).
30
30
4. Add another project called `<name>-unconfigured`, which represents the project prior to having Cypress added. This will be used in step 5.
31
31
5. Add a test to [`scaffold-component-testing.cy.ts`](../launchpad/cypress/e2e/scaffold-component-testing.cy.ts) to ensure your project has the correct `cypress.config.js` generated. Use an existing test as a template.
32
+
33
+
### Internal testing
34
+
35
+
`@packages/scaffold-config/browser/dependencies` is NOT used in the production binary and therefore doesn't need to be included when the package bundles.
36
+
37
+
We also build an ESM version of `@packages/scaffold-config` but it isn't currently in use as this packages is only used in server-side CommonJS currently.
0 commit comments