-
Notifications
You must be signed in to change notification settings - Fork 0
M1 PR-2: dspack surface → A2UI emitter + library exports #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| name: test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| - run: npm ci | ||
| - run: npm install --prefix demo | ||
| - name: Unit + gate tests (A1–A3, surface emitter, ingestion) | ||
| run: npm test | ||
| - name: Catalog emission (both A2UI versions) + surface emission | ||
| run: | | ||
| npm run transform -- --in input/shadcn-ui.dspack.json --a2ui-version 0.9.1 --out out --emit-surface surface/delete-account.dsurface.json | ||
| npm run transform -- --in input/shadcn-ui.dspack.json --a2ui-version 1.0 --out out | ||
| - name: Pack-and-install boundary test | ||
| run: npm run test:pack | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| "messages": [ | ||
| { | ||
| "version": "v0.9", | ||
| "createSurface": { | ||
| "surfaceId": "destructive_action", | ||
| "catalogId": "https://rdombrowski.dev/catalogs/shadcn-ui/v0_9_1/catalog.json", | ||
| "theme": { | ||
| "agentDisplayName": "shadcn/ui via dspack", | ||
| "primaryColor": "#0f172a" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "version": "v0.9", | ||
| "updateComponents": { | ||
| "surfaceId": "destructive_action", | ||
| "components": [ | ||
| { | ||
| "id": "card", | ||
| "component": "Card", | ||
| "child": "alertdialog" | ||
| }, | ||
| { | ||
| "id": "alertdialog", | ||
| "component": "AlertDialog", | ||
| "triggerLabel": "Delete account", | ||
| "title": "Delete your account?", | ||
| "description": "This will permanently delete your account and all associated data. This action cannot be undone.", | ||
| "cancelLabel": "Cancel", | ||
| "confirmLabel": "Delete account", | ||
| "action": { | ||
| "event": { | ||
| "name": "delete_account", | ||
| "context": {} | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env bash | ||
| # Pack-and-install boundary test (PR-2 acceptance): the package must be | ||
| # consumable exactly as published/git-dep'd — exports map only, no deep | ||
| # imports, dist + meta files present in the tarball. | ||
| set -euo pipefail | ||
| cd "$(dirname "$0")/.." | ||
|
|
||
| WORK="$(mktemp -d)" | ||
| trap 'rm -rf "$WORK"' EXIT | ||
|
|
||
| npm run build >/dev/null | ||
| TARBALL="$(npm pack --pack-destination "$WORK" 2>/dev/null | tail -1)" | ||
| echo "packed: $TARBALL" | ||
|
|
||
| cd "$WORK" | ||
| npm init -y >/dev/null 2>&1 | ||
| npm install --no-fund --no-audit "./$TARBALL" >/dev/null | ||
|
|
||
| cat > smoke.mjs <<'EOF' | ||
| import { readFileSync } from "node:fs"; | ||
| import { | ||
| transform, | ||
| emitSurface, | ||
| validateCatalog, | ||
| extractInstances, | ||
| shadcnProfile, | ||
| EmitSurfaceError, | ||
| } from "@aestheticfunction/dspack-to-a2ui"; | ||
|
|
||
| const root = process.env.REPO_ROOT; | ||
| const doc = JSON.parse(readFileSync(`${root}/input/shadcn-ui.dspack.json`, "utf8")); | ||
| const csr = JSON.parse(readFileSync(`${root}/surface/delete-account.dsurface.json`, "utf8")); | ||
|
|
||
| const { messages } = emitSurface(csr, doc); | ||
| const { validation } = transform(doc, "0.9.1", { messages }); | ||
| if (!validation.pass) throw new Error("gates failed from packed install"); | ||
| if (extractInstances({ messages }).length === 0) throw new Error("no instances extracted"); | ||
| if (typeof validateCatalog !== "function" || !shadcnProfile.catalogIdBase) throw new Error("exports missing"); | ||
|
|
||
| let threw = false; | ||
| try { | ||
| emitSurface({ ...csr, root: { component: "carousel" } }, doc); | ||
| } catch (e) { | ||
| threw = e instanceof EmitSurfaceError; | ||
| } | ||
| if (!threw) throw new Error("typed error not thrown from packed install"); | ||
| console.log("pack-and-install smoke: OK (A1-A3 pass; typed errors intact)"); | ||
| EOF | ||
| REPO_ROOT="$OLDPWD" node smoke.mjs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.