contentful 11.12.1 → 11.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTING.md CHANGED
@@ -40,70 +40,157 @@
40
40
  </a>
41
41
  </p>
42
42
 
43
- We appreciate any community contributions to this project, whether in the form of issues or pull requests.
43
+ # Contributing
44
44
 
45
- This document outlines what we'd like you to follow in terms of commit messages and code style.
45
+ ## Prerequisites
46
46
 
47
- It also explains what to do in case you want to set up the project locally and run tests.
47
+ | Tool | Version | Notes |
48
+ |---|---|---|
49
+ | Node.js | 18+ | CI runs on Node 24; local dev works on 18+ |
50
+ | npm | latest | `npm install -g npm@latest` |
48
51
 
49
- **Working on your first Pull Request?** You can learn how from this extensive [list of resources for people who are new to contributing to Open Source](https://github.com/freeCodeCamp/how-to-contribute-to-open-source).
52
+ ## Getting Started
50
53
 
51
- ## Setup
54
+ ```bash
55
+ # Clone and install
56
+ git clone git@github.com:contentful/contentful.js.git
57
+ cd contentful.js
58
+ npm ci
52
59
 
53
- This project is written in ES2015 and transpiled to ES5 using Babel, to the `dist` directory. This should generally only happen at publishing time, or for testing purposes only.
60
+ # Build (required before running tests)
61
+ npm run build
54
62
 
55
- Run `npm install` to install all necessary dependencies. When running `npm install` locally, `dist` is not compiled.
63
+ # Run all tests
64
+ npm test
65
+ ```
56
66
 
57
- All necessary dependencies are installed under `node_modules` and any necessary tools can be accessed via npm scripts. There is no need to install anything globally.
67
+ ## Development Workflow
58
68
 
59
- When importing local, in development code, via `index.js`, this file checks if `dist` exists and uses that. Otherwise, it uses the code from `lib`.
69
+ ```bash
70
+ # Build ESM output only (faster iteration)
71
+ npm run build:esm
60
72
 
61
- If you have a `dist` directory, run `npm run clean`.
73
+ # Run unit tests in watch mode
74
+ npm run test:unit:watch
62
75
 
63
- ## Useful npm scripts
76
+ # Run integration tests in watch mode
77
+ npm run test:integration:watch
64
78
 
65
- - `npm run clean` removes any built files
66
- - `npm run build:dev` builds vendored files, node package and browser version
67
- - `npm run build:prod` builds production-ready minified sources
68
- - `npm run build` combines `clean`, `build:dev` and `build:prod`
69
- - `npm run build:types` emits type declaration files for js files
79
+ # Lint
80
+ npm run lint
70
81
 
71
- ## Running tests
82
+ # Format
83
+ npm run prettier
84
+ ```
72
85
 
73
- This project has unit and integration tests, as well as tests checking types. All of these run on both Node.js and browser environments.
86
+ ### Full build pipeline
74
87
 
75
- Both of these test environments are setup to deal with Babel and code transpiling, so there's no need to worry about that.
88
+ ```bash
89
+ npm run build # clean → tsc → rollup (CJS + browser bundles)
90
+ npm run check # es-check on all output formats (ES2017/ES2018 compliance)
91
+ ```
76
92
 
77
- - `npm run test:unit` runs Node.js unit tests
78
- - `npm run test:integration` runs the integration tests against the Contentful CDA API
79
- - `npm run test:types` runs type checking tests
80
- - `npm test` runs linting on the test code and runs all three kinds of tests
81
- - `test:demo-node` runs a Node.js demo application and its tests, making sure that Node.js builds are functioning and are bundled correctly
82
- - `test:demo-browser` runs a browser client demo application and its tests, making sure that browser builds are functioning and are bundled correctly
83
- - `test:demo-projects` runs both Node.js and browser application tests
93
+ ## Testing
84
94
 
85
- ## Documentation
95
+ - **Framework:** Vitest
96
+ - **Location:** `test/unit/`, `test/integration/`, `test/types/`
97
+ - **Run all:** `npm test` (unit + integration + lint + type tests)
98
+ - **Run unit only:** `npm run test:unit`
99
+ - **Run integration only:** `npm run test:integration`
100
+ - **Watch mode:** `npm run test:unit:watch`
101
+ - **Type tests:** `npm run test:types` (uses `tsd`)
102
+ - **Bundle size:** `npm run test:size` (uses `size-limit`)
103
+ - **Output integration:** `npm run test:demo-projects` (Node + browser demo projects)
86
104
 
87
- Code is documented using TypeDoc, and reference documentation is published automatically with each new version.
105
+ ### Test structure
88
106
 
89
- - `npm run docs:watch` watches code directory, and rebuilds documentation when anything changes. Useful for documentation writing and development
90
- - `npm run docs:build` builds documentation
91
- - `npm run docs:publish` builds documentation and publishes it to github pages
107
+ ```
108
+ test/
109
+ ├── unit/ Unit tests (mocked HTTP)
110
+ ├── integration/ Integration tests (mocked CDA responses)
111
+ ├── types/ Type assertion tests (tsd)
112
+ └── output-integration/
113
+ ├── node/ Verifies the built package works in a Node project
114
+ └── browser/ Verifies the built package works in a browser project
115
+ ```
92
116
 
93
- ## Code style
117
+ ## Commit Convention
94
118
 
95
- This project uses ESLint configuration from [standard](https://github.com/feross/standard). Install a relevant editor plugin if you'd like.
119
+ This repo uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by commitizen:
96
120
 
97
- Everywhere where it isn't applicable, follow a style similar to the existing code.
121
+ ```
122
+ type(scope): description
123
+ ```
98
124
 
99
- ## Commit messages and issues
125
+ Valid types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`, `ci`, `build`, `revert`
100
126
 
101
- This project uses the [Angular JS Commit Message Conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit), via semantic-release. See the semantic-release [commit message format](https://github.com/semantic-release/semantic-release#commit-message-format) section for more details.
127
+ Examples:
128
+ ```
129
+ feat: add cursor-based pagination for entries
130
+ fix(deps): bump axios to address CVE-2026-40175
131
+ build(deps): bump contentful-sdk-core and qs deps
132
+ docs: update migration guide for v11
133
+ ```
102
134
 
103
- ## Versioning
135
+ A pre-commit hook runs lint-staged (prettier + eslint) via husky.
104
136
 
105
- This project strictly follows [Semantic Versioning](http://semver.org/) by use of [semantic-release](https://github.com/semantic-release/semantic-release).
137
+ ## Branch Strategy
106
138
 
107
- This means that new versions are released automatically as fixes, features or breaking changes are released.
139
+ - `master` production; semantic-release on every push
140
+ - `next` — pre-release channel (when active)
141
+ - Feature branches — `feat/<name>`, `fix/<name>`, `chore/<name>`
108
142
 
109
- You can check the changelog on the [releases](https://github.com/contentful/contentful.js/releases) page.
143
+ ## Release Process
144
+
145
+ Releases are fully automated via [semantic-release](https://github.com/semantic-release/semantic-release):
146
+
147
+ 1. Push/merge to `master`
148
+ 2. CI runs build + all checks
149
+ 3. If passing, semantic-release determines version from commit history:
150
+ - `fix` → patch
151
+ - `feat` → minor
152
+ - `BREAKING CHANGE` / `feat!` → major
153
+ - `build(deps)` → patch
154
+ 4. Publishes to npm, creates GitHub release, updates CHANGELOG.md
155
+ 5. Publishes TypeDoc API documentation
156
+
157
+ **You do not manually bump versions, create tags, or publish.** The commit type determines everything.
158
+
159
+ Pre-releases are published from the `next` branch when active.
160
+
161
+ ## Pull Requests
162
+
163
+ - All tests must pass (CI runs on every push and PR)
164
+ - Husky pre-commit hook runs lint-staged (prettier + eslint)
165
+ - Squash merge to master is standard
166
+ - Bundle size is checked in CI via `size-limit`
167
+ - Bito automated review runs on every PR using `.bito/guidelines/` as its ruleset
168
+
169
+ ## CI/CD
170
+
171
+ | Job | Trigger | What it does |
172
+ |---|---|---|
173
+ | `build` | Push, PR | `npm ci` → `npm run build` → cache dist/ |
174
+ | `lint` | Push, PR | ESLint |
175
+ | `prettier` | Push, PR | Prettier format check |
176
+ | `test` | Push, PR | Vitest (unit + integration) + demo projects |
177
+ | `test-bundle-size` | Push, PR | size-limit check |
178
+ | `test-types` | Push, PR | tsd type tests + es-check |
179
+ | `release` | Push to master/next | semantic-release → npm publish + docs |
180
+ | `codeql` | Push/PR (`.github/workflows/**` changes only) | GitHub Actions workflow security scanning |
181
+
182
+ All workflows live in `.github/workflows/`. The main pipeline is orchestrated by `main.yaml` which calls `build.yaml`, `check.yaml`, and `release.yaml` as reusable workflows.
183
+
184
+ ## File-level Guidance
185
+
186
+ <!-- Generated by seed-golden-context | Last updated: 2026-05-04 -->
187
+
188
+ | Path | Why restricted / notes |
189
+ |---|---|
190
+ | `dist/` | Generated by `npm run build` — never hand-edit. Committed only via CI release workflow. |
191
+ | `dist/esm-raw/` | Intermediate Rollup input — deleted at the end of `npm run build`. Not a shipped output; never reference in `package.json` exports. |
192
+ | `CHANGELOG.md` | Auto-generated by semantic-release on every release. Never hand-edit. |
193
+ | `package.json` → `"version"` | Managed by semantic-release (`"0.0.0-determined-by-semantic-release"` is intentional). Don't bump manually. |
194
+ | `lib/global.d.ts` | Declares `__VERSION__` — replaced at Rollup build time via `@rollup/plugin-replace`. Do not import or rely on its value outside built output. |
195
+ | `.husky/` | Husky hook scripts. Runs lint-staged (prettier + eslint) on pre-commit. Don't bypass with `--no-verify` without a very good reason. |
196
+ | `test/output-integration/` | Self-contained Node and browser projects that install and smoke-test the built package. Run with `npm run test:demo-projects`. |
package/README.md CHANGED
@@ -592,3 +592,7 @@ This repository is published under the [MIT](LICENSE) license.
592
592
  We want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.
593
593
 
594
594
  [Read our full Code of Conduct](https://www.contentful.com/developers/code-of-conduct/).
595
+
596
+ ## For AI Agents
597
+
598
+ If you are an AI coding agent working in this repository, read [AGENTS.md](./AGENTS.md) first. It tells you where to find architectural context, development setup, decision records, and repo-specific rules.