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 +127 -40
- package/README.md +4 -0
- package/dist/contentful.browser.js +1509 -1140
- package/dist/contentful.browser.min.js +1 -1
- package/dist/contentful.cjs +1513 -935
- package/dist/stats-browser-min.html +1 -1
- package/package.json +1 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -40,70 +40,157 @@
|
|
|
40
40
|
</a>
|
|
41
41
|
</p>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
# Contributing
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
## Prerequisites
|
|
46
46
|
|
|
47
|
-
|
|
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
|
-
|
|
52
|
+
## Getting Started
|
|
50
53
|
|
|
51
|
-
|
|
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
|
-
|
|
60
|
+
# Build (required before running tests)
|
|
61
|
+
npm run build
|
|
54
62
|
|
|
55
|
-
Run
|
|
63
|
+
# Run all tests
|
|
64
|
+
npm test
|
|
65
|
+
```
|
|
56
66
|
|
|
57
|
-
|
|
67
|
+
## Development Workflow
|
|
58
68
|
|
|
59
|
-
|
|
69
|
+
```bash
|
|
70
|
+
# Build ESM output only (faster iteration)
|
|
71
|
+
npm run build:esm
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
# Run unit tests in watch mode
|
|
74
|
+
npm run test:unit:watch
|
|
62
75
|
|
|
63
|
-
|
|
76
|
+
# Run integration tests in watch mode
|
|
77
|
+
npm run test:integration:watch
|
|
64
78
|
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
82
|
+
# Format
|
|
83
|
+
npm run prettier
|
|
84
|
+
```
|
|
72
85
|
|
|
73
|
-
|
|
86
|
+
### Full build pipeline
|
|
74
87
|
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
105
|
+
### Test structure
|
|
88
106
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
##
|
|
117
|
+
## Commit Convention
|
|
94
118
|
|
|
95
|
-
This
|
|
119
|
+
This repo uses [Conventional Commits](https://www.conventionalcommits.org/) enforced by commitizen:
|
|
96
120
|
|
|
97
|
-
|
|
121
|
+
```
|
|
122
|
+
type(scope): description
|
|
123
|
+
```
|
|
98
124
|
|
|
99
|
-
|
|
125
|
+
Valid types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`, `ci`, `build`, `revert`
|
|
100
126
|
|
|
101
|
-
|
|
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
|
-
|
|
135
|
+
A pre-commit hook runs lint-staged (prettier + eslint) via husky.
|
|
104
136
|
|
|
105
|
-
|
|
137
|
+
## Branch Strategy
|
|
106
138
|
|
|
107
|
-
|
|
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
|
-
|
|
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.
|