diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34275cac1..4ae0e49f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -280,7 +280,7 @@ jobs: ref_scope="pr-${{ github.event.pull_request.number }}" fi - recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'package.json', 'package-lock.json') }}" + recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'frontend/src/**', 'package.json', 'package-lock.json') }}" { echo "current=sqlpage-${ref_scope}${{ matrix.tag_suffix }}-${recipe_hash}" echo "main=sqlpage-main${{ matrix.tag_suffix }}-${recipe_hash}" @@ -360,7 +360,7 @@ jobs: ref_scope="pr-${{ github.event.pull_request.number }}" fi - recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'package.json', 'package-lock.json') }}" + recipe_hash="${{ hashFiles('Dockerfile', '.cargo/**', 'Cargo.toml', 'Cargo.lock', 'build.rs', 'scripts/**', 'sqlpage/**', 'frontend/src/**', 'package.json', 'package-lock.json') }}" { echo "artifact=sqlpage-${ref_scope}-linux-amd64-hurl-${recipe_hash}" echo "current=sqlpage-${ref_scope}-linux-amd64-${recipe_hash}" diff --git a/AGENTS.md b/AGENTS.md index 22032c12c..51c120287 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,7 +34,7 @@ JavaScript where needed. retries, and optional `on_connect.sql`/`on_reset.sql` hooks. Database-specific SQL should be isolated or covered by the relevant database tests. - **Rendering and components** (`src/render.rs`, `src/templates.rs`, `src/dynamic_component.rs`, - `src/template_helpers.rs`, `sqlpage/templates/`, `sqlpage/sqlpage.css`, `sqlpage/sqlpage.js`). Built-in components live in `sqlpage/templates/*.handlebars` and cover shells, text, + `src/template_helpers.rs`, `sqlpage/templates/`, `frontend/src/`). Built-in components live in `sqlpage/templates/*.handlebars` and cover shells, text, tables, lists, cards, charts, forms, navigation, modals, downloads, maps, and more. Query columns map to component properties; nested/dynamic components and `sqlpage.run_sql` support composition and lazy loading. Custom Handlebars components can be placed in the configured `sqlpage/templates` directory. Raw HTML and @@ -145,4 +145,4 @@ official documentation website sql tables: - Routing: file-based in `src/webserver/routing.rs`. Missing paths use the nearest ancestor `404.sql`; without one, HTML uses `src/default_404.sql` and other formats receive a plain-text 404. - Playwright component suites: `tests/end-to-end/fixtures//{index.sql,test.ts}` using `tests/end-to-end/fixture.ts`; official-site smoke tests remain in `tests/end-to-end/*.spec.ts`. - Follow patterns from similar modules before introducing new abstractions. -- frontend: see [css](./sqlpage/sqlpage.css) and [js](./sqlpage/sqlpage.js) +- frontend: see [frontend/src](./frontend/src/), bundled by `npm run build` diff --git a/Dockerfile b/Dockerfile index 30f83d926..71c5149b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM --platform=$BUILDPLATFORM node:26-slim AS frontend WORKDIR /usr/src/sqlpage COPY package.json package-lock.json ./ RUN npm ci --ignore-scripts -COPY sqlpage/ sqlpage/ +COPY frontend/src/ frontend/src/ COPY scripts/build-frontend.mjs scripts/ RUN node scripts/build-frontend.mjs diff --git a/sqlpage/apexcharts.js b/frontend/src/apexcharts.js similarity index 100% rename from sqlpage/apexcharts.js rename to frontend/src/apexcharts.js diff --git a/sqlpage/chart_series.js b/frontend/src/chart_series.js similarity index 100% rename from sqlpage/chart_series.js rename to frontend/src/chart_series.js diff --git a/sqlpage/favicon.svg b/frontend/src/favicon.svg similarity index 100% rename from sqlpage/favicon.svg rename to frontend/src/favicon.svg diff --git a/sqlpage/globals.d.ts b/frontend/src/globals.d.ts similarity index 100% rename from sqlpage/globals.d.ts rename to frontend/src/globals.d.ts diff --git a/sqlpage/init.js b/frontend/src/init.js similarity index 100% rename from sqlpage/init.js rename to frontend/src/init.js diff --git a/sqlpage/sqlpage.css b/frontend/src/sqlpage.css similarity index 100% rename from sqlpage/sqlpage.css rename to frontend/src/sqlpage.css diff --git a/sqlpage/sqlpage.js b/frontend/src/sqlpage.js similarity index 100% rename from sqlpage/sqlpage.js rename to frontend/src/sqlpage.js diff --git a/sqlpage/tomselect.js b/frontend/src/tomselect.js similarity index 100% rename from sqlpage/tomselect.js rename to frontend/src/tomselect.js diff --git a/lambda.Dockerfile b/lambda.Dockerfile index 307abaa07..f17f3f940 100644 --- a/lambda.Dockerfile +++ b/lambda.Dockerfile @@ -2,7 +2,7 @@ FROM node:26-slim AS frontend WORKDIR /usr/src/sqlpage COPY package.json package-lock.json ./ RUN npm ci --ignore-scripts -COPY sqlpage/ sqlpage/ +COPY frontend/src/ frontend/src/ COPY scripts/build-frontend.mjs scripts/ RUN node scripts/build-frontend.mjs diff --git a/scripts/build-frontend.mjs b/scripts/build-frontend.mjs index aa3d425d4..edf5bf11d 100644 --- a/scripts/build-frontend.mjs +++ b/scripts/build-frontend.mjs @@ -12,7 +12,7 @@ const STYLESHEET = [ ]; const COPIED = { - "favicon.svg": "sqlpage/favicon.svg", + "favicon.svg": "frontend/src/favicon.svg", "tabler-sprite.svg": "node_modules/@tabler/icons-sprite/dist/tabler-sprite.svg", }; @@ -25,7 +25,7 @@ function refuse(warning) { async function bundle(entry) { const build = await rolldown({ - input: { [entry]: `sqlpage/${entry}.js` }, + input: { [entry]: `frontend/src/${entry}.js` }, onwarn: refuse, }); await build.write({ dir: DIST, format: "iife", minify: true }); @@ -34,7 +34,7 @@ async function bundle(entry) { async function stylesheet() { const vendored = await Promise.all(STYLESHEET.map((s) => readFile(s))); - const own = await readFile("sqlpage/sqlpage.css"); + const own = await readFile("frontend/src/sqlpage.css"); const parts = [...vendored.map((v) => `${v}\n`), own]; await writeFile(`${DIST}/sqlpage.css`, parts.join("")); } diff --git a/tests/js/chart_series.spec.ts b/tests/js/chart_series.spec.ts index 2afcf3b86..22dbd9acd 100644 --- a/tests/js/chart_series.spec.ts +++ b/tests/js/chart_series.spec.ts @@ -5,7 +5,7 @@ import { align_series_for, merged_x_values, xaxis_type_for, -} from "../../sqlpage/chart_series.js"; +} from "../../frontend/src/chart_series.js"; const ADDS_NOTHING_TO_THE_STACK = 0; const LEAVES_A_GAP = null; diff --git a/tsconfig.json b/tsconfig.json index 936b43629..f954acea6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,5 +11,5 @@ "noImplicitAny": false, "types": [] }, - "include": ["sqlpage/*.js", "sqlpage/globals.d.ts"] + "include": ["frontend/src"] }