diff --git a/.github/workflows/web_build_and_test.yml b/.github/workflows/web_build_and_test.yml new file mode 100644 index 00000000..c71996e4 --- /dev/null +++ b/.github/workflows/web_build_and_test.yml @@ -0,0 +1,43 @@ +name: Web directory build and test + +on: + push: + branches: [ main ] + paths: + - 'web/**' + pull_request: + branches: [ main ] + paths: + - 'web/**' + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Cache .wireit + uses: actions/cache@v4 + with: + path: web/.wireit + key: ${{ runner.os }}-wireit-${{ hashFiles('web/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-wireit- + + - name: Install all workspaces' dependencies + working-directory: ./web + run: npm install --workspaces + + - name: Build all workspaces + working-directory: ./web + run: npm run build --workspaces + + - name: Run all tests + working-directory: ./web + run: npm run test --workspace=tests diff --git a/web/contact/package.json b/web/contact/package.json index 7d49f279..f0c101c5 100644 --- a/web/contact/package.json +++ b/web/contact/package.json @@ -39,7 +39,7 @@ "FORCE_COLOR": "1" }, "dependencies": [ - "../lib#build:tsc" + "../lib:build:tsc" ], "files": [ "**/*.ts", diff --git a/web/editor/README.md b/web/editor/README.md index a6b522fe..eda8a7c4 100644 --- a/web/editor/README.md +++ b/web/editor/README.md @@ -1,4 +1,4 @@ -# A2UI Generator +# A2UI Editor / Generator This is a UI to generate and visualize A2UI responses. diff --git a/web/editor/client.ts b/web/editor/client.ts index aee97650..bdfc62cc 100644 --- a/web/editor/client.ts +++ b/web/editor/client.ts @@ -18,7 +18,7 @@ import { v0_8 } from "@a2ui/web-lib"; const catalog: v0_8.Types.ClientCapabilitiesDynamic = { components: - v0_8.Schemas.A2UIProtocolMessage["properties"]["surfaceUpdate"][ + v0_8.Schemas.A2UIClientEventMessage["properties"]["surfaceUpdate"][ "properties" ]["components"]["items"]["properties"]["component"]["properties"], styles: {}, diff --git a/web/editor/middleware/prompts.ts b/web/editor/middleware/prompts.ts index 304be21f..420f3acf 100644 --- a/web/editor/middleware/prompts.ts +++ b/web/editor/middleware/prompts.ts @@ -98,7 +98,7 @@ export function createA2UIPrompt( `The user's layout request is: "${combinedInstructions.join('" and "')}"`, `The Component Catalog you can use is: ${JSON.stringify(catalog)}`, `The A2UI Protocol Message Schema: "${JSON.stringify( - v0_8.Schemas.A2UIProtocolMessage + v0_8.Schemas.A2UIClientEventMessage )}"`, `Please return a valid A2UI Protocol Message object necessary to build the diff --git a/web/editor/package.json b/web/editor/package.json index 63c4bbed..0aec0b2e 100644 --- a/web/editor/package.json +++ b/web/editor/package.json @@ -39,7 +39,7 @@ "FORCE_COLOR": "1" }, "dependencies": [ - "#build:tsc" + "../lib:build" ], "files": [ "**/*.ts", diff --git a/web/inspector/package.json b/web/inspector/package.json index 16b4bf76..a7f48291 100644 --- a/web/inspector/package.json +++ b/web/inspector/package.json @@ -39,7 +39,7 @@ "FORCE_COLOR": "1" }, "dependencies": [ - "#build:tsc" + "../lib:build:tsc" ], "files": [ "**/*.ts", diff --git a/web/lib/package.json b/web/lib/package.json index 0bdf8b4a..3a0ffb21 100644 --- a/web/lib/package.json +++ b/web/lib/package.json @@ -27,12 +27,12 @@ }, "wireit": { "copy-spec": { - "command": "cp ../../specification/0.8/json/*.json ./src/0.8/schemas", + "command": "mkdir -p src/0.8/schemas && cp ../../specification/0.8/json/*.json src/0.8/schemas", "files": [ - "src/config.prod.js" + "../../specification/0.8/json/*.json" ], "output": [ - "dist/config.js" + "src/0.8/schemas/*.json" ] }, "serve": { @@ -100,4 +100,4 @@ "markdown-it": "^14.1.0", "signal-utils": "^0.21.1" } -} \ No newline at end of file +} diff --git a/web/lib/src/0.8/schemas/.gitignore b/web/lib/src/0.8/schemas/.gitignore new file mode 100644 index 00000000..496d370a --- /dev/null +++ b/web/lib/src/0.8/schemas/.gitignore @@ -0,0 +1,4 @@ +# Copied schema files +# (needed for the build but otherwise redundant) +*.json +!server_to_client_with_standard_catalog.json diff --git a/web/package.json b/web/package.json index 448d4cb3..9adef0c6 100644 --- a/web/package.json +++ b/web/package.json @@ -3,12 +3,8 @@ "private": true, "version": "0.1.0", "description": "AI-first UI Toolkit Demo", - "main": "./dist/index.js", - "scripts": { - "build": "wireit" - }, "repository": { - "directory": "packages/a2ui", + "directory": "web", "type": "git", "url": "git+https://github.com/google/A2UI.git" }, diff --git a/web/restaurant/package.json b/web/restaurant/package.json index 32d79e66..272a96c8 100644 --- a/web/restaurant/package.json +++ b/web/restaurant/package.json @@ -39,7 +39,7 @@ "FORCE_COLOR": "1" }, "dependencies": [ - "#build:tsc" + "../lib:build:tsc" ], "files": [ "**/*.ts", diff --git a/web/tests/package.json b/web/tests/package.json index ab751e15..9fd7df9d 100644 --- a/web/tests/package.json +++ b/web/tests/package.json @@ -37,7 +37,7 @@ "FORCE_COLOR": "1" }, "dependencies": [ - "#build:tsc" + "../lib:build:tsc" ], "files": [ "0.8/**/*.ts",