Skip to content

Commit b9a4b15

Browse files
Upgrade to version 2.0
1 parent c04775a commit b9a4b15

File tree

123 files changed

+8481
-11143
lines changed

Some content is hidden

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

123 files changed

+8481
-11143
lines changed

.ci/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NODE_IMAGE="node:20"
2+
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.43.0-jammy"
3+
CLOUDFLARE_ACCOUNT_ID="example"
4+
CLOUDFLARE_API_TOKEN="example"

.ci/Taskfile.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: '3'
2+
3+
dotenv: [.env]
4+
5+
tasks:
6+
env:
7+
desc: makes .env from .env.example
8+
cmds:
9+
- cp .env.example .env
10+
11+
root:yarn:
12+
desc: runs 'yarn' in root directory
13+
cmds:
14+
- |
15+
docker run --rm \
16+
-w /app \
17+
-v $(pwd)/..:/app \
18+
$NODE_IMAGE yarn
19+
20+
docs:yarn:
21+
desc: runs 'yarn' in 'docs' directory
22+
cmds:
23+
- |
24+
docker run --rm \
25+
-w /app \
26+
-v $(pwd)/../docs:/app \
27+
$NODE_IMAGE yarn
28+
29+
lib:yarn:
30+
desc: runs 'yarn' in 'lib' directory
31+
cmds:
32+
- |
33+
docker run --rm \
34+
-w /app \
35+
-v $(pwd)/../lib:/app \
36+
$NODE_IMAGE yarn
37+
38+
yarn:
39+
cmds:
40+
- task root:yarn
41+
- task docs:yarn
42+
- task lib:yarn
43+
44+
lint:
45+
cmds:
46+
- |
47+
docker run --rm \
48+
-w /app \
49+
-v $(pwd)/..:/app \
50+
$NODE_IMAGE /bin/bash -c "yarn lint"
51+
52+
build:
53+
desc: creates production build of docs
54+
cmds:
55+
- task lint
56+
- |
57+
docker run --rm \
58+
-w /app/docs \
59+
-v $(pwd)/../docs:/app/docs \
60+
-v $(pwd)/../lib:/app/lib \
61+
$NODE_IMAGE /bin/bash -c "yarn build"
62+
63+
up:
64+
cmds:
65+
- |
66+
docker run \
67+
--rm --network="host" \
68+
-v $(pwd)/../docs:/app/docs \
69+
-v $(pwd)/../lib:/app/lib \
70+
-w /app/docs \
71+
-d $NODE_IMAGE \
72+
yarn preview
73+
74+
test:unit:
75+
desc: runs unit tests in 'lib' directory
76+
cmds:
77+
- |
78+
docker run --rm \
79+
-v $(pwd)/../lib:/app \
80+
-w /app \
81+
$NODE_IMAGE \
82+
yarn test:unit
83+
84+
test:e2e:
85+
desc: runs Playwright
86+
cmds:
87+
- |
88+
docker run --rm \
89+
--network="host" \
90+
-v $(pwd)/../docs:/app \
91+
-w /app \
92+
$PLAYWRIGHT_IMAGE \
93+
yarn test:e2e
94+
95+
test:
96+
cmds:
97+
- task test:unit
98+
- task test:e2e
99+
100+
deploy:pages:
101+
desc: deploy to CloudFlare pages
102+
cmds:
103+
- |
104+
docker run \
105+
--rm \
106+
-w /app \
107+
-v $(pwd)/../docs:/app \
108+
-e CLOUDFLARE_ACCOUNT_ID \
109+
-e CLOUDFLARE_API_TOKEN \
110+
$NODE_IMAGE yarn deploy
111+
112+
deploy:
113+
desc: Lints, tests, builds and deploys to CloudFlare pages
114+
cmds:
115+
- task build
116+
- task up
117+
- task test
118+
- task deploy:pages

.dev/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
NODE_IMAGE="node:20"
2+
PLAYWRIGHT_IMAGE="mcr.microsoft.com/playwright:v1.43.0-jammy"

