Skip to content

Commit 326292c

Browse files
authored
Merge pull request #63 from eviltester/58-move-web-into-apps
web refactoring and packaging
2 parents 40128ec + f05104b commit 326292c

110 files changed

Lines changed: 4036 additions & 633 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ coverage
55
build
66
test-results
77
tests
8-
docs-src
98
*.log

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ docs-src/build/
55
node_modules/
66
js/libs/
77
packages/core/js/libs/
8+
apps/web/libs/
9+
apps/web/dist/
810
js/gui_components/data-grid-editor/tabulator/customHeader-tabulator.js

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
},
3333
overrides: [
3434
{
35-
files: ["tests/**/*.js"],
35+
files: ["tests/**/*.js", "apps/web/src/tests/jest/**/*.js"],
3636
env: {
3737
jest: true,
3838
node: true,

.github/workflows/node.js.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,88 @@ jobs:
8383
- name: Verify
8484
run: npm run verify:ci
8585

86+
- name: Docker smoke test (API)
87+
run: |
88+
set -euo pipefail
89+
90+
cleanup() {
91+
docker rm -f api-ci >/dev/null 2>&1 || true
92+
}
93+
trap cleanup EXIT
94+
api_curl() {
95+
if ! curl -fsS "$@"; then
96+
echo "API smoke request failed: curl $*"
97+
docker logs api-ci || true
98+
exit 1
99+
fi
100+
}
101+
102+
docker build -f apps/api/Dockerfile -t anywaydata-api-ci .
103+
docker run -d --rm --name api-ci -p 18082:3000 anywaydata-api-ci
104+
105+
ready=0
106+
for i in {1..20}; do
107+
if curl -fsS http://127.0.0.1:18082/v1/health >/dev/null; then
108+
ready=1
109+
break
110+
fi
111+
sleep 1
112+
done
113+
if [ "$ready" -ne 1 ]; then
114+
docker logs api-ci || true
115+
echo "API container did not become ready within timeout"
116+
exit 1
117+
fi
118+
api_curl http://127.0.0.1:18082/v1/health | grep -qi "ok"
119+
api_curl -X POST "http://127.0.0.1:18082/v1/generate" \
120+
-H "content-type: application/json" \
121+
-d '{"textSpec":"Name\nBob","rowCount":2,"outputFormat":"json"}' | grep -q '"format":"json"'
122+
echo "API docker smoke test passed"
123+
124+
- name: Docker smoke test (Web)
125+
run: |
126+
set -euo pipefail
127+
128+
cleanup() {
129+
docker rm -f web-ci >/dev/null 2>&1 || true
130+
}
131+
trap cleanup EXIT
132+
133+
docker build -f apps/web/Dockerfile -t anywaydata-web-ci .
134+
docker run -d --rm --name web-ci -p 18080:80 anywaydata-web-ci
135+
136+
for i in {1..20}; do
137+
if curl -fsS http://127.0.0.1:18080/app.html >/dev/null; then
138+
break
139+
fi
140+
sleep 1
141+
done
142+
curl -fsS http://127.0.0.1:18080/app.html | grep -q "AnyWayData"
143+
curl -fsS http://127.0.0.1:18080/generator.html | grep -q "AnyWayData"
144+
echo "Web docker smoke test passed"
145+
146+
- name: Docker smoke test (AnyWayData full site)
147+
run: |
148+
set -euo pipefail
149+
150+
cleanup() {
151+
docker rm -f site-ci >/dev/null 2>&1 || true
152+
}
153+
trap cleanup EXIT
154+
155+
docker build -f apps/anywaydata/Dockerfile -t anywaydata-site-ci .
156+
docker run -d --rm --name site-ci -p 18081:8080 anywaydata-site-ci
157+
158+
for i in {1..20}; do
159+
if curl -fsS http://127.0.0.1:18081/ >/dev/null; then
160+
break
161+
fi
162+
sleep 1
163+
done
164+
curl -fsS http://127.0.0.1:18081/ | grep -q "AnyWayData"
165+
curl -fsS http://127.0.0.1:18081/app.html | grep -q "AnyWayData"
166+
echo "AnyWayData full-site docker smoke test passed"
167+
86168
- name: Upload coverage artifact
87169
uses: actions/upload-artifact@v4
88170
with:

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@ A simple Data Table Editor that generates Markdown, CSV or JSON. It can also be
2424

2525
The application is live at [AnyWayData.com](https://anywaydata.com)
2626

27-
- Or clone and run locally by opening index.html in a browser after starting a web server in the folder e.g. `python3 -m http.server`
27+
- Or clone and run locally with Vite:
28+
- `npm install`
29+
- `npm run dev:web`
30+
- open `http://127.0.0.1:4173/app.html` or `http://127.0.0.1:4173/generator.html`
31+
32+
Use `npm run build:web` to create a production build and `npm run preview:web` to preview the built output.
33+
The old static-server flow (e.g. `python3 -m http.server`) is no longer the recommended local runtime path.
2834

2935
### Select Grid Engine
3036

app.html

Lines changed: 0 additions & 134 deletions
This file was deleted.

apps/anywaydata/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:20-alpine AS builder
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
COPY docs-src/package*.json ./docs-src/
8+
COPY apps ./apps
9+
COPY docs-src ./docs-src
10+
COPY packages ./packages
11+
COPY scripts ./scripts
12+
13+
RUN npm ci
14+
RUN npm ci --prefix docs-src
15+
RUN npm run anywaydata --prefix docs-src
16+
RUN npm run build:web
17+
RUN node ./scripts/merge-web-build-into-docs-build.js
18+
19+
FROM nginxinc/nginx-unprivileged:1.27-alpine
20+
WORKDIR /usr/share/nginx/html
21+
22+
COPY --from=builder /app/build/ ./

apps/anywaydata/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# AnyWayData Full Site Docker Image
2+
3+
This image builds and serves the full `anywaydata.com` experience by combining:
4+
5+
- Docusaurus docs output (`docs-src` -> `build`)
6+
- Web app production bundle (`apps/web/dist`)
7+
8+
The build process merges both into a single static site and serves it with nginx.
9+
10+
## Build
11+
12+
From the repo root:
13+
14+
```bash
15+
docker build -f apps/anywaydata/Dockerfile -t anywaydata-site .
16+
```
17+
18+
## Run
19+
20+
```bash
21+
docker run --rm -p 8080:8080 anywaydata-site
22+
```
23+
24+
Then open:
25+
26+
- `http://localhost:8080/`
27+
- `http://localhost:8080/app.html`
28+
- `http://localhost:8080/generator.html`
29+
30+
## Notes
31+
32+
- This Dockerfile is separate from `apps/web/Dockerfile`.
33+
- `apps/web/Dockerfile` serves only the web app.
34+
- `apps/anywaydata/Dockerfile` serves docs + web app together.

apps/api/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ENV NODE_ENV=production
1313
COPY --from=deps /app/node_modules ./node_modules
1414
COPY package.json ./package.json
1515
COPY packages/core ./packages/core
16-
COPY js ./js
1716
COPY apps/api ./apps/api
1817
EXPOSE 3000
1918
CMD ["node", "apps/api/src/index.js"]

apps/web/Dockerfile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# syntax=docker/dockerfile:1
2+
3+
FROM node:20-alpine AS builder
4+
WORKDIR /app
5+
6+
COPY package*.json ./
7+
COPY apps ./apps
8+
COPY packages ./packages
9+
10+
RUN npm ci
11+
RUN npm run build:web
12+
213
FROM nginx:1.27-alpine
314
WORKDIR /usr/share/nginx/html
415

5-
# Serve the browser app only (no docs-src / docusaurus build pipeline)
6-
COPY index.html ./index.html
7-
COPY app.html ./app.html
8-
COPY generator.html ./generator.html
9-
COPY styles.css ./styles.css
10-
COPY packages/core ./packages/core
11-
COPY packages/core-ui ./packages/core-ui
12-
COPY libs ./libs
13-
COPY images ./images
16+
# Serve the built browser app only (no docs-src / docusaurus build pipeline)
17+
COPY --from=builder /app/apps/web/dist/ ./

0 commit comments

Comments
 (0)