From 7289ac93d412318edefd3e04e9c1ba6eb9c27be9 Mon Sep 17 00:00:00 2001 From: Charles Hudson Date: Tue, 31 Mar 2026 14:45:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=98=20docs(plumbing):=20Updating=20doc?= =?UTF-8?q?s=20plumbing=20to=20fix=20dead=20links=20and=20prep=20for=20Gui?= =?UTF-8?q?des?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [[NT-2556](https://contentful.atlassian.net/browse/NT-2556)] --- .github/workflows/publish-npm.yaml | 9 + AGENTS.md | 7 + CONTRIBUTING.md | 8 +- README.md | 124 ++++---- documentation/README.md | 15 + documentation/choosing-the-right-sdk.md | 70 +++++ implementations/node-sdk+web-sdk/README.md | 6 +- implementations/node-sdk/README.md | 4 +- implementations/react-native-sdk/README.md | 4 +- implementations/web-sdk/README.md | 6 +- implementations/web-sdk_react/README.md | 21 +- lib/build-tools/src/cli.ts | 94 ++++-- lib/build-tools/src/index.ts | 5 + lib/build-tools/src/publishReadme.test.ts | 90 ++++++ lib/build-tools/src/publishReadme.ts | 279 ++++++++++++++++++ packages/node/node-sdk/README.md | 4 +- packages/node/node-sdk/package.json | 5 + packages/react-native-sdk/README.md | 4 +- packages/react-native-sdk/package.json | 5 + .../OptimizationNavigationContainer.tsx | 4 +- .../src/components/OptimizationProvider.tsx | 2 +- .../context/InteractionTrackingContext.tsx | 4 +- .../src/context/LiveUpdatesContext.tsx | 4 +- .../src/context/OptimizationScrollContext.tsx | 2 +- .../src/hooks/useTapTracking.ts | 2 +- packages/react-native-sdk/src/index.ts | 18 +- .../src/preview/components/PreviewPanel.tsx | 2 +- .../components/PreviewPanelOverlay.tsx | 4 +- .../context/PreviewOverrideContext.tsx | 6 +- .../react-native-sdk/src/preview/types.ts | 2 +- packages/universal/api-client/README.md | 6 +- packages/universal/api-client/package.json | 5 + .../universal/api-client/src/ApiClient.ts | 4 +- .../universal/api-client/src/ApiClientBase.ts | 2 +- .../src/experience/ExperienceApiClient.ts | 64 ++-- .../api-client/src/experience/index.ts | 5 +- .../src/fetch/createProtectedFetchMethod.ts | 2 +- .../src/fetch/createRetryFetchMethod.ts | 2 +- .../src/fetch/createTimeoutFetchMethod.ts | 2 +- packages/universal/api-client/src/index.ts | 1 + .../src/insights/InsightsApiClient.ts | 12 +- .../api-client/src/insights/index.ts | 5 +- packages/universal/api-schemas/README.md | 6 +- packages/universal/api-schemas/package.json | 5 + .../api-schemas/src/contentful/CtflEntry.ts | 2 +- .../src/experience/change/Change.ts | 6 +- .../api-schemas/src/experience/index.ts | 1 + .../optimization/SelectedOptimization.ts | 2 +- .../profile/properties/SessionStatistics.ts | 4 +- packages/universal/core-sdk/README.md | 6 +- packages/universal/core-sdk/package.json | 5 + packages/universal/core-sdk/src/CoreBase.ts | 2 +- .../universal/core-sdk/src/CoreStateless.ts | 2 +- .../core-sdk/src/events/EventBuilder.ts | 24 +- packages/universal/core-sdk/src/index.ts | 10 + .../core-sdk/src/lib/decorators/guardedBy.ts | 6 +- .../core-sdk/src/lib/decorators/index.ts | 1 + .../src/lib/interceptor/InterceptorManager.ts | 2 +- .../web/frameworks/react-web-sdk/README.md | 21 +- .../web/frameworks/react-web-sdk/package.json | 5 + packages/web/preview-panel/README.md | 4 +- packages/web/preview-panel/package.json | 5 + .../src/attachOptimizationPreviewPanel.ts | 2 +- packages/web/preview-panel/src/index.ts | 2 + packages/web/web-sdk/README.md | 4 +- packages/web/web-sdk/package.json | 5 + .../web/web-sdk/src/ContentfulOptimization.ts | 6 +- ...resolveAutoTrackEntryInteractionOptions.ts | 4 +- packages/web/web-sdk/src/index.ts | 19 +- typedoc.json | 16 +- 70 files changed, 873 insertions(+), 224 deletions(-) create mode 100644 documentation/README.md create mode 100644 documentation/choosing-the-right-sdk.md create mode 100644 lib/build-tools/src/publishReadme.test.ts create mode 100644 lib/build-tools/src/publishReadme.ts diff --git a/.github/workflows/publish-npm.yaml b/.github/workflows/publish-npm.yaml index 98209be6..86076f7f 100644 --- a/.github/workflows/publish-npm.yaml +++ b/.github/workflows/publish-npm.yaml @@ -69,6 +69,11 @@ jobs: env: RELEASE_VERSION: ${{ env.RELEASE_VERSION }} + - name: Prepare package READMEs for publish + run: pnpm -r --filter "@contentful/optimization-*" exec build-tools rewrite-readme prepare + env: + RELEASE_TAG: ${{ env.RELEASE_TAG }} + - name: Create packages for troubleshooting run: pnpm pack --filter "@contentful/optimization-*" --pack-destination pkgs @@ -92,3 +97,7 @@ jobs: run: pnpm -r --filter "@contentful/optimization-*" publish --access public --no-git-checks env: NODE_AUTH_TOKEN: ${{ steps.vault.outputs.GITHUB_PACKAGES_WRITE_TOKEN }} + + - name: Restore package READMEs after publish + if: always() + run: pnpm -r --filter "@contentful/optimization-*" exec build-tools rewrite-readme restore diff --git a/AGENTS.md b/AGENTS.md index 87d66c1b..4a248e8d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -44,6 +44,7 @@ Prefer editing source files and configuration: - `e2e/**` - `__tests__/**` - `scripts/**` +- `documentation/**` - `README.md` - `package.json` - `tsconfig*.json` @@ -96,6 +97,9 @@ Do not hand-edit generated or local-only artifacts unless the task is explicitly ## Validation Policy - Run the smallest meaningful validation that matches the change. +- When linting or formatting is likely needed, prefer the smallest fix-enabled command that matches + the edited area first, then confirm with a check-only command if needed. Avoid the pattern of + running a pure check, then rerunning the same tool again only to apply obvious auto-fixes. - For TypeScript or TSX edits, run the relevant lint command early enough to influence the shape of the implementation, not only at the end. - For `lib/` or `packages/` edits, prefer `pnpm lint` after the first meaningful patch and again @@ -137,6 +141,8 @@ High-signal repo-wide commands: - unknown - Prefer a small probe before a full rerun. Check the nearest `AGENTS.md`, the target `package.json`, and any relevant `README.md` or `CONTRIBUTING.md` section before guessing. +- If a lint or format command fails with findings that the tool can auto-fix, prefer a targeted + fix-enabled rerun over repeated check-only runs, then revalidate once. - If the shell reports a command as missing: - first prefer `pnpm