Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/javascript-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
35 changes: 35 additions & 0 deletions Source/scripts/verify-packed-css.mjs
Original file line number Diff line number Diff line change
@@ -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 });
}
Loading