Skip to content

Commit 3cb96b2

Browse files
whitelisabaxe312gerandipaetzoldLiamStokingerContentful
authored
BREAKING CHANGE: v12.0.0 release beta [] (#2616)
* BREAKING CHANGE: full ESM support (#2472) * fix: clean dependencies, delete unused file, migrated overlooked tests from last merge * refactor: build process now supports TS, ESM, CJS and browser * build: upgrade to ESM version of contentful-sdk-core * test: reduce bundle size limits thanks to our optimizations * build: clean up depdency changes * chore: typos * feat: this SDK now also includes its version number in its bundles * test: fix output integration tests * build: npm dedupe * build: latest rollup dependencies * fix: use with keyword instead of assert to mark import as json * build: update depndencies related to this branch * build: make npm happy to resolve our dependencies without --force * test: ensure new failing typescript lint rules throw warnings only - still should be resolved at some point * test: fix import paths * build: ensure json-patch is available for typescript in projects using this api client * ci: update node version * fix: adjust import path * style: ensure prettier doesnt fail on our rollup config file * style: format code to make prettier lint happy * style: format code to make prettier lint happy #2 * ci: update circleci config to match our new setup * ci: cleanup * test: slightly increase bundle size limits * feat: introduce MIGRATION.md file * docs: readme cleanup * fix: move types definition to top of exports as demanded by node docs * fix: disable linting on inject-env file * docs: fix wrong link --------- Co-authored-by: Lisa White <[email protected]> * fix: replace `SysLink` & `MetaLinkProps` with `Link<T>` to improve type safety [CFISO-2344] (#2590) * fix: replace `SysLink` & `MetaLinkProps` with `Link<T>` to improve type safety * chore: prettier * fix: more specific types for subject links * fix: snapshots are created by users * fix: webhook health is created by webhook defs * fix: webhook call is created by webhook defs * chore: formatting * fix: update AiAction links * fix: `createdBy` etc should be a union, not an object * fix: remove unused types * fix: remove import * feat: narrow `sys.type` to a string literal type for better type safety (#2611) * feat: narrow `sys.type` to a string literal type for better type safety * fix: types for `Usage` * chore: prettier * feat: align taxonomy update methods with standard [NONE] (#2478) * fix: make version param required for entry patch method of plain client [DX-34] (#2610) --------- Co-authored-by: Benedikt Rötsch <[email protected]> Co-authored-by: Andi Pätzold <[email protected]> Co-authored-by: LiamStokingerContentful <[email protected]>
1 parent 4e30902 commit 3cb96b2

File tree

117 files changed

+2488
-4717
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+2488
-4717
lines changed

.babelrc.js

Lines changed: 0 additions & 70 deletions
This file was deleted.

.circleci/config.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,13 @@ jobs:
7171
- with-workspace
7272
- run: npm run prettier:check
7373
- run: npm run lint
74-
- run: npm run check-types
74+
- run: npm run test:types
7575

7676
unit:
7777
executor: docker-with-node
7878
steps:
7979
- with-workspace
8080
- run: npm run test:cover-unit
81-
- store_test_results:
82-
path: reports
83-
- store_artifacts:
84-
path: ./reports/unit-results.xml
8581

8682
size:
8783
executor: docker-with-node
@@ -94,10 +90,6 @@ jobs:
9490
steps:
9591
- with-workspace
9692
- run: npm run test:cover-integration
97-
- store_test_results:
98-
path: reports
99-
- store_artifacts:
100-
path: ./reports/integration-results.xml
10193

10294
# Do not use the workspace for the release step
10395
release:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
dist
22
gh-pages
3-
webpack-build-log.json
43

54
# Esdoc dirs
65
out

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist
33
coverage
44
out
55
typings
6+
rollup.config.js

MIGRATION.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!-- shared header START -->
2+
3+
<p align="center">
4+
<a href="https://www.contentful.com/developers/docs/references/content-management-api/">
5+
<img alt="Contentful Logo" title="Contentful" src="images/contentful-icon.png" width="150">
6+
</a>
7+
</p>
8+
9+
<h1 align='center'>Content Management API</h1>
10+
11+
<h3 align="center">Migration</h3>
12+
13+
<p align="center">
14+
<a href="README.md">Readme</a> ·
15+
<a href="MIGRATION.md">Migration</a> · ·
16+
<a href="CONTRIBUTING.md">Contributing</a>
17+
</p>
18+
19+
<p align="center">
20+
<a href="https://www.contentful.com/slack/">
21+
<img src="https://img.shields.io/badge/-Join%20Community%20Slack-2AB27B.svg?logo=slack&maxAge=31557600" alt="Join Contentful Community Slack">
22+
</a>
23+
</p>
24+
25+
<!-- shared header END -->
26+
27+
# Migration information
28+
29+
- [Migration information](#migration-information)
30+
- [Migration to version 12.x](#migration-to-version-12x)
31+
- [Breaking changes](#breaking-changes)
32+
- [Node.js core modules](#nodejs-core-modules)
33+
- [Pre-bundled code](#pre-bundled-code)
34+
- [Webpack 5](#webpack-5)
35+
- [Rollup](#rollup)
36+
- [Improvements](#improvements)
37+
- [Tree shaking](#tree-shaking)
38+
- [Module support and package configuration](#module-support-and-package-configuration)
39+
- [Testing framework](#testing-framework)
40+
- [Security](#security)
41+
- [Removal of eval](#removal-of-eval)
42+
43+
From version 3.0.0 onwards, you can access documentation for a specific version by visiting `https://contentful.github.io/contentful-management.js/contentful-management/<VERSION>`.
44+
45+
You can upgrade to a major version using `npm update contentful`
46+
47+
## Migration to version 12.x
48+
49+
Version 12.0.0 introduces full ESM support by default, with CJS variants still available for legacy environments. This version is a significant step forward in modernizing our build and improving performance while maintaining wide compatibility across various environments.
50+
51+
### Breaking changes
52+
53+
#### Node.js core modules
54+
55+
We no longer bundle Node.js core modules. If you’re bundling for the browser, you may need to configure your bundler to provide fallbacks or empty functions, particularly for the fs module. This change was introduced in version 12.x and may affect projects using Node.js-specific modules in the browser.
56+
57+
#### Pre-bundled code
58+
59+
Pre-bundled code for Node.js is no longer provided. If your setup relies on pre-bundled packages, you may need to adjust your build configuration.
60+
61+
##### Webpack 5
62+
63+
To make our project bundle properly for the browser with Webpack 5, you need to add this to your configuration:
64+
65+
```js
66+
module.exports = {
67+
resolve: {
68+
fallback: {
69+
os: false,
70+
zlib: false,
71+
tty: false,
72+
},
73+
},
74+
}
75+
```
76+
77+
##### Rollup
78+
79+
To make our project bundle properly for the browser with Rollup, you need to add this to your configuration:
80+
81+
```js
82+
nodeResolve({ browser: true, preferBuiltins: false })
83+
```
84+
85+
### Improvements
86+
87+
#### Tree shaking
88+
89+
Tree shaking is significantly improved, ensuring that only the necessary parts of the library are included in your final bundle.
90+
Smaller browser bundles
91+
92+
Browser bundle sizes have been reduced by nearly threefold, from 128KB to 45KB, contributing to faster load times and improved performance.
93+
94+
#### Module support and package configuration
95+
96+
The package now uses "type": "module" in package.json to define the default module format as ESM, while also providing support for CJS through the exports field. This allows us to support a wide range of environments including Node.js (with and without TypeScript, both CJS and ESM), AngularJS, GatsbyJS, Next.js, Nuxt, React Native (Expo), Rollup, Svelte, Vite, Webpack, and more.
97+
98+
#### Testing framework
99+
100+
We’ve migrated our internal test environment from Jest to Vitest, aligning with modern testing frameworks and tools.
101+
102+
## Security
103+
104+
### Removal of eval
105+
106+
We have completely removed the use of eval in our exported code, improving security and compatibility with strict environments.

0 commit comments

Comments
 (0)