.dev/Taskfile.yaml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
version: '3'
2+
3+
dotenv: [.env]
4+
5+
vars:
6+
MY_UID: $(id -u) # TODO: Change this line if you are not on Linux
7+
MY_GID: $(id -g) # TODO: Change this line if you are not on Linux
8+
9+
tasks:
10+
env:
11+
desc: makes .env from .env.example
12+
cmds:
13+
- cp .env.example .env
14+
15+
init:
16+
desc: prepare everything for development
17+
cmds:
18+
- task root:yarn
19+
- task lib:yarn
20+
- task docs:yarn
21+
- docker pull $PLAYWRIGHT_IMAGE
22+
- docker build -t unit-tests-ui - < ./UnitTestUi.Dockerfile --build-arg NODE_IMAGE
23+
24+
up:
25+
desc: start services
26+
cmds:
27+
- MY_UID="{{.MY_UID}}" MY_GID="{{.MY_GID}}" docker compose up -d
28+
29+
down:
30+
desc: stops services
31+
cmds:
32+
- MY_UID="{{.MY_UID}}" MY_GID="{{.MY_GID}}" docker compose down
33+
34+
restart:
35+
desc: restart services
36+
cmds:
37+
- task down
38+
- task up
39+
40+
logs:
41+
desc: logs the development compose
42+
cmds:
43+
- docker compose logs -f
44+
45+
# ROOT
46+
root:
47+
desc: launch node with mounted root directory
48+
cmds:
49+
- |
50+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
51+
-it --rm \
52+
-w /app \
53+
-v $(pwd)/..:/app \
54+
$NODE_IMAGE /bin/bash
55+
56+
root:yarn:
57+
desc: runs 'yarn' in root directory
58+
cmds:
59+
- |
60+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
61+
--rm \
62+
-w /app \
63+
-v $(pwd)/..:/app \
64+
$NODE_IMAGE /bin/bash -c "yarn {{.CLI_ARGS }}"
65+
66+
root:lint:
67+
desc: runs 'lint' in root directory
68+
cmds:
69+
- |
70+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
71+
--rm \
72+
-w /app \
73+
-v $(pwd)/..:/app \
74+
$NODE_IMAGE /bin/bash -c "yarn lint"
75+
76+
root:lint:fix:
77+
desc: runs 'lint:fix' in root directory
78+
cmds:
79+
- |
80+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
81+
--rm \
82+
-w /app \
83+
-v $(pwd)/..:/app \
84+
$NODE_IMAGE /bin/bash -c "yarn lint:fix"
85+
86+
# LIB
87+
lib:
88+
desc: launch node with mounted 'lib' directory
89+
cmds:
90+
- |
91+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
92+
-it --rm \
93+
-w /app \
94+
-v $(pwd)/../lib:/app \
95+
$NODE_IMAGE /bin/bash
96+
97+
lib:yarn:
98+
desc: runs 'yarn' in 'lib' directory
99+
cmds:
100+
- |
101+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
102+
--rm \
103+
-w /app \
104+
-v $(pwd)/../lib:/app \
105+
$NODE_IMAGE /bin/bash -c "yarn {{.CLI_ARGS }}"
106+
107+
lib:build:
108+
desc: runs 'yarn build' in 'lib' directory
109+
cmds:
110+
- |
111+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
112+
--rm \
113+
-w /app \
114+
-v $(pwd)/../lib:/app \
115+
$NODE_IMAGE /bin/bash -c "yarn build && yarn minify"
116+
- rm ../lib/dist/the-supersonic-plugin-for-scroll-based-animation.js
117+
- mv ../lib/dist/the-supersonic-plugin-for-scroll-based-animation.min.js ../lib/dist/the-supersonic-plugin-for-scroll-based-animation.js
118+
119+
# DOCS
120+
docs:
121+
desc: launch node with mounted 'docs' directory
122+
cmds:
123+
- |
124+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
125+
-it --rm \
126+
-w /app \
127+
-v $(pwd)/../docs:/app \
128+
$NODE_IMAGE /bin/bash
129+
130+
docs:yarn:
131+
desc: runs 'yarn' in 'docs' directory
132+
cmds:
133+
- |
134+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
135+
--rm \
136+
-w /app \
137+
-v $(pwd)/../docs:/app \
138+
$NODE_IMAGE /bin/bash -c "yarn {{.CLI_ARGS }}"
139+
140+
docs:build:
141+
desc: runs 'yarn build' in 'docs' directory
142+
cmds:
143+
- |
144+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
145+
--rm \
146+
-w /app/docs \
147+
-v $(pwd)/../docs:/app/docs \
148+
-v $(pwd)/../lib:/app/lib \
149+
$NODE_IMAGE /bin/bash -c "yarn build"
150+
151+
# TESTS
152+
test:unit:
153+
desc: runs unit tests in 'lib' directory
154+
cmds:
155+
- |
156+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
157+
-v $(pwd)/../lib:/app \
158+
-w /app \
159+
$NODE_IMAGE \
160+
yarn test:unit
161+
162+
test:e2e:
163+
desc: runs Playwright
164+
cmds:
165+
- |
166+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
167+
--rm --network="host" --ipc=host \
168+
-v $(pwd)/../docs:/app \
169+
-w /app \
170+
$PLAYWRIGHT_IMAGE \
171+
yarn test:e2e
172+
173+
test:e2e:ui:
174+
desc: runs Playwright in UI mode (works only in Linux)
175+
# TODO: Please refer to https://www.oddbird.net/2022/11/30/headed-playwright-in-docker/ if you want to make it work on Windows or macOS
176+
cmds:
177+
- |
178+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
179+
--rm --network="host" --ipc=host \
180+
-e DISPLAY=${DISPLAY} \
181+
-v /tmp/.X11-unix:/tmp/.X11-unix \
182+
-v $(pwd)/../docs:/app \
183+
-w /app \
184+
$PLAYWRIGHT_IMAGE \
185+
yarn test:e2e:ui
186+
187+
test:
188+
cmds:
189+
- task test:unit
190+
- task test:e2e

.dev/UnitTestUi.Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG NODE_IMAGE
2+
3+
FROM ${NODE_IMAGE}
4+
5+
RUN apt update && apt install -y xdg-utils
6+
7+
# @vitest/ui needs xdg-utils to be able to spawn UI server

.dev/docker-compose.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
services:
2+
docs:
3+
image: ${NODE_IMAGE}
4+
working_dir: /app/docs
5+
command: yarn dev
6+
user: ${MY_UID}:${MY_GID}
7+
ports:
8+
- 80:80
9+
volumes:
10+
- ../docs:/app/docs
11+
- ../lib:/app/lib
12+
13+
docs-preview:
14+
image: ${NODE_IMAGE}
15+
working_dir: /app/docs
16+
command: yarn preview
17+
user: ${MY_UID}:${MY_GID}
18+
ports:
19+
- 9000:80
20+
volumes:
21+
- ../docs:/app/docs
22+
- ../lib:/app/lib
23+
24+
lib-tests-unit:
25+
image: unit-tests-ui
26+
user: ${MY_UID}:${MY_GID}
27+
working_dir: /app
28+
command: yarn test:unit:ui
29+
ports:
30+
- 9010:8000
31+
volumes:
32+
- ../lib:/app

0 commit comments

Comments
 (0)