Skip to content

Commit 6c30438

Browse files
Add local deployment to CloudFlare Pages
1 parent 3185faf commit 6c30438

File tree

6 files changed

+789
-9
lines changed

6 files changed

+789
-9
lines changed

.ci/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NODE_IMAGE="node:20"
2+
CLOUDFLARE_ACCOUNT_ID="example"
3+
CLOUDFLARE_API_TOKEN="example"

.ci/Taskfile.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
lint:
12+
cmds:
13+
- |
14+
docker run \
15+
--rm \
16+
-w /app \
17+
-v $(pwd)/..:/app \
18+
$NODE_IMAGE /bin/bash -c "yarn lint"
19+
20+
test:
21+
desc: runs unit tests of lib
22+
cmds:
23+
- |
24+
docker run --user {{.MY_UID}}:{{.MY_GID}} \
25+
-v $(pwd)/../lib:/app \
26+
-w /app \
27+
$NODE_IMAGE \
28+
yarn test:unit
29+
30+
build:
31+
desc: creates production build of docs
32+
cmds:
33+
- |
34+
docker run \
35+
--rm \
36+
-w /app/docs \
37+
-v $(pwd)/../docs:/app/docs \
38+
-v $(pwd)/../lib:/app/lib \
39+
$NODE_IMAGE /bin/bash -c "yarn build"
40+
41+
deploy:pages:
42+
desc: deploy to CloudFlare pages
43+
cmds:
44+
- |
45+
docker run --user $(id -u):$(id -g) \
46+
--rm \
47+
-w /app \
48+
-v $(pwd)/../docs:/app \
49+
-e CLOUDFLARE_ACCOUNT_ID \
50+
-e CLOUDFLARE_API_TOKEN \
51+
$NODE_IMAGE yarn deploy
52+
53+
deploy:
54+
desc: Lints, tests, builds and deploys to CloudFlare pages
55+
cmds:
56+
- task lint
57+
- task test
58+
- task build
59+
- task deploy:pages

docs/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ dist-ssr
2424
*.sw?
2525

2626
test-results/
27-
playwright-report/
27+
playwright-report/
28+
.wrangler

docs/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
name="title"
99
content="The Supersonic Plugin For Scroll Based Animation"
1010
/>
11+
<link
12+
rel="stylesheet"
13+
type="text/css"
14+
href="https://the-illarionov.com/style.css"
15+
/>
1116
<title>The Supersonic Plugin For Scroll Based Animation</title>
1217
<style>
1318
.iframe-wrapper {
@@ -53,7 +58,7 @@
5358
</style>
5459
</head>
5560
<body>
56-
<h1>1. Basic example</h1>
61+
<h1>1. Basic exampleq</h1>
5762
<div class="iframe-wrapper">
5863
<iframe
5964
title="The Supersonic Plugin For SCroll Based Animation: Basic Example"
@@ -264,7 +269,7 @@ <h1>10. Using driver hooks to animate custom element</h1>
264269
<iframe
265270
style="height: 80vh"
266271
scrolling="no"
267-
title="Untitled"
272+
title="The Supersonic Plugin For Scroll Based Animation: Using driver hooks to animate custom element"
268273
src="https://codepen.io/Alex-Illarionov/embed/yLrqGQg?default-tab=result"
269274
frameborder="no"
270275
loading="lazy"
@@ -273,7 +278,10 @@ <h1>10. Using driver hooks to animate custom element</h1>
273278
data-test="example-10"
274279
>
275280
See the Pen
276-
<a href="https://codepen.io/Alex-Illarionov/pen/yLrqGQg"> Untitled</a>
281+
<a href="https://codepen.io/Alex-Illarionov/pen/yLrqGQg"
282+
>The Supersonic Plugin For Scroll Based Animation: Using driver hooks
283+
to animate custom element</a
284+
>
277285
by Alex Illarionov (<a href="https://codepen.io/Alex-Illarionov"
278286
>@Alex-Illarionov</a
279287
>) on <a href="https://codepen.io">CodePen</a>.

docs/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
"preview": "vite preview --port=80 --host",
1010
"test:e2e": "playwright test",
1111
"test:e2e:ui": "playwright test --ui",
12-
"test:e2e:report": "playwright show-report --host 0.0.0.0 --port 8000"
12+
"test:e2e:report": "playwright show-report --host 0.0.0.0 --port 8000",
13+
"deploy": "wrangler pages deploy dist --project-name=the-supersonic-plugin-for-scroll-based-animation --branch=main"
1314
},
1415
"devDependencies": {
1516
"@types/node": "^20.12.7",
1617
"postcss": "^8.4.38",
1718
"typescript": "^5.2.2",
18-
"vite": "^5.2.0"
19+
"vite": "^5.2.0",
20+
"wrangler": "^3.50.0"
1921
}
2022
}

0 commit comments

Comments
 (0)