From fcf267902df8e44f214088d569f6d0bdfa3493b9 Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 11:54:04 +0530 Subject: [PATCH 01/40] ci: release react-native from the version tag and verify on npm Trigger on release: published. The tag is validated as bare semver and written into packages/react-native/package.json in the runner only; main keeps 0.0.0-dev. Pre-releases ship to the npm next dist-tag, stable to latest, and the GitHub pre-release flag must match the tag. The workflow is now build -> publish -> verify. Publish keeps OIDC trusted publishing, holds the only id-token permission, and skips a version that is already on npm so re-runs are safe. Verify polls the registry until the version is on its dist-tag. Add RELEASING.md, which also documents the v2.2.0 tag. --- .github/workflows/release.yml | 156 +++++++++++++++++++---- RELEASING.md | 71 +++++++++++ packages/react-native/package.json | 2 +- scripts/release/npm-registry.mjs | 91 +++++++++++++ scripts/release/npm-registry.test.mjs | 143 +++++++++++++++++++++ scripts/release/resolve-release.mjs | 54 ++++++++ scripts/release/resolve-release.test.mjs | 108 ++++++++++++++++ 7 files changed, 598 insertions(+), 27 deletions(-) create mode 100644 RELEASING.md create mode 100644 scripts/release/npm-registry.mjs create mode 100644 scripts/release/npm-registry.test.mjs create mode 100644 scripts/release/resolve-release.mjs create mode 100644 scripts/release/resolve-release.test.mjs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba0c29e..c7b22b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,55 +1,159 @@ name: Release React Native SDK -permissions: - id-token: write # Required for OIDC - contents: read +# Publishing a GitHub release (stable or pre-release) ships the tag's version to +# npm. See RELEASING.md. The job only builds, publishes and verifies: CI already +# ran on main, and the manual E2E run against the target server is the QA gate. on: release: - types: [released] + types: [published] + +permissions: {} + +concurrency: + group: release-${{ github.event.release.tag_name }} + cancel-in-progress: false + +env: + PACKAGE_NAME: "@formbricks/react-native" jobs: - release: - name: "Release React Native Package" + build: + name: Build runs-on: ubuntu-latest - timeout-minutes: 30 + timeout-minutes: 15 + permissions: + contents: read + outputs: + version: ${{ steps.release.outputs.version }} + dist_tag: ${{ steps.release.outputs.dist_tag }} steps: - name: Harden the runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 + uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2 with: egress-policy: audit - - name: Checkout code + - name: Checkout the release tag uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.release.tag_name }} + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - name: Setup Node.js - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24.x - registry-url: "https://registry.npmjs.org" + package-manager-cache: false # never restore a cache into a release - - name: Install pnpm - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 + - name: Take the version from the tag + id: release + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_PRERELEASE: ${{ github.event.release.prerelease }} + PACKAGE_JSON: packages/react-native/package.json + run: node scripts/release/resolve-release.mjs - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Lint - run: pnpm lint - - - name: Check types - run: pnpm check-types + - name: Build + run: pnpm --filter "$PACKAGE_NAME" build - - name: Build package + - name: Pack + working-directory: packages/react-native run: | - cd packages/react-native - pnpm build + pnpm pack --pack-destination "$RUNNER_TEMP/package" + mv "$RUNNER_TEMP"/package/*.tgz "$RUNNER_TEMP/package/package.tgz" - - name: Run tests - run: pnpm test:coverage + - name: Upload the package + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: npm-package + path: ${{ runner.temp }}/package/package.tgz + if-no-files-found: error + retention-days: 7 + + publish: + name: Publish + needs: build + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + id-token: write # npm trusted publishing (OIDC) and provenance + + steps: + - name: Harden the runner + uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2 + with: + egress-policy: audit + + - name: Checkout the release scripts + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.release.tag_name }} + persist-credentials: false + sparse-checkout: scripts/release + + - name: Setup Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24.x + package-manager-cache: false # never restore a cache into a release + registry-url: "https://registry.npmjs.org" + + - name: Download the package + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: npm-package + path: ${{ runner.temp }}/package + + - name: Check whether the version is already on npm + id: registry + env: + VERSION: ${{ needs.build.outputs.version }} + run: node scripts/release/npm-registry.mjs published - name: Publish to npm - run: | - cd packages/react-native - npm publish --access public + if: steps.registry.outputs.published == 'false' + env: + DIST_TAG: ${{ needs.build.outputs.dist_tag }} + run: npm publish "$RUNNER_TEMP/package/package.tgz" --access public --tag "$DIST_TAG" + + verify: + name: Verify + needs: [build, publish] + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + + steps: + - name: Harden the runner + uses: step-security/harden-runner@dc2769abcc0fcfbadfc1df54081c1608579ef6b2 # v2.22.2 + with: + egress-policy: audit + + - name: Checkout the release scripts + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: ${{ github.event.release.tag_name }} + persist-credentials: false + sparse-checkout: scripts/release + + - name: Setup Node.js + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24.x + package-manager-cache: false # never restore a cache into a release + + - name: Wait for the version on its dist-tag + env: + VERSION: ${{ needs.build.outputs.version }} + DIST_TAG: ${{ needs.build.outputs.dist_tag }} + TIMEOUT_SECONDS: "600" + run: node scripts/release/npm-registry.mjs verify diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..73476c7 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,71 @@ +# Releasing `@formbricks/react-native` + +Publishing a GitHub release ships the SDK to npm. There is no version-bump PR: +the version comes from the release tag. `packages/react-native/package.json` on +`main` always holds the placeholder `0.0.0-dev`. + +The team-wide QA and release runbook is in Notion: + +## Before you release + +Run the manual QA: start the E2E workflow (`workflow_dispatch`) on `main` with +`server_version` set to the Formbricks server you are releasing against, and wait +for it to pass. Nothing in the release workflow checks that this happened. + +## Cut a release + +1. On GitHub, draft a new release from `main`. +2. Create a new tag that is a bare semver version, with no `v` prefix: + - stable: `3.4.0` + - prerelease: `3.4.0-rc.1`, `3.4.0-beta.2` +3. Tick **Set as a pre-release** if and only if the tag has a prerelease suffix. + The workflow fails before building if the two disagree. +4. Generate the release notes. They are the changelog, built from the semantic + PR titles. +5. Publish the release. + +| Release | npm dist-tag | Install with | +| ----------- | ------------ | ------------------------------------- | +| stable | `latest` | `npm i @formbricks/react-native` | +| pre-release | `next` | `npm i @formbricks/react-native@next` | + +## What the workflow does + +`.github/workflows/release.yml` runs on `release: published`, in three jobs: + +1. **Build**: checks out the tag, runs `scripts/release/resolve-release.mjs` to + validate the tag and write its version into `package.json` (in the runner + only, nothing is committed), then builds and packs the tarball. +2. **Publish**: skips if the version is already on npm, otherwise runs + `npm publish --tag ` with npm trusted publishing (OIDC), which + also attaches provenance. Only this job gets `id-token: write`. +3. **Verify**: polls the registry until the version is on its dist-tag, and + fails after 10 minutes. + +The release does not re-run lint or tests: CI already ran them on `main`. + +## When something fails + +- **Re-run failed jobs** is always safe. Publish skips a version that is already + on npm, and verify only reads the registry. +- **Wrong tag or wrong pre-release box**: the build fails before anything is + published. Publish a new release with a correct tag. Re-running won't help, + because a re-run reuses the original release event. +- **Never delete or move a tag.** npm never accepts the same version twice, so + ship a fix as the next version. +- **Verify timed out** but `npm view @formbricks/react-native dist-tags` shows the + version: the registry was slow. Re-run the verify job. + +## Things to know + +- Trusted publishing on npmjs.com is bound to this repository and to the file + name `release.yml`. Renaming the workflow breaks publishing until the npm + package settings are updated. +- A stable release always moves `latest`. Releasing a patch for an older line + (say `3.2.1` after `3.3.0`) would point `latest` back at it. A maintainer can + restore it with `npm dist-tag add @formbricks/react-native@ latest`. +- Tags are bare versions (`3.3.1`). The one exception is `v2.2.0`, the tag of + the 2.2.0 release (there is no `2.2.0` tag). It stays, because tags are never + deleted and it backs a published GitHub release. The workflow now rejects + `v`-prefixed tags. +- The release scripts have their own tests: `node --test 'scripts/release/*.test.mjs'`. diff --git a/packages/react-native/package.json b/packages/react-native/package.json index cc95aa4..5cd91c7 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -1,6 +1,6 @@ { "name": "@formbricks/react-native", - "version": "3.3.1", + "version": "0.0.0-dev", "license": "MIT", "description": "Formbricks React Native SDK allows you to connect your app to Formbricks, display surveys and trigger events.", "homepage": "https://formbricks.com", diff --git a/scripts/release/npm-registry.mjs b/scripts/release/npm-registry.mjs new file mode 100644 index 0000000..e61b5fc --- /dev/null +++ b/scripts/release/npm-registry.mjs @@ -0,0 +1,91 @@ +import { appendFileSync } from "node:fs"; +import { setTimeout as sleep } from "node:timers/promises"; +import { pathToFileURL } from "node:url"; + +const REGISTRY = "https://registry.npmjs.org"; + +async function fetchPackument(name, fetch) { + const url = `${REGISTRY}/${name.replace("/", "%2f")}`; + const response = await fetch(url); + if (response.status === 404) return { "dist-tags": {}, versions: {} }; + if (!response.ok) { + throw new Error(`${url}: registry returned HTTP ${response.status}`); + } + return response.json(); +} + +export async function isVersionPublished({ name, version, fetch }) { + const packument = await fetchPackument(name, fetch); + return Object.hasOwn(packument.versions, version); +} + +export async function waitForDistTag({ + name, + version, + distTag, + timeoutMs, + intervalMs, + fetch, + sleep, + now, +}) { + const deadline = now() + timeoutMs; + for (;;) { + const packument = await fetchPackument(name, fetch); + const current = packument["dist-tags"][distTag]; + if (current === version) return; + if (now() >= deadline) { + throw new Error( + `${name}@${version} is not on dist-tag "${distTag}" after ${timeoutMs / 1000}s (it points at ${current ?? "nothing"}).`, + ); + } + await sleep(intervalMs); + } +} + +// CLI, configured through PACKAGE_NAME, VERSION and (for verify) DIST_TAG and +// TIMEOUT_SECONDS: +// published writes published=true|false to $GITHUB_OUTPUT +// verify polls until VERSION is live on DIST_TAG, fails after the timeout +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + const { PACKAGE_NAME, VERSION, DIST_TAG, TIMEOUT_SECONDS, GITHUB_OUTPUT } = + process.env; + const command = process.argv[2]; + try { + if (command === "published") { + const published = await isVersionPublished({ + name: PACKAGE_NAME, + version: VERSION, + fetch, + }); + appendFileSync(GITHUB_OUTPUT, `published=${published}\n`); + console.log( + published + ? `${PACKAGE_NAME}@${VERSION} is already on npm; skipping publish.` + : `${PACKAGE_NAME}@${VERSION} is not on npm yet.`, + ); + } else if (command === "verify") { + await waitForDistTag({ + name: PACKAGE_NAME, + version: VERSION, + distTag: DIST_TAG, + timeoutMs: Number(TIMEOUT_SECONDS ?? 600) * 1000, + intervalMs: 15_000, + fetch: (url) => + fetch(url, { headers: { "Cache-Control": "no-cache" } }), + sleep, + now: Date.now, + }); + console.log( + `${PACKAGE_NAME}@${VERSION} is live on dist-tag "${DIST_TAG}".`, + ); + } else { + throw new Error( + `Unknown command "${command}". Use "published" or "verify".`, + ); + } + } catch (error) { + console.error(error.message); + process.exitCode = 1; + } +} diff --git a/scripts/release/npm-registry.test.mjs b/scripts/release/npm-registry.test.mjs new file mode 100644 index 0000000..36d6255 --- /dev/null +++ b/scripts/release/npm-registry.test.mjs @@ -0,0 +1,143 @@ +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; +import { isVersionPublished, waitForDistTag } from "./npm-registry.mjs"; + +const NAME = "@formbricks/react-native"; + +// Stands in for the npm registry: answers the packument request for NAME with +// whatever document the test sets, and records the URLs it was asked for. +function fakeRegistry(documents) { + const queue = [...documents]; + const requests = []; + const fetch = async (url) => { + requests.push(url); + const doc = queue.length > 1 ? queue.shift() : queue[0]; + if (doc === 404) return new Response("Not found", { status: 404 }); + if (doc === 503) return new Response("Unavailable", { status: 503 }); + return Response.json(doc); + }; + return { fetch, requests }; +} + +// A clock that only moves when the code under test sleeps. +function fakeClock() { + let time = 0; + return { + now: () => time, + sleep: async (ms) => { + time += ms; + }, + }; +} + +describe("isVersionPublished", () => { + it("is true when the registry already has the version", async () => { + const registry = fakeRegistry([ + { "dist-tags": { latest: "3.3.1" }, versions: { "3.3.1": {} } }, + ]); + + assert.equal( + await isVersionPublished({ + name: NAME, + version: "3.3.1", + fetch: registry.fetch, + }), + true, + ); + assert.deepEqual(registry.requests, [ + "https://registry.npmjs.org/@formbricks%2freact-native", + ]); + }); + + it("is false when the registry does not have the version yet", async () => { + const registry = fakeRegistry([ + { "dist-tags": { latest: "3.3.1" }, versions: { "3.3.1": {} } }, + ]); + + assert.equal( + await isVersionPublished({ + name: NAME, + version: "3.4.0", + fetch: registry.fetch, + }), + false, + ); + }); + + it("is false when the package has never been published", async () => { + const registry = fakeRegistry([404]); + + assert.equal( + await isVersionPublished({ + name: NAME, + version: "3.4.0", + fetch: registry.fetch, + }), + false, + ); + }); + + it("throws when the registry cannot be read", async () => { + const registry = fakeRegistry([503]); + + await assert.rejects( + isVersionPublished({ + name: NAME, + version: "3.4.0", + fetch: registry.fetch, + }), + /registry returned HTTP 503/, + ); + }); +}); + +describe("waitForDistTag", () => { + it("polls until the dist-tag points at the version", async () => { + const registry = fakeRegistry([ + { "dist-tags": { latest: "3.3.1" }, versions: { "3.3.1": {} } }, + { + "dist-tags": { latest: "3.3.1" }, + versions: { "3.3.1": {}, "3.4.0": {} }, + }, + { + "dist-tags": { latest: "3.4.0" }, + versions: { "3.3.1": {}, "3.4.0": {} }, + }, + ]); + + await waitForDistTag({ + name: NAME, + version: "3.4.0", + distTag: "latest", + timeoutMs: 60_000, + intervalMs: 10_000, + fetch: registry.fetch, + ...fakeClock(), + }); + + assert.equal(registry.requests.length, 3); + }); + + it("fails after the timeout, naming what the dist-tag points at", async () => { + const registry = fakeRegistry([ + { + "dist-tags": { latest: "3.3.1", next: "3.4.0-rc.1" }, + versions: { "3.3.1": {}, "3.4.0-rc.1": {} }, + }, + ]); + + await assert.rejects( + waitForDistTag({ + name: NAME, + version: "3.4.0-rc.1", + distTag: "latest", + timeoutMs: 60_000, + intervalMs: 10_000, + fetch: registry.fetch, + ...fakeClock(), + }), + /@formbricks\/react-native@3\.4\.0-rc\.1 is not on dist-tag "latest" after 60s \(it points at 3\.3\.1\)/, + ); + assert.equal(registry.requests.length, 7); + }); +}); diff --git a/scripts/release/resolve-release.mjs b/scripts/release/resolve-release.mjs new file mode 100644 index 0000000..a3a29da --- /dev/null +++ b/scripts/release/resolve-release.mjs @@ -0,0 +1,54 @@ +import { appendFileSync, readFileSync, writeFileSync } from "node:fs"; +import { pathToFileURL } from "node:url"; + +// SemVer 2.0.0 (https://semver.org), without the "v" prefix and without build +// metadata: npm drops build metadata on publish, so the published version would +// no longer match the tag. +const NUMERIC = "0|[1-9]\\d*"; +const PRERELEASE_ID = `(?:${NUMERIC}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`; +const SEMVER = new RegExp( + `^(?:${NUMERIC})\\.(?:${NUMERIC})\\.(?:${NUMERIC})(?:-${PRERELEASE_ID}(?:\\.${PRERELEASE_ID})*)?$`, +); + +export function resolveRelease({ tag, prerelease }) { + if (!SEMVER.test(tag)) { + throw new Error( + `"${tag}" is not a valid release tag. Use a bare semver version such as 3.4.0 or 3.4.0-rc.1.`, + ); + } + const tagIsPrerelease = tag.includes("-"); + if (tagIsPrerelease && !prerelease) { + throw new Error( + `Tag ${tag} is a prerelease version: mark the GitHub release as a pre-release so it ships to the npm "next" dist-tag.`, + ); + } + if (!tagIsPrerelease && prerelease) { + throw new Error( + `Tag ${tag} is a stable version: untick "Set as a pre-release" on the GitHub release, or use a prerelease tag such as ${tag}-rc.1.`, + ); + } + return { version: tag, distTag: prerelease ? "next" : "latest" }; +} + +// CLI: RELEASE_TAG, RELEASE_PRERELEASE ("true"/"false") and PACKAGE_JSON in, +// version and dist_tag out through $GITHUB_OUTPUT. +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + try { + const { RELEASE_TAG, RELEASE_PRERELEASE, PACKAGE_JSON, GITHUB_OUTPUT } = + process.env; + const { version, distTag } = resolveRelease({ + tag: RELEASE_TAG ?? "", + prerelease: RELEASE_PRERELEASE === "true", + }); + const manifest = JSON.parse(readFileSync(PACKAGE_JSON, "utf8")); + manifest.version = version; + writeFileSync(PACKAGE_JSON, `${JSON.stringify(manifest, null, 2)}\n`); + appendFileSync(GITHUB_OUTPUT, `version=${version}\ndist_tag=${distTag}\n`); + console.log( + `Releasing ${manifest.name}@${version} to dist-tag "${distTag}".`, + ); + } catch (error) { + console.error(error.message); + process.exitCode = 1; + } +} diff --git a/scripts/release/resolve-release.test.mjs b/scripts/release/resolve-release.test.mjs new file mode 100644 index 0000000..2a0bab2 --- /dev/null +++ b/scripts/release/resolve-release.test.mjs @@ -0,0 +1,108 @@ +import assert from "node:assert/strict"; +import { spawnSync } from "node:child_process"; +import { mkdtempSync, readFileSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { describe, it } from "node:test"; +import { fileURLToPath } from "node:url"; +import { resolveRelease } from "./resolve-release.mjs"; + +const CLI = fileURLToPath(new URL("./resolve-release.mjs", import.meta.url)); + +function runCli({ tag, prerelease }) { + const dir = mkdtempSync(join(tmpdir(), "resolve-release-")); + const manifest = join(dir, "package.json"); + const output = join(dir, "github-output"); + writeFileSync( + manifest, + `${JSON.stringify({ name: "@formbricks/react-native", version: "0.0.0-dev", private: false }, null, 2)}\n`, + ); + writeFileSync(output, ""); + const result = spawnSync(process.execPath, [CLI], { + encoding: "utf8", + env: { + ...process.env, + RELEASE_TAG: tag, + RELEASE_PRERELEASE: prerelease, + PACKAGE_JSON: manifest, + GITHUB_OUTPUT: output, + }, + }); + return { + status: result.status, + stderr: result.stderr, + manifest: readFileSync(manifest, "utf8"), + output: readFileSync(output, "utf8"), + }; +} + +describe("resolve-release CLI", () => { + it("writes the tag version into the manifest and exposes the dist-tag", () => { + const run = runCli({ tag: "3.4.0-rc.1", prerelease: "true" }); + + assert.equal(run.status, 0, run.stderr); + assert.equal( + run.manifest, + `{\n "name": "@formbricks/react-native",\n "version": "3.4.0-rc.1",\n "private": false\n}\n`, + ); + assert.equal(run.output, "version=3.4.0-rc.1\ndist_tag=next\n"); + }); + + it("fails without touching the manifest when the tag is invalid", () => { + const run = runCli({ tag: "v3.4.0", prerelease: "false" }); + + assert.notEqual(run.status, 0); + assert.match(run.stderr, /not a valid release tag/); + assert.match(run.manifest, /"version": "0.0.0-dev"/); + assert.equal(run.output, ""); + }); +}); + +describe("resolveRelease", () => { + it("publishes a stable tag to latest", () => { + assert.deepEqual(resolveRelease({ tag: "3.4.0", prerelease: false }), { + version: "3.4.0", + distTag: "latest", + }); + }); + + it("publishes a prerelease tag to next", () => { + assert.deepEqual(resolveRelease({ tag: "3.4.0-rc.1", prerelease: true }), { + version: "3.4.0-rc.1", + distTag: "next", + }); + }); + + it("rejects a prerelease tag on a release not marked as a pre-release", () => { + assert.throws( + () => resolveRelease({ tag: "3.4.0-rc.1", prerelease: false }), + /mark the GitHub release as a pre-release/, + ); + }); + + it("rejects a stable tag on a release marked as a pre-release", () => { + assert.throws( + () => resolveRelease({ tag: "3.4.0", prerelease: true }), + /untick "Set as a pre-release"/, + ); + }); + + for (const tag of [ + "v3.4.0", + "3.4", + "03.4.0", + "3.4.0-", + "3.4.0-rc.01", + "3.4.0+build.1", + "release-3.4.0", + " 3.4.0", + "", + ]) { + it(`rejects ${JSON.stringify(tag)}, which is not a bare semver tag`, () => { + assert.throws( + () => resolveRelease({ tag, prerelease: false }), + /not a valid release tag/, + ); + }); + } +}); From c37ee9f8e196a0307e247a1792bcf4c6bfd9c72a Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 11:56:51 +0530 Subject: [PATCH 02/40] build: roll up types with api-extractor and check the packed package Emit declarations to build/types and roll them into dist/index.d.ts with api-extractor, plus a dist/index.d.cts copy for require consumers. This fixes the attw 'masquerading as ESM' and internal resolution errors. Export the FormbricksProps and TEmbeddedDataInput types the public API already uses. Adds the committed API report (pnpm api:update), publint --strict, attw and a scratch-consumer install of the npm pack tarball (pnpm package-check). --- .github/workflows/build.yml | 38 -- .github/workflows/lint.yml | 41 -- .github/workflows/sonarqube.yml | 45 -- .github/workflows/test.yml | 39 -- package.json | 8 +- packages/react-native/api-extractor.json | 40 ++ packages/react-native/api/react-native.api.md | 60 ++ packages/react-native/package.json | 28 +- .../src/components/formbricks.tsx | 2 +- packages/react-native/src/index.ts | 7 +- packages/react-native/tsconfig.build.json | 4 +- pnpm-lock.yaml | 590 ++++++++++++++++++ scripts/consumer-check.sh | 97 +++ 13 files changed, 821 insertions(+), 178 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/sonarqube.yml delete mode 100644 .github/workflows/test.yml create mode 100644 packages/react-native/api-extractor.json create mode 100644 packages/react-native/api/react-native.api.md create mode 100755 scripts/consumer-check.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 005b855..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Build React Native Package and Playground -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - merge_group: -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Harden the runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 - with: - egress-policy: audit - - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup Node.js 24.x - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 24.x - - - name: Install pnpm - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Build - run: pnpm build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 35cb28a..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Lint and Type Check -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - merge_group: -permissions: - contents: read - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - name: Harden the runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 - with: - egress-policy: audit - - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup Node.js 24.x - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 24.x - - - name: Install pnpm - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Lint - run: pnpm lint - - - name: Check types - run: pnpm check-types diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml deleted file mode 100644 index 5d332d2..0000000 --- a/.github/workflows/sonarqube.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: SonarQube -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - merge_group: -permissions: - contents: read - -jobs: - sonarqube: - name: SonarQube - runs-on: ubuntu-latest - steps: - - name: Harden the runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 - with: - egress-policy: audit - - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.24 - - - name: Setup Node.js 22.x - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 22.x - - - name: Install pnpm - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run tests with coverage - run: | - pnpm test:coverage - - - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index c0aae26..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Run unit tests for react-native package -on: - workflow_dispatch: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - merge_group: -permissions: - contents: read - -jobs: - test: - name: "Test React Native Package" - runs-on: ubuntu-latest - - steps: - - name: Harden the runner - uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 - with: - egress-policy: audit - - - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Setup Node.js 24.x - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 - with: - node-version: 24.x - - - name: Install pnpm - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Test - run: pnpm test diff --git a/package.json b/package.json index 3484ed1..2271ea7 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,15 @@ "scripts": { "build": "turbo run build", "dev": "turbo run dev", - "lint": "node scripts/check-exact-deps.mjs && biome check .", + "lint": "node scripts/check-exact-deps.mjs && biome check --formatter-enabled=false --error-on-warnings .", "format": "biome format --write .", + "format:check": "biome format .", "check-types": "turbo run check-types", "test": "turbo run test --no-cache", - "test:coverage": "turbo run test:coverage --no-cache" + "test:coverage": "turbo run test:coverage --no-cache", + "test:scripts": "node --test scripts/*.test.mjs", + "api:update": "pnpm --filter @formbricks/react-native build", + "package-check": "pnpm --filter @formbricks/react-native package-check && ./scripts/consumer-check.sh" }, "devDependencies": { "@biomejs/biome": "2.4.9", diff --git a/packages/react-native/api-extractor.json b/packages/react-native/api-extractor.json new file mode 100644 index 0000000..3382396 --- /dev/null +++ b/packages/react-native/api-extractor.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "/build/types/index.d.ts", + "compiler": { + "overrideTsconfig": { + "compilerOptions": { + "lib": ["dom", "dom.iterable", "ES2022"], + "module": "ESNext", + "moduleResolution": "bundler", + "skipLibCheck": true, + "strict": true, + "jsx": "react-native" + }, + "include": ["build/types/**/*.d.ts"] + } + }, + "apiReport": { + "enabled": true, + "reportFolder": "/api/", + "reportTempFolder": "/build/api-report-temp/" + }, + "docModel": { "enabled": false }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "/dist/index.d.ts" + }, + "tsdocMetadata": { "enabled": false }, + "messages": { + "extractorMessageReporting": { + "default": { "logLevel": "warning" }, + "ae-missing-release-tag": { "logLevel": "none" } + }, + "tsdocMessageReporting": { + "default": { "logLevel": "warning" } + }, + "compilerMessageReporting": { + "default": { "logLevel": "warning" } + } + } +} diff --git a/packages/react-native/api/react-native.api.md b/packages/react-native/api/react-native.api.md new file mode 100644 index 0000000..b278883 --- /dev/null +++ b/packages/react-native/api/react-native.api.md @@ -0,0 +1,60 @@ +## API Report File for "@formbricks/react-native" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import type { default as React_2 } from 'react'; + +// @public +export const clearEmbeddedData: (...args: [] | [key: string]) => void; + +// @public (undocumented) +function Formbricks(input: FormbricksProps): React_2.JSX.Element | null; +export { Formbricks } +export default Formbricks; + +// @public (undocumented) +export type FormbricksProps = { + appUrl: string; +} & ({ + workspaceId: string; + environmentId?: never; +} | { + environmentId: string; + workspaceId?: never; +}); + +// @public (undocumented) +export const logout: () => Promise; + +// @public +export const setAppearance: (appearance: TAppearance) => void; + +// @public (undocumented) +export const setAttribute: (key: string, value: string | number | Date) => Promise; + +// @public (undocumented) +export const setAttributes: (attributes: Record) => Promise; + +// @public +export const setEmbeddedData: (data: TEmbeddedDataInput) => void; + +// @public (undocumented) +export const setLanguage: (language: string) => Promise; + +// @public (undocumented) +export const setUserId: (userId: string) => Promise; + +// @public +export type TAppearance = "light" | "dark" | "system"; + +// @public +export type TEmbeddedDataInput = Record; + +// @public (undocumented) +export const track: (name: string) => Promise; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/react-native/package.json b/packages/react-native/package.json index cc95aa4..cc70d83 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -6,7 +6,7 @@ "homepage": "https://formbricks.com", "repository": { "type": "git", - "url": "https://github.com/formbricks/react-native" + "url": "git+https://github.com/formbricks/react-native.git" }, "keywords": [ "Formbricks", @@ -26,33 +26,43 @@ ], "exports": { ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } } }, "scripts": { - "build": "rimraf dist tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && vite build", - "build:dev": "rimraf dist tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && vite build --mode dev", + "build": "rimraf dist build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && vite build && pnpm run build:dts", + "build:dev": "rimraf dist build && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && vite build --mode dev && pnpm run build:dts", + "build:dts": "api-extractor run --local && node -e \"require('node:fs').copyFileSync('dist/index.d.ts','dist/index.d.cts')\"", "lint": "biome check .", "dev": "vite build --watch --mode dev", - "clean": "rimraf .turbo node_modules dist tsconfig.build.tsbuildinfo", + "clean": "rimraf .turbo node_modules dist build", "check-types": "tsc -p tsconfig.json --noEmit", "test": "vitest", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "package-check": "publint --strict && attw --pack ." }, "dependencies": { "@react-native-community/netinfo": "12.0.1", "zod": "4.6.6" }, "devDependencies": { + "@arethetypeswrong/cli": "0.18.5", + "@microsoft/api-extractor": "7.60.1", "@types/node": "24.7.2", "@types/react": "19.2.14", "@vitest/coverage-v8": "4.1.12", + "publint": "0.3.25", "react": "19.2.4", "react-native": "0.84.1", - "typescript": "6.0.2", "tsc-alias": "1.8.16", + "typescript": "6.0.2", "vite": "8.3.5", "vitest": "4.1.12" }, diff --git a/packages/react-native/src/components/formbricks.tsx b/packages/react-native/src/components/formbricks.tsx index 1eac3d5..7196293 100644 --- a/packages/react-native/src/components/formbricks.tsx +++ b/packages/react-native/src/components/formbricks.tsx @@ -6,7 +6,7 @@ import { Logger } from "@/lib/common/logger"; import { setup } from "@/lib/common/setup"; import { SurveyStore } from "@/lib/survey/store"; -type FormbricksProps = { appUrl: string } & ( +export type FormbricksProps = { appUrl: string } & ( | { workspaceId: string; environmentId?: never; diff --git a/packages/react-native/src/index.ts b/packages/react-native/src/index.ts index fbb089c..7577794 100644 --- a/packages/react-native/src/index.ts +++ b/packages/react-native/src/index.ts @@ -92,5 +92,10 @@ export const clearEmbeddedData = (...args: [] | [key: string]): void => { EmbeddedDataStore.getInstance().clearEmbeddedData(...args); }; -export { Formbricks, Formbricks as default } from "@/components/formbricks"; +export { + Formbricks, + Formbricks as default, + type FormbricksProps, +} from "@/components/formbricks"; export type { TAppearance } from "@/lib/common/appearance"; +export type { TEmbeddedDataInput } from "@/lib/survey/embedded-data"; diff --git a/packages/react-native/tsconfig.build.json b/packages/react-native/tsconfig.build.json index 4d7ec7b..d2c65c9 100644 --- a/packages/react-native/tsconfig.build.json +++ b/packages/react-native/tsconfig.build.json @@ -4,9 +4,9 @@ "compilerOptions": { "noEmit": false, "emitDeclarationOnly": true, - "outDir": "./dist", + "outDir": "./build/types", "rootDir": "./src", - "tsBuildInfoFile": "./tsconfig.build.tsbuildinfo" + "tsBuildInfoFile": "./build/tsconfig.build.tsbuildinfo" }, "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 23632f9..60e92f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,6 +89,12 @@ importers: specifier: 4.6.6 version: 4.6.6 devDependencies: + '@arethetypeswrong/cli': + specifier: 0.18.5 + version: 0.18.5 + '@microsoft/api-extractor': + specifier: 7.60.1 + version: 7.60.1(@types/node@24.7.2) '@types/node': specifier: 24.7.2 version: 24.7.2 @@ -98,6 +104,9 @@ importers: '@vitest/coverage-v8': specifier: 4.1.12 version: 4.1.12(vitest@4.1.12) + publint: + specifier: 0.3.25 + version: 0.3.25 react: specifier: 19.2.4 version: 19.2.4 @@ -119,6 +128,18 @@ importers: packages: + '@andrewbranch/untar.js@1.0.4': + resolution: {integrity: sha512-pVXSwPsLuw8IGLo2Di0EaOfsk+ntVvpkk942J/sHYIkwvtKUakEcPh7HBgZ6tuimgzKSEHgCvO4XgQ05DEbwDw==} + + '@arethetypeswrong/cli@0.18.5': + resolution: {integrity: sha512-gM+8vRsQOD/Uc7EnBedUhkG5OCsDWE4uoak5QvomGpMpaky0Eh41p04nIMgrWb8EOmqZUJGc6zz9hsP6E56R7g==} + engines: {node: '>=20'} + hasBin: true + + '@arethetypeswrong/core@0.18.5': + resolution: {integrity: sha512-9ytjzGwxjm9Uz7I9avfbt5vlQt6uk9uRRESzJjqrznl6WKvI6dwYTo+vJ3U02Wrq/mR3iql/PzhvHhKdJIAjDQ==} + engines: {node: '>=20'} + '@babel/code-frame@7.29.7': resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} engines: {node: '>=6.9.0'} @@ -699,6 +720,13 @@ packages: cpu: [x64] os: [win32] + '@braidai/lang@1.1.2': + resolution: {integrity: sha512-qBcknbBufNHlui137Hft8xauQMTZDKdophmLFv05r2eNmdIv/MlPuP4TdUknHG68UdWLgVZwgxVe735HzJNIwA==} + + '@colors/colors@1.5.0': + resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==} + engines: {node: '>=0.1.90'} + '@expo/cli@55.0.19': resolution: {integrity: sha512-PPNWwPXHcLDFgNNmkLmlLm3fLiNTxr7sbhNx4mXdjo0U/2Wg3rWaCeg1yMx49llOpDLZEWJpyAwPvTBqWc8glw==} hasBin: true @@ -912,6 +940,24 @@ packages: '@jridgewell/trace-mapping@0.3.31': resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + '@loaderkit/resolve@1.0.6': + resolution: {integrity: sha512-G8FdIoF5CypfwmD9rl8BXod5HDn8JqB0CCNBXDTaRZ+yRYhARrrSToX1zg1zy9jX3zLqigsELwhT4gNtkdQAUg==} + + '@microsoft/api-extractor-model@7.33.16': + resolution: {integrity: sha512-MO61eHRI3DDieE9pxNo5xc096NGUQAIKzEPW6IhNNGU9K4EIhRSYiXfroDZX4joNkrWBMzAMp3WhbPGbHG5zHQ==} + engines: {node: '>=20.9.0'} + + '@microsoft/api-extractor@7.60.1': + resolution: {integrity: sha512-1FJ/Z30xLL3pWn6oYSJCjGsnlEWkWivwmVeCB7YrRPe+47J7H54NVR+m/1PIL1RYsh/mZsxm/FwirreD72G76g==} + engines: {node: '>=20.9.0'} + hasBin: true + + '@microsoft/tsdoc-config@0.18.3': + resolution: {integrity: sha512-0I0rGXo1eJziw3EEErkDS9p/0RzBcyOiV+zbSDqOZTeURmhtut+WIvpih0LM5g+ZpZ9SyFxDfkhAcl/r8e2zGw==} + + '@microsoft/tsdoc@0.17.1': + resolution: {integrity: sha512-VHyYyyoH63jFoO3shpw9Zfijk5v/9p/VrClW35z0/q6ooK7sSmxpzOkS4iZPxs3vO4XtBW4H38HRAKkAMIK7DA==} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -927,6 +973,10 @@ packages: '@oxc-project/types@0.155.0': resolution: {integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==} + '@publint/pack@0.1.7': + resolution: {integrity: sha512-4EDEmvxWtgsCnnVeBvtFIFZtUhPPt1+bA9JrSwU4Sa//6oKtzCSlGGXYJr44OD9aGISymbieJ4mCKHUygUDU+g==} + engines: {node: '>=18'} + '@react-native-async-storage/async-storage@2.2.0': resolution: {integrity: sha512-gvRvjR5JAaUZF8tv2Kcq/Gbt3JHwbKFYfmb445rhOj6NUMx3qPLixmDx5pZAyb9at1bYvJ4/eTUipU5aki45xw==} peerDependencies: @@ -1130,9 +1180,47 @@ packages: '@rolldown/pluginutils@1.0.1': resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + '@rushstack/node-core-library@5.25.2': + resolution: {integrity: sha512-76QGqWRVMtd/KZqhfSOMBgDvxIUsYPhUBhLSorGdn/wwkuESoJ2/cUI3KmfMKrZrE72o8Lau4P8kCBH/omI17Q==} + engines: {node: '>=20.9.0'} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/problem-matcher@0.2.1': + resolution: {integrity: sha512-gulfhBs6n+I5b7DvjKRfhMGyUejtSgOHTclF/eONr8hcgF1APEDjhxIsfdUYYMzC3rvLwGluqLjbwCFZ8nxrog==} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/rig-package@0.7.4': + resolution: {integrity: sha512-SHZdzc9b2ptUb5uvRWALtAceD/QKZ4UAnZjcaKviTMPmHBnW14gs7XDocn6sDv2EqgnxxFPFkpV7/I3cUijCbw==} + engines: {node: '>=20.9.0'} + + '@rushstack/terminal@0.24.8': + resolution: {integrity: sha512-VJAq8ZVgnEtXOC+FnBL3YdP5YNBibT9JvRvEuXsqi0ENZ+Ha0uR9CaK2c+4y8hdk/n6Y2SJ6+AZYDfSQmqupWg==} + engines: {node: '>=20.9.0'} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true + + '@rushstack/ts-command-line@5.3.18': + resolution: {integrity: sha512-acP68tGx/DJEIQgTqj/xStBRaghN7axV+uAjNasDjVXgHgHaLQ1f16/bbXtw6mNLjURhTORD4fdfbOZM7kyWcw==} + engines: {node: '>=20.9.0'} + '@sinclair/typebox@0.27.10': resolution: {integrity: sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==} + '@sindresorhus/is@4.6.0': + resolution: {integrity: sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==} + engines: {node: '>=10'} + '@sinonjs/commons@3.0.1': resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} @@ -1172,6 +1260,9 @@ packages: cpu: [arm64] os: [win32] + '@types/argparse@1.0.38': + resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -1283,6 +1374,28 @@ packages: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} + ajv-draft-04@1.0.0: + resolution: {integrity: sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==} + peerDependencies: + ajv: ^8.5.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv@8.18.0: + resolution: {integrity: sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==} + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + anser@1.4.10: resolution: {integrity: sha512-hCv9AqTQ8ycjpSd3upOJd7vFwW1JaoYQ7tpham03GJ1ca8/65rqn0RpaWpItOAd6ylW9wAw6luXYPJIyPFVOww==} @@ -1290,6 +1403,10 @@ packages: resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} engines: {node: '>=8'} + ansi-escapes@7.3.0: + resolution: {integrity: sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==} + engines: {node: '>=18'} + ansi-regex@4.1.1: resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==} engines: {node: '>=6'} @@ -1298,6 +1415,10 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + ansi-regex@6.6.0: + resolution: {integrity: sha512-XZ5apbzreCbXSKwPjJstu8R0zOi247w3XYwWxtwBXgpZrCyc1Ka7p9/xY0A9/diMewmHbEKz+FIraWaEWjlN5g==} + engines: {node: '>=12'} + ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -1310,6 +1431,9 @@ packages: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} + any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -1491,6 +1615,14 @@ packages: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -1510,14 +1642,29 @@ packages: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} + cjs-module-lexer@1.4.3: + resolution: {integrity: sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==} + cli-cursor@2.1.0: resolution: {integrity: sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==} engines: {node: '>=4'} + cli-highlight@2.1.11: + resolution: {integrity: sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg==} + engines: {node: '>=8.0.0', npm: '>=5.0.0'} + hasBin: true + cli-spinners@2.9.2: resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==} engines: {node: '>=6'} + cli-table3@0.6.5: + resolution: {integrity: sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==} + engines: {node: 10.* || >= 12.*} + + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -1539,6 +1686,10 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + commander@12.1.0: resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} engines: {node: '>=18'} @@ -1630,6 +1781,10 @@ packages: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + diff@8.0.4: + resolution: {integrity: sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw==} + engines: {node: '>=0.3.1'} + dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -1646,6 +1801,9 @@ packages: emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + emojilib@2.4.0: + resolution: {integrity: sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw==} + encodeurl@1.0.2: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} engines: {node: '>= 0.8'} @@ -1654,6 +1812,10 @@ packages: resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} engines: {node: '>= 0.8'} + environment@1.1.0: + resolution: {integrity: sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==} + engines: {node: '>=18'} + error-stack-parser@2.1.4: resolution: {integrity: sha512-Sk5V6wVazPhq5MhpO+AUxJn5x7XSXGl1R93Vn7i+zS15KDVxQijejNCrz8340/2bgLBjR9GtEG8ZVKONDjcqGQ==} @@ -1771,6 +1933,9 @@ packages: exponential-backoff@3.1.3: resolution: {integrity: sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==} + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-glob@3.3.3: resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} engines: {node: '>=8.6.0'} @@ -1778,6 +1943,9 @@ packages: fast-json-stable-stringify@2.1.0: resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + fast-uri@3.1.9: + resolution: {integrity: sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==} + fastq@1.20.1: resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} @@ -1801,6 +1969,9 @@ packages: fetch-nodeshim@0.4.10: resolution: {integrity: sha512-m6I8ALe4L4XpdETy7MJZWs6L1IVMbjs99bwbpIKphxX+0CTns4IKDWJY0LWfr4YsFjfg+z1TjzTMU8lKl8rG0w==} + fflate@0.8.3: + resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==} + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -1823,6 +1994,10 @@ packages: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} + fs-extra@11.3.6: + resolution: {integrity: sha512-w8ZNZr2mKIc7qeNaQ9AVPT1+iFaI+Avd4xudVOvdDJ8VytREi1Ft5Ih7hd9jjehod8vAM5GMsfQ/TpPf4EyoEA==} + engines: {node: '>=14.14'} + fs.realpath@1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} @@ -1893,6 +2068,9 @@ packages: hermes-parser@0.32.0: resolution: {integrity: sha512-g4nBOWFpuiTqjR3LZdRxKUkij9iyveWeuks7INEsMX741f3r9xxrOe8TeQfUxtda0eXmiIFiMQzoeSQEno33Hw==} + highlight.js@10.7.3: + resolution: {integrity: sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==} + hosted-git-info@7.0.2: resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==} engines: {node: ^16.14.0 || >=18.0.0} @@ -1920,6 +2098,10 @@ packages: engines: {node: '>=18'} hasBin: true + import-lazy@4.0.0: + resolution: {integrity: sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==} + engines: {node: '>=8'} + imurmurhash@0.1.4: resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} @@ -2033,6 +2215,9 @@ packages: jimp-compact@0.16.1: resolution: {integrity: sha512-dZ6Ra7u1G8c4Letq/B5EzAxj4tLFHL+cGtdpR+PVm4yzPDj+lCk+AbivWt1eOM+ikzkowtyV7qSqX6qr3t71Ww==} + jju@1.4.0: + resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} + js-tokens@10.0.0: resolution: {integrity: sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==} @@ -2055,11 +2240,17 @@ packages: engines: {node: '>=6'} hasBin: true + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} hasBin: true + jsonfile@6.2.1: + resolution: {integrity: sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==} + kleur@3.0.3: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} @@ -2190,6 +2381,17 @@ packages: makeerror@1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} + marked-terminal@7.3.1: + resolution: {integrity: sha512-B1eKs5mRiacjHHMlex1zn0zkVomz2/KWjD/dyA8WRQTXk2d15OzVjiK/iuPfvDFB27Gvr8p/u6MYgU0NY/O45w==} + engines: {node: '>=16.0.0'} + peerDependencies: + marked: '>=1 <19' + + marked@9.1.6: + resolution: {integrity: sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==} + engines: {node: '>= 16'} + hasBin: true + marky@1.3.0: resolution: {integrity: sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==} @@ -2306,6 +2508,10 @@ packages: engines: {node: '>=10'} hasBin: true + mri@1.2.0: + resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} + engines: {node: '>=4'} + ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} @@ -2319,6 +2525,9 @@ packages: resolution: {integrity: sha512-BzQguy9W9NJgoVn2mRWzbFrFWWztGCcng2QI9+41frfk+Athwgx3qhqhvStz7ExeUUu7Kzw427sNzHpEZNINog==} engines: {node: '>=16.0.0'} + mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + nanoid@3.3.19: resolution: {integrity: sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -2332,6 +2541,10 @@ packages: resolution: {integrity: sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==} engines: {node: '>= 0.6'} + node-emoji@2.2.0: + resolution: {integrity: sha512-Z3lTE9pLaJF47NyMhd4ww1yFTAP8YhYI8SleJiHzM46Fgpm5cnNzSl9XfzFNqbaz+VlJrIj3fXQ4DeN1Rjm6cw==} + engines: {node: '>=18'} + node-forge@1.4.3: resolution: {integrity: sha512-P6wzfh6t70avmV8FrVEAd/36sOPJQ+hkaJVX1Laap9J/77m7M0eyozDvc8SwnDf4P7MP94gwbAAo0rg3YVXT+g==} engines: {node: '>= 6.13.0'} @@ -2358,6 +2571,10 @@ packages: resolution: {integrity: sha512-egUxXCDwoWG06NGCS5s5AdcpnumHKJlfd3HH06P3m9TEMwwScfcY35wpQxbm9oHof+dM/lVH9Rfyu1elTVelSA==} engines: {node: '>=20.19.4'} + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + obug@2.1.1: resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} @@ -2407,10 +2624,22 @@ packages: package-json-from-dist@1.0.1: resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + package-manager-detector@1.9.0: + resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==} + parse-png@2.1.0: resolution: {integrity: sha512-Nt/a5SfCLiTnQAjx3fHlqp8hRgTL3z7kTQZzvIMS9uCAepnCyjpdEc6M/sz69WqMBdaDBw9sF1F1UaHROYzGkQ==} engines: {node: '>=10'} + parse5-htmlparser2-tree-adapter@6.0.1: + resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} + + parse5@5.1.1: + resolution: {integrity: sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==} + + parse5@6.0.1: + resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -2491,6 +2720,11 @@ packages: resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} engines: {node: '>= 6'} + publint@0.3.25: + resolution: {integrity: sha512-WMMbn/d7JqRlfXQL/JUI4n5skC8cJ5WVr8/wT5mmiYWkUdENkZr1I5rgs2+dQPVRgoJd+JRYtB46MTsuDylw9g==} + engines: {node: '>=18'} + hasBin: true + queue-lit@1.5.2: resolution: {integrity: sha512-tLc36IOPeMAubu8BkW8YDBV+WyIgKlYU7zUNs0J5Vk9skSZ4JfGlPOqplP0aHdfv7HL0B2Pg6nwiq60Qc6M2Hw==} engines: {node: '>=12'} @@ -2574,6 +2808,10 @@ packages: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + resolve-from@5.0.0: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} @@ -2615,6 +2853,10 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + sade@1.8.1: + resolution: {integrity: sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==} + engines: {node: '>=6'} + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -2678,6 +2920,10 @@ packages: sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + skin-tone@2.0.0: + resolution: {integrity: sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA==} + engines: {node: '>=8'} + slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -2733,6 +2979,10 @@ packages: resolution: {integrity: sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg==} engines: {node: '>= 0.10.0'} + string-argv@0.3.2: + resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} + engines: {node: '>=0.6.19'} + string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -2764,6 +3014,10 @@ packages: resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==} engines: {node: '>=8'} + supports-hyperlinks@3.2.0: + resolution: {integrity: sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==} + engines: {node: '>=14.18'} + supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} @@ -2781,6 +3035,13 @@ packages: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} + thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + + thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + throat@5.0.0: resolution: {integrity: sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==} @@ -2791,6 +3052,10 @@ packages: resolution: {integrity: sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==} engines: {node: '>=18'} + tinyexec@1.3.1: + resolution: {integrity: sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==} + engines: {node: '>=18'} + tinyglobby@0.2.15: resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} engines: {node: '>=12.0.0'} @@ -2838,11 +3103,21 @@ packages: resolution: {integrity: sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==} engines: {node: '>=8'} + typescript@5.6.1-rc: + resolution: {integrity: sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ==} + engines: {node: '>=14.17'} + hasBin: true + typescript@6.0.2: resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==} engines: {node: '>=14.17'} hasBin: true + typescript@6.0.3: + resolution: {integrity: sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==} + engines: {node: '>=14.17'} + hasBin: true + undici-types@7.14.0: resolution: {integrity: sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==} @@ -2850,6 +3125,10 @@ packages: resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} engines: {node: '>=4'} + unicode-emoji-modifier-base@1.0.0: + resolution: {integrity: sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g==} + engines: {node: '>=4'} + unicode-match-property-ecmascript@2.0.0: resolution: {integrity: sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==} engines: {node: '>=4'} @@ -2862,6 +3141,10 @@ packages: resolution: {integrity: sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==} engines: {node: '>=4'} + universalify@2.0.1: + resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} + engines: {node: '>= 10.0.0'} + unpipe@1.0.0: resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} engines: {node: '>= 0.8'} @@ -3060,10 +3343,18 @@ packages: engines: {node: '>= 14.6'} hasBin: true + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs@16.2.2: + resolution: {integrity: sha512-Nt9ZJjXTv5R8MHbqby/wXQ6Gi0Bb3TcYZkR1bzuL4yB2OxWPkXknz513gEF0GoA6tn00UpbPvERW8rzCuWCA6w==} + engines: {node: '>=10'} + yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} @@ -3076,6 +3367,29 @@ packages: snapshots: + '@andrewbranch/untar.js@1.0.4': {} + + '@arethetypeswrong/cli@0.18.5': + dependencies: + '@arethetypeswrong/core': 0.18.5 + chalk: 4.1.2 + cli-table3: 0.6.5 + commander: 10.0.1 + marked: 9.1.6 + marked-terminal: 7.3.1(marked@9.1.6) + semver: 7.8.5 + + '@arethetypeswrong/core@0.18.5': + dependencies: + '@andrewbranch/untar.js': 1.0.4 + '@loaderkit/resolve': 1.0.6 + cjs-module-lexer: 1.4.3 + fflate: 0.8.3 + lru-cache: 11.5.1 + semver: 7.8.5 + typescript: 5.6.1-rc + validate-npm-package-name: 5.0.1 + '@babel/code-frame@7.29.7': dependencies: '@babel/helper-validator-identifier': 7.29.7 @@ -3852,6 +4166,11 @@ snapshots: '@biomejs/cli-win32-x64@2.4.9': optional: true + '@braidai/lang@1.1.2': {} + + '@colors/colors@1.5.0': + optional: true + '@expo/cli@55.0.19(@expo/dom-webview@55.0.3)(expo-constants@55.0.9(expo@55.0.9)(react-native@0.84.1(@babel/core@7.29.6)(@types/react@19.2.14)(react@19.2.4))(typescript@6.0.2))(expo-font@55.0.4(expo@55.0.9)(react-native@0.84.1(@babel/core@7.29.6)(@types/react@19.2.14)(react@19.2.4))(react@19.2.4))(expo@55.0.9)(react-native@0.84.1(@babel/core@7.29.6)(@types/react@19.2.14)(react@19.2.4))(react@19.2.4)(typescript@6.0.2)': dependencies: '@expo/code-signing-certificates': 0.0.6 @@ -4266,6 +4585,45 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + '@loaderkit/resolve@1.0.6': + dependencies: + '@braidai/lang': 1.1.2 + + '@microsoft/api-extractor-model@7.33.16(@types/node@24.7.2)': + dependencies: + '@microsoft/tsdoc': 0.17.1 + '@microsoft/tsdoc-config': 0.18.3 + '@rushstack/node-core-library': 5.25.2(@types/node@24.7.2) + transitivePeerDependencies: + - '@types/node' + + '@microsoft/api-extractor@7.60.1(@types/node@24.7.2)': + dependencies: + '@microsoft/api-extractor-model': 7.33.16(@types/node@24.7.2) + '@microsoft/tsdoc': 0.17.1 + '@microsoft/tsdoc-config': 0.18.3 + '@rushstack/node-core-library': 5.25.2(@types/node@24.7.2) + '@rushstack/rig-package': 0.7.4 + '@rushstack/terminal': 0.24.8(@types/node@24.7.2) + '@rushstack/ts-command-line': 5.3.18(@types/node@24.7.2) + diff: 8.0.4 + minimatch: 10.2.3 + resolve: 1.22.11 + semver: 7.7.4 + source-map: 0.6.1 + typescript: 6.0.3 + transitivePeerDependencies: + - '@types/node' + + '@microsoft/tsdoc-config@0.18.3': + dependencies: + '@microsoft/tsdoc': 0.17.1 + ajv: 8.18.0 + jju: 1.4.0 + resolve: 1.22.11 + + '@microsoft/tsdoc@0.17.1': {} + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -4280,6 +4638,10 @@ snapshots: '@oxc-project/types@0.155.0': {} + '@publint/pack@0.1.7': + dependencies: + tinyexec: 1.3.1 + '@react-native-async-storage/async-storage@2.2.0(react-native@0.84.1(@babel/core@7.29.7)(@types/react@19.2.14)(react@19.2.4))': dependencies: merge-options: 3.0.4 @@ -4528,8 +4890,49 @@ snapshots: '@rolldown/pluginutils@1.0.1': {} + '@rushstack/node-core-library@5.25.2(@types/node@24.7.2)': + dependencies: + ajv: 8.20.0 + ajv-draft-04: 1.0.0(ajv@8.20.0) + ajv-formats: 3.0.1(ajv@8.20.0) + fs-extra: 11.3.6 + import-lazy: 4.0.0 + jju: 1.4.0 + resolve: 1.22.11 + semver: 7.7.4 + optionalDependencies: + '@types/node': 24.7.2 + + '@rushstack/problem-matcher@0.2.1(@types/node@24.7.2)': + optionalDependencies: + '@types/node': 24.7.2 + + '@rushstack/rig-package@0.7.4': + dependencies: + jju: 1.4.0 + resolve: 1.22.11 + + '@rushstack/terminal@0.24.8(@types/node@24.7.2)': + dependencies: + '@rushstack/node-core-library': 5.25.2(@types/node@24.7.2) + '@rushstack/problem-matcher': 0.2.1(@types/node@24.7.2) + supports-color: 8.1.1 + optionalDependencies: + '@types/node': 24.7.2 + + '@rushstack/ts-command-line@5.3.18(@types/node@24.7.2)': + dependencies: + '@rushstack/terminal': 0.24.8(@types/node@24.7.2) + '@types/argparse': 1.0.38 + argparse: 1.0.10 + string-argv: 0.3.2 + transitivePeerDependencies: + - '@types/node' + '@sinclair/typebox@0.27.10': {} + '@sindresorhus/is@4.6.0': {} + '@sinonjs/commons@3.0.1': dependencies: type-detect: 4.0.8 @@ -4558,6 +4961,8 @@ snapshots: '@turbo/windows-arm64@2.9.14': optional: true + '@types/argparse@1.0.38': {} + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.29.11 @@ -4690,16 +5095,44 @@ snapshots: agent-base@7.1.4: {} + ajv-draft-04@1.0.0(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv@8.18.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.9 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.9 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + anser@1.4.10: {} ansi-escapes@4.3.2: dependencies: type-fest: 0.21.3 + ansi-escapes@7.3.0: + dependencies: + environment: 1.1.0 + ansi-regex@4.1.1: {} ansi-regex@5.0.1: {} + ansi-regex@6.6.0: {} + ansi-styles@3.2.1: dependencies: color-convert: 1.9.3 @@ -4710,6 +5143,8 @@ snapshots: ansi-styles@5.2.0: {} + any-promise@1.3.0: {} + anymatch@3.1.3: dependencies: normalize-path: 3.0.0 @@ -4979,6 +5414,10 @@ snapshots: ansi-styles: 4.3.0 supports-color: 7.2.0 + chalk@5.6.2: {} + + char-regex@1.0.2: {} + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -5015,12 +5454,35 @@ snapshots: ci-info@3.9.0: {} + cjs-module-lexer@1.4.3: {} + cli-cursor@2.1.0: dependencies: restore-cursor: 2.0.0 + cli-highlight@2.1.11: + dependencies: + chalk: 4.1.2 + highlight.js: 10.7.3 + mz: 2.7.0 + parse5: 5.1.1 + parse5-htmlparser2-tree-adapter: 6.0.1 + yargs: 16.2.2 + cli-spinners@2.9.2: {} + cli-table3@0.6.5: + dependencies: + string-width: 4.2.3 + optionalDependencies: + '@colors/colors': 1.5.0 + + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + cliui@8.0.1: dependencies: string-width: 4.2.3 @@ -5041,6 +5503,8 @@ snapshots: color-name@1.1.4: {} + commander@10.0.1: {} + commander@12.1.0: {} commander@2.20.3: {} @@ -5117,6 +5581,8 @@ snapshots: detect-libc@2.1.2: {} + diff@8.0.4: {} + dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -5129,10 +5595,14 @@ snapshots: emoji-regex@8.0.0: {} + emojilib@2.4.0: {} + encodeurl@1.0.2: {} encodeurl@2.0.0: {} + environment@1.1.0: {} + error-stack-parser@2.1.4: dependencies: stackframe: 1.3.4 @@ -5266,6 +5736,8 @@ snapshots: exponential-backoff@3.1.3: {} + fast-deep-equal@3.1.3: {} + fast-glob@3.3.3: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -5276,6 +5748,8 @@ snapshots: fast-json-stable-stringify@2.1.0: {} + fast-uri@3.1.9: {} + fastq@1.20.1: dependencies: reusify: 1.1.0 @@ -5292,6 +5766,8 @@ snapshots: fetch-nodeshim@0.4.10: {} + fflate@0.8.3: {} + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -5319,6 +5795,12 @@ snapshots: fresh@0.5.2: {} + fs-extra@11.3.6: + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.2.1 + universalify: 2.0.1 + fs.realpath@1.0.0: {} fsevents@2.3.3: @@ -5384,6 +5866,8 @@ snapshots: dependencies: hermes-estree: 0.32.0 + highlight.js@10.7.3: {} + hosted-git-info@7.0.2: dependencies: lru-cache: 10.4.3 @@ -5411,6 +5895,8 @@ snapshots: image-size@2.0.4: {} + import-lazy@4.0.0: {} + imurmurhash@0.1.4: {} inflight@1.0.6: @@ -5553,6 +6039,8 @@ snapshots: jimp-compact@0.16.1: {} + jju@1.4.0: {} + js-tokens@10.0.0: {} js-tokens@4.0.0: {} @@ -5570,8 +6058,16 @@ snapshots: jsesc@3.1.0: {} + json-schema-traverse@1.0.0: {} + json5@2.2.3: {} + jsonfile@6.2.1: + dependencies: + universalify: 2.0.1 + optionalDependencies: + graceful-fs: 4.2.11 + kleur@3.0.3: {} lan-network@0.2.0: {} @@ -5676,6 +6172,19 @@ snapshots: dependencies: tmpl: 1.0.5 + marked-terminal@7.3.1(marked@9.1.6): + dependencies: + ansi-escapes: 7.3.0 + ansi-regex: 6.6.0 + chalk: 5.6.2 + cli-highlight: 2.1.11 + cli-table3: 0.6.5 + marked: 9.1.6 + node-emoji: 2.2.0 + supports-hyperlinks: 3.2.0 + + marked@9.1.6: {} + marky@1.3.0: {} memoize-one@5.2.1: {} @@ -5892,6 +6401,8 @@ snapshots: mkdirp@1.0.4: {} + mri@1.2.0: {} + ms@2.0.0: {} ms@2.1.3: {} @@ -5900,12 +6411,25 @@ snapshots: mylas@2.1.14: {} + mz@2.7.0: + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + nanoid@3.3.19: {} negotiator@0.6.3: {} negotiator@0.6.4: {} + node-emoji@2.2.0: + dependencies: + '@sindresorhus/is': 4.6.0 + char-regex: 1.0.2 + emojilib: 2.4.0 + skin-tone: 2.0.0 + node-forge@1.4.3: {} node-int64@0.4.0: {} @@ -5927,6 +6451,8 @@ snapshots: dependencies: flow-enums-runtime: 0.0.6 + object-assign@4.1.1: {} + obug@2.1.1: {} on-finished@2.3.0: @@ -5979,10 +6505,20 @@ snapshots: package-json-from-dist@1.0.1: {} + package-manager-detector@1.9.0: {} + parse-png@2.1.0: dependencies: pngjs: 3.4.0 + parse5-htmlparser2-tree-adapter@6.0.1: + dependencies: + parse5: 6.0.1 + + parse5@5.1.1: {} + + parse5@6.0.1: {} + parseurl@1.3.3: {} path-exists@4.0.0: {} @@ -6047,6 +6583,13 @@ snapshots: kleur: 3.0.3 sisteransi: 1.0.5 + publint@0.3.25: + dependencies: + '@publint/pack': 0.1.7 + package-manager-detector: 1.9.0 + picocolors: 1.1.1 + sade: 1.8.1 + queue-lit@1.5.2: {} queue-microtask@1.2.3: {} @@ -6211,6 +6754,8 @@ snapshots: require-directory@2.1.1: {} + require-from-string@2.0.2: {} + resolve-from@5.0.0: {} resolve-pkg-maps@1.0.0: {} @@ -6264,6 +6809,10 @@ snapshots: dependencies: queue-microtask: 1.2.3 + sade@1.8.1: + dependencies: + mri: 1.2.0 + safe-buffer@5.2.1: {} sax@1.4.4: {} @@ -6327,6 +6876,10 @@ snapshots: sisteransi@1.0.5: {} + skin-tone@2.0.0: + dependencies: + unicode-emoji-modifier-base: 1.0.0 + slash@3.0.0: {} slugify@1.6.6: {} @@ -6364,6 +6917,8 @@ snapshots: stream-buffers@2.2.0: {} + string-argv@0.3.2: {} + string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -6397,6 +6952,11 @@ snapshots: has-flag: 4.0.0 supports-color: 7.2.0 + supports-hyperlinks@3.2.0: + dependencies: + has-flag: 4.0.0 + supports-color: 7.2.0 + supports-preserve-symlinks-flag@1.0.0: {} terminal-link@2.1.1: @@ -6417,12 +6977,22 @@ snapshots: glob: 7.2.3 minimatch: 3.1.4 + thenify-all@1.6.0: + dependencies: + thenify: 3.3.1 + + thenify@3.3.1: + dependencies: + any-promise: 1.3.0 + throat@5.0.0: {} tinybench@2.9.0: {} tinyexec@1.0.2: {} + tinyexec@1.3.1: {} + tinyglobby@0.2.15: dependencies: fdir: 6.5.0(picomatch@4.0.7) @@ -6470,12 +7040,18 @@ snapshots: type-fest@0.7.1: {} + typescript@5.6.1-rc: {} + typescript@6.0.2: {} + typescript@6.0.3: {} + undici-types@7.14.0: {} unicode-canonical-property-names-ecmascript@2.0.1: {} + unicode-emoji-modifier-base@1.0.0: {} + unicode-match-property-ecmascript@2.0.0: dependencies: unicode-canonical-property-names-ecmascript: 2.0.1 @@ -6485,6 +7061,8 @@ snapshots: unicode-property-aliases-ecmascript@2.2.0: {} + universalify@2.0.1: {} + unpipe@1.0.0: {} update-browserslist-db@1.3.3(browserslist@4.28.9): @@ -6602,8 +7180,20 @@ snapshots: yaml@2.8.3: {} + yargs-parser@20.2.9: {} + yargs-parser@21.1.1: {} + yargs@16.2.2: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + yargs@17.7.2: dependencies: cliui: 8.0.1 diff --git a/scripts/consumer-check.sh b/scripts/consumer-check.sh new file mode 100755 index 0000000..537ab7f --- /dev/null +++ b/scripts/consumer-check.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash +# Packs @formbricks/react-native exactly as `npm publish` ships it, installs the tarball into a +# scratch consumer project, and checks that both the ESM and CJS entry points resolve and type-check. +# Run after `pnpm build`. +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +package_dir="$repo_root/packages/react-native" +typescript_version="$(node -p "require('$package_dir/package.json').devDependencies.typescript")" +types_react_version="$(node -p "require('$package_dir/package.json').devDependencies['@types/react']")" + +work_dir="$(mktemp -d)" +trap 'rm -rf "$work_dir"' EXIT + +echo "Packing @formbricks/react-native" +(cd "$package_dir" && npm pack --silent --pack-destination "$work_dir" >/dev/null) +tarball="$(find "$work_dir" -maxdepth 1 -name '*.tgz' -print -quit)" +tar -tzf "$tarball" + +consumer_dir="$work_dir/consumer" +mkdir -p "$consumer_dir" +cd "$consumer_dir" + +cat >package.json <<'JSON' +{ "name": "consumer", "private": true, "type": "module" } +JSON + +cat >tsconfig.json <<'JSON' +{ + "compilerOptions": { + "module": "nodenext", + "moduleResolution": "nodenext", + "target": "ES2022", + "lib": ["ES2022", "DOM"], + "strict": true, + "noEmit": true, + "skipLibCheck": false, + "types": [] + }, + "files": ["esm.ts", "cjs.cts"] +} +JSON + +cat >esm.ts <<'TS' +import Formbricks, { + type FormbricksProps, + type TAppearance, + type TEmbeddedDataInput, + clearEmbeddedData, + logout, + setAppearance, + setAttribute, + setAttributes, + setEmbeddedData, + setLanguage, + setUserId, + track, +} from "@formbricks/react-native"; + +const props: FormbricksProps = { appUrl: "https://app.formbricks.com", workspaceId: "ws" }; +const appearance: TAppearance = "system"; +const data: TEmbeddedDataInput = { plan: "pro" }; +const pending: Promise[] = [ + setUserId("user"), + setAttribute("plan", "pro"), + setAttributes({ seats: 3 }), + setLanguage("en"), + track("qa-action"), + logout(), +]; +setAppearance(appearance); +setEmbeddedData(data); +clearEmbeddedData(); +export { Formbricks, pending, props }; +TS + +cat >cjs.cts <<'TS' +import formbricks = require("@formbricks/react-native"); + +const pending: Promise = formbricks.track("qa-action"); +export = { Formbricks: formbricks.Formbricks, default: formbricks.default, pending }; +TS + +echo "Installing the tarball into a scratch consumer" +# Peer dependencies (react-native, webview, async-storage) are not needed to resolve or type-check +# the public API, so skip them instead of downloading react-native. +npm install --silent --no-audit --no-fund --ignore-scripts --legacy-peer-deps \ + "$tarball" "typescript@$typescript_version" "@types/react@$types_react_version" + +echo "Resolving the ESM and CJS entry points" +node --input-type=module -e "console.log(import.meta.resolve('@formbricks/react-native'))" +node --input-type=commonjs -e "console.log(require.resolve('@formbricks/react-native'))" + +echo "Type-checking the consumer against the packed types" +npx --no-install tsc -p tsconfig.json + +echo "Consumer check passed" From e784b66c559f42c7401b6ea985ef166b19966b3b Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 11:56:51 +0530 Subject: [PATCH 03/40] ci: run every check from ci.yml behind PR Check Summary Replace build, lint, test and sonarqube workflows with one ci.yml (lint, format, typecheck, build, unit-tests, api-check, package-check, sonarqube, dependency-review, workflow-lint). PR Check Summary fails on anything but success, except Sonar/E2E skips on fork PRs and dependency-review on push; that rule lives in a tested script. Every job is hardened, SHA-pinned, has a timeout and shares a PR-cancelling concurrency group, on Node 24. Adds semantic PR titles and weekly CodeQL and OpenSSF Scorecard runs, and waits for the Sonar quality gate. --- .github/workflows/ci.yml | 380 ++++++++++++++++++++++++++++++ .github/workflows/codeql.yml | 49 ++++ .github/workflows/pr-title.yml | 48 ++++ .github/workflows/scorecard.yml | 52 ++++ AGENTS.md | 10 +- scripts/pr-check-summary.mjs | 55 +++++ scripts/pr-check-summary.test.mjs | 146 ++++++++++++ sonar-project.properties | 4 + 8 files changed, 741 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/pr-title.yml create mode 100644 .github/workflows/scorecard.yml create mode 100644 scripts/pr-check-summary.mjs create mode 100644 scripts/pr-check-summary.test.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c26a52a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,380 @@ +name: CI + +on: + pull_request: + merge_group: + push: + branches: + - main + +permissions: {} + +# PR runs cancel superseded runs; runs on main and in the merge queue are never cancelled. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Check exact dependency versions and lint (warnings fail) + run: pnpm lint + + format: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Check formatting + run: pnpm format:check + + typecheck: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Type-check the package and the playground + run: pnpm check-types + + build: + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build the package and the Expo playground + run: pnpm build + + unit-tests: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run package unit tests + run: pnpm test + + - name: Run CI script tests + run: pnpm test:scripts + + api-check: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Regenerate the public API report + run: pnpm api:update + + - name: Fail if the committed API report is out of date + run: | + report=packages/react-native/api + if [ -n "$(git status --porcelain -- "$report")" ]; then + git --no-pager diff -- "$report" + git status --short -- "$report" + echo "::error::The public API changed. Run 'pnpm api:update' and commit $report/react-native.api.md." + exit 1 + fi + + package-check: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build the package + run: pnpm --filter @formbricks/react-native build + + - name: publint, attw, and npm pack installed into a scratch consumer + run: pnpm package-check + + sonarqube: + # Fork PRs have no SONAR_TOKEN; PR Check Summary allows this skip only there. + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + timeout-minutes: 20 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Install pnpm + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run tests with coverage + run: pnpm test:coverage + + - name: SonarQube scan (waits for the quality gate) + uses: SonarSource/sonarqube-scan-action@d209202bc7d53ff1cc128f7f907dac145c9d6ae9 # v8.3.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + dependency-review: + if: github.event_name == 'pull_request' || github.event_name == 'merge_group' + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Review dependency changes + uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0 + with: + # pull_request events carry their own refs; merge_group events need them passed in. + base-ref: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha }} + head-ref: ${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }} + + workflow-lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: actionlint + uses: raven-actions/actionlint@3d39aea434753780c3b3d4a1a31c854b4dbf49d7 # v2.2.0 + with: + version: 1.7.12 + + - name: zizmor + uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1 + with: + version: 1.32.0 + advanced-security: false + + pr-check-summary: + name: PR Check Summary + needs: + - lint + - format + - typecheck + - build + - unit-tests + - api-check + - package-check + - sonarqube + - dependency-review + - workflow-lint + # `always()`, not `!cancelled()`: this is the only required check, and a skipped required job + # counts as passing. scripts/pr-check-summary.mjs decides which skips are allowed. + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout the summary script + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + sparse-checkout: scripts/pr-check-summary.mjs + sparse-checkout-cone-mode: false + + - name: Set up Node.js 24 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + + - name: Fail unless every job passed or was an allowed skip + env: + NEEDS_JSON: ${{ toJSON(needs) }} + EVENT_NAME: ${{ github.event_name }} + IS_FORK: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository }} + run: node scripts/pr-check-summary.mjs diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..de0bbc4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,49 @@ +name: CodeQL + +on: + schedule: + - cron: "17 3 * * 1" # weekly, Monday 03:17 UTC + workflow_dispatch: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: + - actions + - javascript-typescript + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Initialize CodeQL + uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + languages: ${{ matrix.language }} + build-mode: none + + - name: Run CodeQL analysis + uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + category: /language:${{ matrix.language }} diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..c8f04b8 --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,48 @@ +name: PR title + +on: + pull_request: + types: + - opened + - edited + - reopened + - synchronize + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + semantic-pr-title: + name: Semantic PR title + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + pull-requests: read + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + # The GitHub release notes are built from PR titles, so they must follow Conventional Commits. + - name: Check the PR title follows Conventional Commits + uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + types: | + fix + feat + chore + docs + style + refactor + perf + test + build + ci + revert diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..9fa4156 --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,52 @@ +name: OpenSSF Scorecard + +on: + schedule: + - cron: "41 3 * * 1" # weekly, Monday 03:41 UTC + workflow_dispatch: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + actions: read + security-events: write # upload the SARIF to code scanning + id-token: write # publish results to the OpenSSF API + steps: + - name: Harden the runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Run Scorecard + uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0 + with: + results_file: results.sarif + results_format: sarif + publish_results: true + + - name: Upload the results as an artifact + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: scorecard-results + path: results.sarif + retention-days: 5 + + - name: Upload the results to code scanning + uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3 + with: + sarif_file: results.sarif diff --git a/AGENTS.md b/AGENTS.md index 8550b00..a1bc94c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,7 +6,7 @@ This repository is a `pnpm` workspace with two main packages: - `packages/react-native`: the published SDK (`@formbricks/react-native`). Source lives in `src/`, grouped by domain under `src/lib/`, with React components in `src/components/` and shared types in `src/types/`. - `apps/playground`: an Expo app for manual testing and integration checks. App code is in `src/`, with static assets in `assets/`. -GitHub Actions under `.github/workflows/` enforce build, lint, type-check, test, and release steps. +GitHub Actions run every check from `.github/workflows/ci.yml`; its `PR Check Summary` job is the only required check. `release.yml` publishes. ## Build, Test, and Development Commands Run commands from the repository root unless package-scoped work is needed. @@ -14,10 +14,14 @@ Run commands from the repository root unless package-scoped work is needed. - `pnpm install --frozen-lockfile`: install workspace dependencies. - `pnpm dev`: run Turbo watchers across packages. - `pnpm build`: build the SDK and playground. -- `pnpm lint`: enforce exact dependency versions, then run Biome checks. +- `pnpm lint`: enforce exact dependency versions, then run Biome lint (warnings fail). +- `pnpm format` / `pnpm format:check`: format with Biome, or only check formatting. - `pnpm check-types`: run TypeScript checks across the workspace. - `pnpm test`: run unit tests with Vitest. -- `pnpm test:coverage`: generate coverage reports used in release validation. +- `pnpm test:coverage`: generate coverage reports for SonarQube. +- `pnpm test:scripts`: test the CI helper scripts in `scripts/`. +- `pnpm api:update`: rebuild the SDK and regenerate `packages/react-native/api/react-native.api.md`. Commit it whenever the public API changes; CI's `api-check` fails on a stale report. +- `pnpm package-check`: after a build, run publint, attw, and install the `npm pack` tarball into a scratch consumer. - `pnpm --filter playground ios` / `pnpm --filter playground android`: launch the Expo playground on a device target. ## Coding Style & Naming Conventions diff --git a/scripts/pr-check-summary.mjs b/scripts/pr-check-summary.mjs new file mode 100644 index 0000000..a7062dc --- /dev/null +++ b/scripts/pr-check-summary.mjs @@ -0,0 +1,55 @@ +import { appendFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; + +// Decides the `PR Check Summary` verdict from the `needs` context of ci.yml. +// Every job must succeed, except these explicitly allowed skips: +// - sonarqube and e2e-tests on a fork PR (no secrets there), +// - dependency-review on a push to main (it only runs on pull_request and merge_group). +const SKIPPABLE_ON_FORK_PR = new Set(["sonarqube", "e2e-tests"]); +const SKIPPABLE_ON_PUSH = new Set(["dependency-review"]); + +function isAllowedSkip(job, { eventName, isFork }) { + if (isFork && eventName === "pull_request" && SKIPPABLE_ON_FORK_PR.has(job)) { + return true; + } + return eventName === "push" && SKIPPABLE_ON_PUSH.has(job); +} + +export function evaluate({ needs, eventName, isFork }) { + const problems = Object.entries(needs) + .filter( + ([job, { result }]) => + result !== "success" && + !(result === "skipped" && isAllowedSkip(job, { eventName, isFork })), + ) + .map(([job, { result }]) => ({ job, result })); + return { passed: problems.length === 0, problems }; +} + +function main() { + const needs = JSON.parse(process.env.NEEDS_JSON ?? "{}"); + const eventName = process.env.EVENT_NAME ?? ""; + const isFork = process.env.IS_FORK === "true"; + const { passed, problems } = evaluate({ needs, eventName, isFork }); + + const lines = Object.entries(needs).map( + ([job, { result }]) => `- ${job}: ${result}`, + ); + const verdict = passed + ? "All required checks passed." + : `Failing checks: ${problems.map(({ job }) => job).join(", ")}`; + const report = [...lines, "", verdict].join("\n"); + + console.log(report); + if (process.env.GITHUB_STEP_SUMMARY) { + appendFileSync( + process.env.GITHUB_STEP_SUMMARY, + `## PR Check Summary\n\n${report}\n`, + ); + } + process.exitCode = passed ? 0 : 1; +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + main(); +} diff --git a/scripts/pr-check-summary.test.mjs b/scripts/pr-check-summary.test.mjs new file mode 100644 index 0000000..bd49b69 --- /dev/null +++ b/scripts/pr-check-summary.test.mjs @@ -0,0 +1,146 @@ +import assert from "node:assert/strict"; +import { spawnSync } from "node:child_process"; +import { describe, it } from "node:test"; +import { fileURLToPath } from "node:url"; +import { evaluate } from "./pr-check-summary.mjs"; + +const needs = (results) => + Object.fromEntries( + Object.entries(results).map(([job, result]) => [job, { result }]), + ); + +describe("evaluate", () => { + it("passes when every job succeeded", () => { + const verdict = evaluate({ + needs: needs({ lint: "success", build: "success" }), + eventName: "pull_request", + isFork: false, + }); + + assert.deepEqual(verdict, { passed: true, problems: [] }); + }); + + it("fails on a failed, cancelled or skipped job and names each one", () => { + const verdict = evaluate({ + needs: needs({ + lint: "failure", + build: "cancelled", + "unit-tests": "skipped", + format: "success", + }), + eventName: "pull_request", + isFork: false, + }); + + assert.deepEqual(verdict, { + passed: false, + problems: [ + { job: "lint", result: "failure" }, + { job: "build", result: "cancelled" }, + { job: "unit-tests", result: "skipped" }, + ], + }); + }); + + it("allows sonarqube and e2e-tests to skip on a fork PR", () => { + const verdict = evaluate({ + needs: needs({ + lint: "success", + sonarqube: "skipped", + "e2e-tests": "skipped", + }), + eventName: "pull_request", + isFork: true, + }); + + assert.deepEqual(verdict, { passed: true, problems: [] }); + }); + + it("does not let other jobs skip on a fork PR", () => { + const verdict = evaluate({ + needs: needs({ sonarqube: "skipped", "unit-tests": "skipped" }), + eventName: "pull_request", + isFork: true, + }); + + assert.deepEqual(verdict.problems, [ + { job: "unit-tests", result: "skipped" }, + ]); + }); + + it("does not let sonarqube skip on a same-repo PR", () => { + const verdict = evaluate({ + needs: needs({ sonarqube: "skipped" }), + eventName: "pull_request", + isFork: false, + }); + + assert.equal(verdict.passed, false); + }); + + it("still reports a sonarqube failure on a fork PR", () => { + const verdict = evaluate({ + needs: needs({ sonarqube: "failure" }), + eventName: "pull_request", + isFork: true, + }); + + assert.deepEqual(verdict.problems, [ + { job: "sonarqube", result: "failure" }, + ]); + }); + + it("allows dependency-review to skip on a push to main", () => { + const verdict = evaluate({ + needs: needs({ "dependency-review": "skipped", lint: "success" }), + eventName: "push", + isFork: false, + }); + + assert.deepEqual(verdict, { passed: true, problems: [] }); + }); + + it("requires dependency-review in the merge queue", () => { + const verdict = evaluate({ + needs: needs({ "dependency-review": "skipped" }), + eventName: "merge_group", + isFork: false, + }); + + assert.deepEqual(verdict.problems, [ + { job: "dependency-review", result: "skipped" }, + ]); + }); +}); + +describe("pr-check-summary CLI", () => { + const script = fileURLToPath( + new URL("./pr-check-summary.mjs", import.meta.url), + ); + const run = (env) => + spawnSync(process.execPath, [script], { + env: { PATH: process.env.PATH, ...env }, + encoding: "utf8", + }); + + it("exits 1 and names the failing job", () => { + const { status, stdout } = run({ + NEEDS_JSON: JSON.stringify(needs({ lint: "failure", build: "success" })), + EVENT_NAME: "pull_request", + IS_FORK: "false", + }); + + assert.equal(status, 1); + assert.match(stdout, /lint: failure/); + }); + + it("exits 0 when a fork PR skips sonarqube", () => { + const { status } = run({ + NEEDS_JSON: JSON.stringify(needs({ sonarqube: "skipped" })), + EVENT_NAME: "pull_request", + IS_FORK: "true", + }); + + assert.equal(status, 0); + }); +}); diff --git a/sonar-project.properties b/sonar-project.properties index 3a2ea7e..221259e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -19,3 +19,7 @@ sonar.typescript.tsconfigPath=packages/react-native/tsconfig.json,apps/playgroun # Coverage settings sonar.coverage.exclusions=**/node_modules/**,**/dist/**,**/build/**,**/coverage/**,**/.turbo/**,**/apps/playground/**,**/*.config.js,**/*.config.ts,**/vite.config.ts,**/vitest.setup.ts,**/tsconfig.json,**/package.json,**/pnpm-lock.yaml,**/turbo.json,**/pnpm-workspace.yaml,**/*.tsx + +# Fail the CI job when the quality gate fails +sonar.qualitygate.wait=true +sonar.qualitygate.timeout=300 From 3de7c93499e714fa4f9ff70b4b6a3d630d2e3a3e Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 11:58:14 +0530 Subject: [PATCH 04/40] ci: run the release script tests in unit-tests --- AGENTS.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a1bc94c..fc91374 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,7 @@ Run commands from the repository root unless package-scoped work is needed. - `pnpm check-types`: run TypeScript checks across the workspace. - `pnpm test`: run unit tests with Vitest. - `pnpm test:coverage`: generate coverage reports for SonarQube. -- `pnpm test:scripts`: test the CI helper scripts in `scripts/`. +- `pnpm test:scripts`: test the CI and release helper scripts under `scripts/`. - `pnpm api:update`: rebuild the SDK and regenerate `packages/react-native/api/react-native.api.md`. Commit it whenever the public API changes; CI's `api-check` fails on a stale report. - `pnpm package-check`: after a build, run publint, attw, and install the `npm pack` tarball into a scratch consumer. - `pnpm --filter playground ios` / `pnpm --filter playground android`: launch the Expo playground on a device target. diff --git a/package.json b/package.json index 2271ea7..4d1d3c6 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "check-types": "turbo run check-types", "test": "turbo run test --no-cache", "test:coverage": "turbo run test:coverage --no-cache", - "test:scripts": "node --test scripts/*.test.mjs", + "test:scripts": "node --test \"scripts/**/*.test.mjs\"", "api:update": "pnpm --filter @formbricks/react-native build", "package-check": "pnpm --filter @formbricks/react-native package-check && ./scripts/consumer-check.sh" }, From ba4093d52bb7185f2e79fb138fd38b8896c1efc6 Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 15:22:40 +0530 Subject: [PATCH 05/40] fix: validate the npm package name before building the registry URL CodeQL js/incomplete-sanitization: name.replace("/", "%2f") encoded only the first slash. The name is now checked against the npm name grammar (name or @scope/name, URL-safe characters) and rejected otherwise, so the registry path is built from validated parts. --- scripts/release/npm-registry.mjs | 14 +++++++++++- scripts/release/npm-registry.test.mjs | 31 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/scripts/release/npm-registry.mjs b/scripts/release/npm-registry.mjs index e61b5fc..dea2cae 100644 --- a/scripts/release/npm-registry.mjs +++ b/scripts/release/npm-registry.mjs @@ -4,8 +4,20 @@ import { pathToFileURL } from "node:url"; const REGISTRY = "https://registry.npmjs.org"; +// An npm package name is `name` or `@scope/name`, each part lowercase and URL-safe. +const PACKAGE_NAME = /^(?:@([a-z0-9][a-z0-9._~-]*)\/)?([a-z0-9][a-z0-9._~-]*)$/; + +// The registry path for a package: a scoped name keeps its `@` and encodes the +// separating slash as %2f. The name is validated first, so nothing else needs escaping. +function packumentUrl(name) { + const match = PACKAGE_NAME.exec(name); + if (!match) throw new Error(`"${name}" is not a valid npm package name.`); + const [, scope, pkg] = match; + return `${REGISTRY}/${scope ? `@${scope}%2f${pkg}` : pkg}`; +} + async function fetchPackument(name, fetch) { - const url = `${REGISTRY}/${name.replace("/", "%2f")}`; + const url = packumentUrl(name); const response = await fetch(url); if (response.status === 404) return { "dist-tags": {}, versions: {} }; if (!response.ok) { diff --git a/scripts/release/npm-registry.test.mjs b/scripts/release/npm-registry.test.mjs index 36d6255..520fdd7 100644 --- a/scripts/release/npm-registry.test.mjs +++ b/scripts/release/npm-registry.test.mjs @@ -49,6 +49,37 @@ describe("isVersionPublished", () => { ]); }); + it("requests an unscoped package by its bare name", async () => { + const registry = fakeRegistry([{ "dist-tags": {}, versions: {} }]); + + await isVersionPublished({ + name: "left-pad", + version: "1.0.0", + fetch: registry.fetch, + }); + + assert.deepEqual(registry.requests, [ + "https://registry.npmjs.org/left-pad", + ]); + }); + + it("rejects a name that is not a valid npm package name, without a request", async () => { + for (const name of [ + "@formbricks/react-native/extra", + "../../-/user", + "@scope/", + "a b", + ]) { + const registry = fakeRegistry([{ "dist-tags": {}, versions: {} }]); + + await assert.rejects( + isVersionPublished({ name, version: "1.0.0", fetch: registry.fetch }), + /not a valid npm package name/, + ); + assert.deepEqual(registry.requests, []); + } + }); + it("is false when the registry does not have the version yet", async () => { const registry = fakeRegistry([ { "dist-tags": { latest: "3.3.1" }, versions: { "3.3.1": {} } }, From 396c39f8b8930872e017d916632ff7ce80399c41 Mon Sep 17 00:00:00 2001 From: Dhruwang Date: Sun, 15 Nov 2026 17:22:00 +0530 Subject: [PATCH 06/40] test: Detox golden journey on the Expo playground - playground: fields and buttons for setup (app URL, workspace), setUserId, setAttribute and track, with testIDs and a status line; the SDK is set up on demand so the URL can come at run time - plugins/with-detox.js: config plugin that makes the prebuilt Android project Detox-ready (Maven repo, test runner, DetoxTest, cleartext) - e2e/golden-journey.e2e.js: Detox journey with web matchers on the survey - align the playground with Expo SDK 55 (RN 0.83.10); Expo 55 does not build natively with RN 0.84 - pin @xmldom/xmldom to 0.8.15: every dependent wants ^0.8 and 0.9 broke expo prebuild's plist parsing; 0.8.15 carries the same advisory fixes - e2e/server (from js) and e2e/tunnel (from ios) copied verbatim --- apps/playground/.detoxrc.js | 51 + apps/playground/.gitignore | 4 + apps/playground/app.json | 11 +- apps/playground/e2e/golden-journey.e2e.js | 183 + apps/playground/e2e/jest.config.js | 14 + apps/playground/e2e/support/poll.js | 29 + apps/playground/e2e/support/poll.test.js | 58 + apps/playground/package.json | 17 +- apps/playground/plugins/with-detox.js | 166 + apps/playground/plugins/with-detox.test.js | 82 + apps/playground/src/app.tsx | 246 +- e2e/.gitignore | 4 + e2e/react-native/run-journey.sh | 58 + e2e/server/assert-response.sh | 31 + e2e/server/bootstrap.sql | 37 + e2e/server/cleanup.sh | 31 + e2e/server/docker-compose.yml | 89 + e2e/server/down.sh | 15 + e2e/server/lib.sh | 202 ++ e2e/server/seed.sh | 39 + e2e/server/test/lib.test.sh | 191 ++ e2e/server/up.sh | 39 + e2e/tunnel/await-artifact.sh | 28 + e2e/tunnel/lib.sh | 54 + e2e/tunnel/server-url.sh | 16 + e2e/tunnel/start.sh | 49 + e2e/tunnel/stop.sh | 14 + e2e/tunnel/test/lib.test.sh | 91 + package.json | 2 +- pnpm-lock.yaml | 3564 +++++++++++++++++--- 30 files changed, 4932 insertions(+), 483 deletions(-) create mode 100644 apps/playground/.detoxrc.js create mode 100644 apps/playground/e2e/golden-journey.e2e.js create mode 100644 apps/playground/e2e/jest.config.js create mode 100644 apps/playground/e2e/support/poll.js create mode 100644 apps/playground/e2e/support/poll.test.js create mode 100644 apps/playground/plugins/with-detox.js create mode 100644 apps/playground/plugins/with-detox.test.js create mode 100644 e2e/.gitignore create mode 100755 e2e/react-native/run-journey.sh create mode 100755 e2e/server/assert-response.sh create mode 100644 e2e/server/bootstrap.sql create mode 100755 e2e/server/cleanup.sh create mode 100644 e2e/server/docker-compose.yml create mode 100755 e2e/server/down.sh create mode 100755 e2e/server/lib.sh create mode 100755 e2e/server/seed.sh create mode 100755 e2e/server/test/lib.test.sh create mode 100755 e2e/server/up.sh create mode 100755 e2e/tunnel/await-artifact.sh create mode 100644 e2e/tunnel/lib.sh create mode 100755 e2e/tunnel/server-url.sh create mode 100755 e2e/tunnel/start.sh create mode 100755 e2e/tunnel/stop.sh create mode 100755 e2e/tunnel/test/lib.test.sh diff --git a/apps/playground/.detoxrc.js b/apps/playground/.detoxrc.js new file mode 100644 index 0000000..bf6187e --- /dev/null +++ b/apps/playground/.detoxrc.js @@ -0,0 +1,51 @@ +// Detox configuration for the golden journey (e2e/golden-journey.e2e.js). The native projects +// come from `expo prebuild` (plugins/with-detox.js); release builds bundle the JS, so no Metro. +// CI drives it through e2e/react-native/run-journey.sh at the repository root. + +/** @type {Detox.DetoxConfig} */ +module.exports = { + testRunner: { + args: { $0: "jest", config: "e2e/jest.config.js" }, + jest: { setupTimeout: 300_000 }, + }, + artifacts: { + rootDir: process.env.DETOX_ARTIFACTS_DIR ?? "e2e/artifacts", + plugins: { + log: "failing", + screenshot: "failing", + uiHierarchy: "enabled", + }, + }, + apps: { + "ios.release": { + type: "ios.app", + binaryPath: + "ios/build/Build/Products/Release-iphonesimulator/FormbricksPlayground.app", + build: + "xcodebuild -workspace ios/FormbricksPlayground.xcworkspace -scheme FormbricksPlayground -configuration Release -destination 'generic/platform=iOS Simulator' -derivedDataPath ios/build ARCHS=arm64 COMPILER_INDEX_STORE_ENABLE=NO", + }, + "android.release": { + type: "android.apk", + binaryPath: "android/app/build/outputs/apk/release/app-release.apk", + testBinaryPath: + "android/app/build/outputs/apk/androidTest/release/app-release-androidTest.apk", + // x86_64 only: the CI emulator's ABI, and a quarter of the native build time. + build: `cd android && ./gradlew --console=plain assembleRelease assembleAndroidTest -DtestBuildType=release -PreactNativeArchitectures=${process.env.DETOX_ANDROID_ABI ?? "x86_64"}`, + }, + }, + devices: { + simulator: { + type: "ios.simulator", + device: { type: process.env.DETOX_IOS_DEVICE ?? "iPhone 17" }, + }, + // The emulator the CI step already booted (reactivecircus/android-emulator-runner). + emulator: { + type: "android.attached", + device: { adbName: process.env.DETOX_ADB_NAME ?? "emulator-.*" }, + }, + }, + configurations: { + "ios.sim.release": { device: "simulator", app: "ios.release" }, + "android.emu.release": { device: "emulator", app: "android.release" }, + }, +}; diff --git a/apps/playground/.gitignore b/apps/playground/.gitignore index 954fc66..bcadf1c 100644 --- a/apps/playground/.gitignore +++ b/apps/playground/.gitignore @@ -35,3 +35,7 @@ yarn-error.* # typescript *.tsbuildinfo + +# Generated by `expo prebuild` (Detox E2E builds) +/android +/ios diff --git a/apps/playground/app.json b/apps/playground/app.json index cee233a..fc1116f 100644 --- a/apps/playground/app.json +++ b/apps/playground/app.json @@ -4,15 +4,17 @@ "adaptiveIcon": { "backgroundColor": "#ffffff", "foregroundImage": "./assets/adaptive-icon.png" - } + }, + "package": "com.formbricks.playground" }, "assetBundlePatterns": ["**/*"], "icon": "./assets/icon.png", "ios": { - "supportsTablet": true + "supportsTablet": true, + "bundleIdentifier": "com.formbricks.playground" }, "jsEngine": "hermes", - "name": "react-native-demo", + "name": "FormbricksPlayground", "newArchEnabled": true, "orientation": "portrait", "slug": "react-native-demo", @@ -25,6 +27,7 @@ "version": "1.0.0", "web": { "favicon": "./assets/favicon.png" - } + }, + "plugins": ["./plugins/with-detox"] } } diff --git a/apps/playground/e2e/golden-journey.e2e.js b/apps/playground/e2e/golden-journey.e2e.js new file mode 100644 index 0000000..8c8810f --- /dev/null +++ b/apps/playground/e2e/golden-journey.e2e.js @@ -0,0 +1,183 @@ +/** + * The golden journey shared by every Formbricks SDK, against the E2E server harness (e2e/server at + * the repository root). + * + * e2e/server/seed.sh created the survey: NPS (qa_nps) then open text (qa_feedback), triggered by + * `qa-action` and targeted to plan = pro. e2e/server/assert-response.sh then checks the stored + * response through the V1 API, so the journey must use the same E2E_USER_ID and E2E_FEEDBACK. + * + * Env: E2E_APP_URL (Android emulator: http://10.0.2.2:3000; iOS: the tunnel URL), E2E_USER_ID, + * E2E_FEEDBACK, optional E2E_WORKSPACE_ID. + */ +const { by, device, element, expect, waitFor, web } = require("detox"); +const { poll } = require("./support/poll"); + +const required = (name) => { + const value = process.env[name]; + if (!value) throw new Error(`Set ${name} for the golden journey`); + return value; +}; + +const appUrl = required("E2E_APP_URL"); +const userId = required("E2E_USER_ID"); +const feedback = required("E2E_FEEDBACK"); +const workspaceId = + process.env.E2E_WORKSPACE_ID ?? "clsdkqaws00000000000000001"; + +// Selectors: the survey renderer's DOM, the same in every SDK's WebView. +const NPS_9 = "//input[@name='qa_nps' and @value='9']/parent::label"; +const FEEDBACK_INPUT = "#qa_feedback-input"; +const THANKS_HEADLINE = + "//*[@data-fb-part='headline'][contains(normalize-space(.), 'Thanks!')]"; +const CLOSE_BUTTON = "[data-fb-part='button-close']"; +const primaryButton = (card) => + `#questionCard-${card} [data-fb-part='button-primary']`; + +const SURVEY_OPEN_TIMEOUT_MS = 150_000; +const TRACK_RETRY_INTERVAL_MS = 10_000; +const STEP_TIMEOUT_MS = 30_000; +const RESPONSE_TIMEOUT_MS = 60_000; + +// The SDK's WebView is the only one in the app, so `web` needs no matcher. +const webElement = (matcher) => web.element(matcher); + +const expectStatus = (text) => + waitFor(element(by.id("status"))) + .toHaveText(text) + .withTimeout(STEP_TIMEOUT_MS); + +const fill = async (testID, text) => { + await waitFor(element(by.id(testID))) + .toBeVisible() + .whileElement(by.id("playground-scroll")) + .scroll(150, "down"); + await element(by.id(testID)).replaceText(text); +}; + +const tap = async (testID) => { + await waitFor(element(by.id(testID))) + .toBeVisible() + .whileElement(by.id("playground-scroll")) + .scroll(150, "down"); + await element(by.id(testID)).tap(); +}; + +/** Whether any WebView is on screen: the survey's is the only one. */ +const webViewExists = async () => { + try { + await webElement(by.web.tag("body")).runScript("() => true"); + return true; + } catch { + return false; + } +}; + +const surveyIsOpen = () => expect(webElement(by.web.xpath(NPS_9))).toExist(); + +/** + * One pass of steps 2 and 3, then a short wait for the survey. A pass can land before the SDK has + * finished setting up (the SDK then drops the calls), so a pass that opens nothing is repeated, as + * a person would. Repeating is safe: the same userId and attribute are no-ops the second time. + */ +const identifyAndTrackUntilTheSurveyOpens = () => + poll( + async () => { + await tap("set-user-id-button"); + await expectStatus(`setUserId(${userId}) done`); + await tap("set-attribute-button"); + await expectStatus("setAttribute(plan=pro) done"); + await tap("track-action-button"); + await expectStatus("track(qa-action) done"); + await poll(surveyIsOpen, { + what: "the survey", + timeoutMs: TRACK_RETRY_INTERVAL_MS, + }); + }, + { + what: "the survey to open after track(qa-action)", + timeoutMs: SURVEY_OPEN_TIMEOUT_MS, + intervalMs: 0, + }, + ); + +describe("golden journey", () => { + beforeAll(async () => { + await device.launchApp({ newInstance: true, delete: true }); + // The SDK keeps timers and the WebView busy, so Detox would wait for "idle" forever. Every + // step waits explicitly instead (waitFor and poll). + await device.disableSynchronization(); + }); + + it("identifies, targets, triggers, answers and closes the survey", async () => { + // 1. Set up the SDK against the harness server. + await fill("app-url-input", appUrl); + await fill("workspace-id-input", workspaceId); + await tap("setup-button"); + await expectStatus(`Set up with ${appUrl} ${workspaceId}`); + + // 2. setUserId and setAttribute(plan = pro); 3. track('qa-action'); 4. the survey appears. + await fill("user-id-input", userId); + await fill("attribute-key-input", "plan"); + await fill("attribute-value-input", "pro"); + await fill("action-input", "qa-action"); + await identifyAndTrackUntilTheSurveyOpens(); + + // 5. Answer NPS 9 and the open text, finish, then close the ending card. + await poll(() => webElement(by.web.xpath(NPS_9)).tap(), { + what: "NPS option 9", + timeoutMs: STEP_TIMEOUT_MS, + }); + await poll( + async () => { + const selected = await webElement( + by.web.cssSelector("input[name='qa_nps'][value='9']"), + ).runScript( + "(input) => input.parentElement.dataset.checked === 'true'", + ); + if (!selected) throw new Error("NPS 9 is not selected"); + }, + { what: "NPS 9 to be selected", timeoutMs: STEP_TIMEOUT_MS }, + ); + await poll(() => webElement(by.web.cssSelector(primaryButton(0))).tap(), { + what: "Next", + timeoutMs: STEP_TIMEOUT_MS, + }); + + await poll( + async () => { + const input = webElement(by.web.cssSelector(FEEDBACK_INPUT)); + await input.replaceText(feedback); + const typed = await input.runScript("(input) => input.value"); + if (typed !== feedback) throw new Error(`the input holds "${typed}"`); + }, + { what: "the open-text answer", timeoutMs: STEP_TIMEOUT_MS }, + ); + await poll(() => webElement(by.web.cssSelector(primaryButton(1))).tap(), { + what: "Finish", + timeoutMs: STEP_TIMEOUT_MS, + }); + + // The ending card renders its headline only once the server accepted the response. + await poll( + () => expect(webElement(by.web.xpath(THANKS_HEADLINE))).toExist(), + { what: "the Thanks! card", timeoutMs: RESPONSE_TIMEOUT_MS }, + ); + + // Closing removes the WebView the tap runs in, so the tap itself may report an error even + // though it worked; only the outcome counts. + await poll( + async () => { + await webElement(by.web.cssSelector(CLOSE_BUTTON)) + .tap() + .catch(() => {}); + await poll( + async () => { + if (await webViewExists()) throw new Error("the survey is open"); + }, + { what: "the survey to close", timeoutMs: 3_000 }, + ); + }, + { what: "the survey to close", timeoutMs: STEP_TIMEOUT_MS }, + ); + }); +}); diff --git a/apps/playground/e2e/jest.config.js b/apps/playground/e2e/jest.config.js new file mode 100644 index 0000000..645dd23 --- /dev/null +++ b/apps/playground/e2e/jest.config.js @@ -0,0 +1,14 @@ +// Jest runs only the Detox journey; plain CommonJS, so no transform. +/** @type {import('jest').Config} */ +module.exports = { + rootDir: "..", + testMatch: ["/e2e/**/*.e2e.js"], + transform: {}, + testTimeout: 600_000, + maxWorkers: 1, + globalSetup: "detox/runners/jest/globalSetup", + globalTeardown: "detox/runners/jest/globalTeardown", + reporters: ["detox/runners/jest/reporter"], + testEnvironment: "detox/runners/jest/testEnvironment", + verbose: true, +}; diff --git a/apps/playground/e2e/support/poll.js b/apps/playground/e2e/support/poll.js new file mode 100644 index 0000000..d3fbaaf --- /dev/null +++ b/apps/playground/e2e/support/poll.js @@ -0,0 +1,29 @@ +const realSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); + +/** + * Calls `attempt` until it stops throwing and returns its result. The survey renders, animates + * and talks to the server asynchronously, and Detox's own waiting is off (see the journey), so + * every check in the journey goes through here. + */ +const poll = async ( + attempt, + { what, timeoutMs, intervalMs = 500, now = Date.now, sleep = realSleep }, +) => { + const start = now(); + for (;;) { + try { + return await attempt(); + } catch (error) { + if (now() - start >= timeoutMs) { + const reason = error instanceof Error ? error.message : String(error); + throw new Error( + `Timed out after ${timeoutMs / 1000}s waiting for ${what}: ${reason}`, + { cause: error }, + ); + } + await sleep(intervalMs); + } + } +}; + +module.exports = { poll }; diff --git a/apps/playground/e2e/support/poll.test.js b/apps/playground/e2e/support/poll.test.js new file mode 100644 index 0000000..d0b97b4 --- /dev/null +++ b/apps/playground/e2e/support/poll.test.js @@ -0,0 +1,58 @@ +const assert = require("node:assert/strict"); +const { describe, it } = require("node:test"); +const { poll } = require("./poll"); + +/** A clock that only moves when the code under test sleeps. */ +const fakeClock = () => { + let time = 0; + const sleeps = []; + return { + now: () => time, + sleep: async (ms) => { + sleeps.push(ms); + time += ms; + }, + sleeps, + }; +}; + +describe("poll", () => { + it("returns the first result that does not throw", async () => { + const clock = fakeClock(); + let calls = 0; + const result = await poll( + async () => { + calls += 1; + if (calls < 3) throw new Error(`not yet ${calls}`); + return "survey open"; + }, + { what: "the survey", timeoutMs: 10_000, intervalMs: 500, ...clock }, + ); + assert.equal(result, "survey open"); + assert.equal(calls, 3); + assert.deepEqual(clock.sleeps, [500, 500]); + }); + + it("gives up after the timeout, naming what it waited for and the last failure", async () => { + const clock = fakeClock(); + let calls = 0; + await assert.rejects( + poll( + async () => { + calls += 1; + throw new Error(`no web view (${calls})`); + }, + { what: "the survey", timeoutMs: 2_000, intervalMs: 500, ...clock }, + ), + (error) => { + assert.equal( + error.message, + "Timed out after 2s waiting for the survey: no web view (5)", + ); + assert.equal(error.cause.message, "no web view (5)"); + return true; + }, + ); + assert.equal(calls, 5); + }); +}); diff --git a/apps/playground/package.json b/apps/playground/package.json index eef161c..4e3a1af 100644 --- a/apps/playground/package.json +++ b/apps/playground/package.json @@ -8,20 +8,23 @@ "ios": "expo start --ios", "clean": "rimraf .turbo node_modules .expo", "build": "expo export --no-bytecode", - "check-types": "tsc --noEmit" + "check-types": "tsc --noEmit", + "test": "node --test \"plugins/*.test.js\" \"e2e/support/*.test.js\"" }, "dependencies": { "@formbricks/react-native": "workspace:*", - "@react-native-async-storage/async-storage": "3.0.2", - "expo": "55.0.9", - "expo-status-bar": "55.0.4", - "react": "19.2.4", - "react-native": "0.84.1", - "react-native-webview": "13.16.1" + "@react-native-async-storage/async-storage": "2.2.0", + "expo": "55.0.32", + "expo-status-bar": "55.0.6", + "react": "19.2.0", + "react-native": "0.83.10", + "react-native-webview": "13.16.0" }, "devDependencies": { "@babel/core": "7.29.6", "@types/react": "19.2.14", + "detox": "20.51.4", + "jest": "30.5.2", "typescript": "6.0.2" }, "private": true diff --git a/apps/playground/plugins/with-detox.js b/apps/playground/plugins/with-detox.js new file mode 100644 index 0000000..478a4d9 --- /dev/null +++ b/apps/playground/plugins/with-detox.js @@ -0,0 +1,166 @@ +// Expo config plugin: makes the Android project that `expo prebuild` generates drivable by Detox +// (https://wix.github.io/Detox/docs/introduction/project-setup). iOS needs nothing: Detox injects +// itself into the simulator app at launch. +const fs = require("node:fs"); +const path = require("node:path"); +const { + AndroidConfig, + withAndroidManifest, + withAppBuildGradle, + withDangerousMod, + withProjectBuildGradle, +} = require("expo/config-plugins"); + +const MARKER = "// @generated with-detox"; + +const appendOnce = (source, block) => + source.includes(MARKER) ? source : `${source}\n${MARKER}\n${block}\n`; + +/** android/build.gradle: Detox ships its AAR as a Maven repo inside the npm package. */ +const addDetoxMavenRepo = (projectGradle) => + appendOnce( + projectGradle, + [ + `def detoxMavenPath = new File(["node", "--print", "require.resolve('detox/package.json')"].execute(null, rootDir).text.trim(), "../Detox-android")`, + "allprojects { repositories { maven { url(detoxMavenPath) } } }", + ].join("\n"), + ); + +const insertAfterOnce = (source, anchor, lines, file) => { + if (source.includes(lines[0].trim())) return source; + const index = source.indexOf(anchor); + if (index === -1) { + throw new Error(`with-detox: no "${anchor}" in ${file}`); + } + const end = index + anchor.length; + return `${source.slice(0, end)}\n${lines.join("\n")}${source.slice(end)}`; +}; + +/** + * android/app/build.gradle: Detox runs through an instrumentation APK. `-DtestBuildType=release` + * builds that APK against the release app, which bundles the JS (no Metro on CI). + */ +const addDetoxTestRunner = (appGradle) => { + const file = "android/app/build.gradle"; + const withRunner = insertAfterOnce( + appGradle, + "defaultConfig {", + [ + " testBuildType System.getProperty('testBuildType', 'debug')", + " testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'", + ], + file, + ); + return insertAfterOnce( + withRunner, + "dependencies {", + [" androidTestImplementation('com.wix:detox:+')"], + file, + ); +}; + +/** The instrumentation test that hands control to the Detox test runner on the host. */ +const detoxTestClass = (androidPackage) => `package ${androidPackage}; + +import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.filters.LargeTest; +import androidx.test.rule.ActivityTestRule; + +import com.wix.detox.Detox; +import com.wix.detox.config.DetoxConfig; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(AndroidJUnit4.class) +@LargeTest +public class DetoxTest { + @Rule + public ActivityTestRule mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false); + + @Test + public void runDetoxTests() { + DetoxConfig detoxConfig = new DetoxConfig(); + detoxConfig.idlePolicyConfig.masterTimeoutSec = 90; + detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60; + detoxConfig.rnContextLoadTimeoutSec = 180; + Detox.runTests(mActivityRule, detoxConfig); + } +} +`; + +/** + * Cleartext for every host: Detox talks to its host server over ws://localhost, and the playground + * is pointed at plain-http dev servers (the E2E emulator uses http://10.0.2.2:3000). It is a demo + * app, never shipped. + */ +const NETWORK_SECURITY_CONFIG = ` + + + +`; + +const writeFile = (file, contents) => { + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, contents); +}; + +const requireGroovy = (modResults, file) => { + if (modResults.language !== "groovy") { + throw new Error(`with-detox: ${file} is not Groovy`); + } +}; + +const withDetox = (config) => { + const androidPackage = config.android?.package; + if (!androidPackage) { + throw new Error("with-detox: set expo.android.package in app.json"); + } + + config = withProjectBuildGradle(config, (mod) => { + requireGroovy(mod.modResults, "android/build.gradle"); + mod.modResults.contents = addDetoxMavenRepo(mod.modResults.contents); + return mod; + }); + + config = withAppBuildGradle(config, (mod) => { + requireGroovy(mod.modResults, "android/app/build.gradle"); + mod.modResults.contents = addDetoxTestRunner(mod.modResults.contents); + return mod; + }); + + config = withAndroidManifest(config, (mod) => { + const application = AndroidConfig.Manifest.getMainApplicationOrThrow( + mod.modResults, + ); + application.$["android:networkSecurityConfig"] = + "@xml/network_security_config"; + return mod; + }); + + return withDangerousMod(config, [ + "android", + (mod) => { + const appDir = path.join(mod.modRequest.platformProjectRoot, "app/src"); + writeFile( + path.join(appDir, "main/res/xml/network_security_config.xml"), + NETWORK_SECURITY_CONFIG, + ); + writeFile( + path.join( + appDir, + "androidTest/java", + ...androidPackage.split("."), + "DetoxTest.java", + ), + detoxTestClass(androidPackage), + ); + return mod; + }, + ]); +}; + +module.exports = withDetox; +module.exports.addDetoxMavenRepo = addDetoxMavenRepo; +module.exports.addDetoxTestRunner = addDetoxTestRunner; diff --git a/apps/playground/plugins/with-detox.test.js b/apps/playground/plugins/with-detox.test.js new file mode 100644 index 0000000..a5fc7b6 --- /dev/null +++ b/apps/playground/plugins/with-detox.test.js @@ -0,0 +1,82 @@ +const assert = require("node:assert/strict"); +const { describe, it } = require("node:test"); +const { addDetoxMavenRepo, addDetoxTestRunner } = require("./with-detox"); + +// Trimmed from the android/build.gradle that `expo prebuild` generates (SDK 55). +const projectGradle = `allprojects { + repositories { + google() + mavenCentral() + } +} + +apply plugin: "expo-root-project" +`; + +const count = (text, needle) => text.split(needle).length - 1; + +describe("addDetoxMavenRepo", () => { + it("adds the Maven repo bundled in the detox npm package to every project", () => { + const result = addDetoxMavenRepo(projectGradle); + assert.ok(result.startsWith(projectGradle)); + assert.ok( + result.includes( + `def detoxMavenPath = new File(["node", "--print", "require.resolve('detox/package.json')"].execute(null, rootDir).text.trim(), "../Detox-android")`, + ), + ); + assert.ok( + result.includes( + "allprojects { repositories { maven { url(detoxMavenPath) } } }", + ), + ); + }); + + it("adds it once when prebuild runs again", () => { + const once = addDetoxMavenRepo(projectGradle); + assert.equal(addDetoxMavenRepo(once), once); + assert.equal(count(once, "detoxMavenPath)"), 1); + }); +}); + +// Trimmed from the android/app/build.gradle that `expo prebuild` generates (SDK 55). +const appGradle = `android { + namespace 'com.formbricks.playground' + defaultConfig { + applicationId 'com.formbricks.playground' + versionCode 1 + } +} + +dependencies { + implementation("com.facebook.react:react-android") +} +`; + +describe("addDetoxTestRunner", () => { + it("builds the instrumentation APK against the build type Detox asks for", () => { + const result = addDetoxTestRunner(appGradle); + assert.match( + result, + /defaultConfig \{\n {8}testBuildType System\.getProperty\('testBuildType', 'debug'\)\n {8}testInstrumentationRunner 'androidx\.test\.runner\.AndroidJUnitRunner'\n {8}applicationId/, + ); + }); + + it("adds Detox to the instrumentation test dependencies", () => { + assert.match( + addDetoxTestRunner(appGradle), + /dependencies \{\n {4}androidTestImplementation\('com\.wix:detox:\+'\)\n {4}implementation/, + ); + }); + + it("changes nothing when prebuild runs again", () => { + const once = addDetoxTestRunner(appGradle); + assert.equal(addDetoxTestRunner(once), once); + }); + + it("fails loudly when the template no longer has the blocks it edits", () => { + assert.throws( + () => addDetoxTestRunner("android {\n}\n"), + /with-detox: no "defaultConfig \{" in android\/app\/build\.gradle/, + ); + }); +}); diff --git a/apps/playground/src/app.tsx b/apps/playground/src/app.tsx index 204ad66..6a9d626 100644 --- a/apps/playground/src/app.tsx +++ b/apps/playground/src/app.tsx @@ -8,28 +8,53 @@ import Formbricks, { track, } from "@formbricks/react-native"; import { StatusBar } from "expo-status-bar"; -import type { JSX } from "react"; +import { type JSX, useState } from "react"; import { Appearance, Button, LogBox, + ScrollView, StyleSheet, Text, + TextInput, useColorScheme, View, } from "react-native"; LogBox.ignoreAllLogs(); +type SdkConfig = { appUrl: string; workspaceId: string }; + +// The testIDs are what the Detox golden journey (e2e/golden-journey.e2e.js) drives. export default function App(): JSX.Element { const appTheme = useColorScheme(); - if (!process.env.EXPO_PUBLIC_FORMBRICKS_WORKSPACE_ID) { - throw new Error("EXPO_PUBLIC_FORMBRICKS_WORKSPACE_ID is required"); - } + const textColor = appTheme === "dark" ? "#fff" : "#000"; + + // Prefilled from apps/playground/.env; the SDK is set up only when "Set up" is pressed, so the + // E2E journey can point the app at a server whose URL is known only at run time. + const [appUrl, setAppUrl] = useState(process.env.EXPO_PUBLIC_APP_URL ?? ""); + const [workspaceId, setWorkspaceId] = useState( + process.env.EXPO_PUBLIC_FORMBRICKS_WORKSPACE_ID ?? "", + ); + const [sdkConfig, setSdkConfig] = useState(null); + const [userId, setUserIdInput] = useState(""); + const [attributeKey, setAttributeKey] = useState("plan"); + const [attributeValue, setAttributeValue] = useState("pro"); + const [action, setAction] = useState("qa-action"); + const [status, setStatus] = useState("Not set up"); - if (!process.env.EXPO_PUBLIC_APP_URL) { - throw new Error("EXPO_PUBLIC_APP_URL is required"); - } + // The status line tells a person (and the E2E journey) that a call has returned. + const run = (label: string, call: () => Promise): void => { + call() + .then(() => setStatus(`${label} done`)) + .catch((error: unknown) => { + // eslint-disable-next-line no-console -- logging is allowed in demo apps + console.error(`Error in ${label}:`, error); + setStatus(`${label} failed`); + }); + }; + + const inputStyle = [styles.input, { color: textColor }]; return ( - - Formbricks React Native SDK Demo - - - + + Formbricks React Native SDK Demo + + + + {status} + + + +