diff --git a/.github/workflows/javascript-build.yml b/.github/workflows/javascript-build.yml index 227f80c9..88753f32 100644 --- a/.github/workflows/javascript-build.yml +++ b/.github/workflows/javascript-build.yml @@ -108,13 +108,7 @@ jobs: export NODE_OPTIONS="--max-old-space-size=4096" yarn workspace @cratis/components run ci - # Every intentionally public declaration/member reachable from a JS `exports` - # subpath must carry a TSDoc comment (Cratis/Components#173). Runs against - # source, so it needs no build step; its own self-tests run first and fail - # the job if the reachability/doc-presence walk itself regresses. - - name: Verify public API TSDoc coverage - working-directory: Source - run: node scripts/verify-api-docs.mjs + # Source's ci script also checks public API TSDoc and the packed CSS budgets. # Matrix over the renderer-adapter workspaces that today run one after another inside # `run-task-on-workspaces.js ci`: Conformance, MUI, PrimeReact 11, PrimeReact 10. In that diff --git a/README.md b/README.md index 461f77cc..4952b10e 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,13 @@ This is a framework-library repository. [Component source](https://github.com/Cr keeps public types, stories, and specifications near each component; export and package verification lives under `Source/scripts/`. +Before pushing Source changes, run `cd Source && yarn ci` after `yarn install` at the +repository root. It includes public API TSDoc coverage and packs the built package to check +aggregate and per-area CSS budgets (`yarn verify-packed-css` runs that check alone after a +build). CI additionally checks packed exports, public types under TypeScript 6 and 7, +production tree shaking, and external consumer/package-manager matrices; `yarn ci` does not +replace those jobs. + For root and package README changes, verify the exact files explicitly: ```bash diff --git a/Source/package.json b/Source/package.json index da93133b..5e25889e 100644 --- a/Source/package.json +++ b/Source/package.json @@ -259,6 +259,7 @@ "copy-css": "./scripts/copy-css.sh", "verify-exports": "node ./scripts/verify-exports.mjs", "verify-package-archive": "node ./scripts/verify-package-archive.mjs", + "verify-packed-css": "node ./scripts/verify-packed-css.mjs", "verify-packed-production": "node ./scripts/verify-packed-production.mjs", "verify-api-docs": "node ./scripts/verify-api-docs.mjs", "verify-public-types": "node ./scripts/verify-public-types.mjs", @@ -276,7 +277,7 @@ "lint": "yarn g:lint", "lint:ci": "yarn g:lint:ci", "test": "yarn g:test", - "ci": "yarn generate-parts && yarn verify-parts-manifest && yarn g:ci && yarn typecheck-stories && yarn g:build && yarn verify-renderer-contracts && yarn verify-package-graph-report", + "ci": "yarn generate-parts && yarn verify-parts-manifest && yarn verify-api-docs && yarn g:ci && yarn typecheck-stories && yarn g:build && yarn verify-renderer-contracts && yarn verify-package-graph-report && yarn verify-packed-css", "up": "yarn g:up", "dev": "yarn workspace @cratis/components.storybook dev", "build-storybook": "yarn workspace @cratis/components.storybook build" diff --git a/Source/scripts/verify-packed-css.mjs b/Source/scripts/verify-packed-css.mjs new file mode 100644 index 00000000..9334c0ca --- /dev/null +++ b/Source/scripts/verify-packed-css.mjs @@ -0,0 +1,35 @@ +// Copyright (c) Cratis. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// Run the same archive check as CI against the built publish artifact, without leaving a tarball. +import { spawnSync } from 'node:child_process'; +import { mkdtempSync, rmSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); +const temporary = mkdtempSync(path.join(tmpdir(), 'cratis-components-packed-css-')); +const archive = path.join(temporary, 'components.tgz'); + +try { + const packed = spawnSync('yarn', ['pack', '--out', archive], { + cwd: packageDir, + encoding: 'utf8', + timeout: 180_000, + }); + if (packed.error) throw packed.error; + if (packed.status !== 0) { + throw new Error(`\`yarn pack\` failed:\n${packed.stderr || packed.stdout}`); + } + + const verified = spawnSync('yarn', ['verify-package-archive', archive], { + cwd: packageDir, + stdio: 'inherit', + timeout: 180_000, + }); + if (verified.error) throw verified.error; + if (verified.status !== 0) process.exitCode = verified.status ?? 1; +} finally { + rmSync(temporary, { recursive: true, force: true }); +}