mirror of https://github.com/LostLuma/Mousey.git
[frontend] Add test app to test auto deploy
This commit is contained in:
parent
4a8e916e85
commit
06ee4b97c1
|
@ -0,0 +1,22 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- stardust
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2.1.2
|
||||
- name: install
|
||||
run: npm clean-install
|
||||
- name: build
|
||||
run: npm run build
|
||||
- name: deploy
|
||||
env:
|
||||
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||
run: npm run deploy
|
|
@ -8,3 +8,8 @@ __pycache__
|
|||
# vs code
|
||||
.vs
|
||||
.vscode
|
||||
# npm
|
||||
node_modules
|
||||
# parcel
|
||||
.cache
|
||||
dist
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{ "printWidth": 100 }
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "frontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "parcel public/index.html",
|
||||
"build": "parcel build --experimental-scope-hoisting public/*",
|
||||
"deploy": "wrangler publish"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/SnowyLuma/Mousey.git"
|
||||
},
|
||||
"author": "Lilly Rose Berner <lilly@snowyluma.dev> (https://snowyluma.dev)",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/SnowyLuma/Mousey/issues"
|
||||
},
|
||||
"homepage": "https://github.com/SnowyLuma/Mousey#readme",
|
||||
"devDependencies": {
|
||||
"@cloudflare/wrangler": "^1.6.0",
|
||||
"eslint": "^7.18.0",
|
||||
"parcel-bundler": "^1.3.1",
|
||||
"prettier": "^2.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
<script src="../src/index.js"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,56 @@
|
|||
==================================================================
|
||||
https://keybase.io/snowyluma
|
||||
--------------------------------------------------------------------
|
||||
|
||||
I hereby claim:
|
||||
|
||||
* I am an admin of https://mousey.app
|
||||
* I am snowyluma (https://keybase.io/snowyluma) on keybase.
|
||||
* I have a public key ASBGccs61JXAFK-gARnf64lloiuPxDWNDdIo9S5PVFCqqAo
|
||||
|
||||
To do so, I am signing this object:
|
||||
|
||||
{
|
||||
"body": {
|
||||
"key": {
|
||||
"eldest_kid": "01204671cb3ad495c014afa00119dfeb8965a22b8fc4358d0dd228f52e4f5450aaa80a",
|
||||
"host": "keybase.io",
|
||||
"kid": "01204671cb3ad495c014afa00119dfeb8965a22b8fc4358d0dd228f52e4f5450aaa80a",
|
||||
"uid": "c5a2995809c385260e8245e665f61819",
|
||||
"username": "snowyluma"
|
||||
},
|
||||
"merkle_root": {
|
||||
"ctime": 1526001017,
|
||||
"hash": "e790b7a04294ae2699858f5ea8d59de28bd591362eb79720ad53b63d0b8aeb7ee4aeecbf8b54fceecf907fe83d3516518044cb9914a3d7483cad6928198e8b87",
|
||||
"hash_meta": "daeb320298f2744283d879ab269bb2ab5353197414a6f2121a8291b6d62d669a",
|
||||
"seqno": 2620717
|
||||
},
|
||||
"service": {
|
||||
"entropy": "eKI4SiuSeOdujH78Saxf+Pve",
|
||||
"hostname": "mousey.app",
|
||||
"protocol": "https:"
|
||||
},
|
||||
"type": "web_service_binding",
|
||||
"version": 2
|
||||
},
|
||||
"client": {
|
||||
"name": "keybase.io go client",
|
||||
"version": "1.0.47"
|
||||
},
|
||||
"ctime": 1526001089,
|
||||
"expire_in": 504576000,
|
||||
"prev": "d88c7f74b662431d06b0aaafd6c2688073a15a5e6c6cc804a8ad037715c37b74",
|
||||
"seqno": 23,
|
||||
"tag": "signature"
|
||||
}
|
||||
|
||||
which yields the signature:
|
||||
|
||||
hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgRnHLOtSVwBSvoAEZ3+uJZaIrj8Q1jQ3SKPUuT1RQqqgKp3BheWxvYWTESpcCF8Qg2Ix/dLZiQx0GsKqv1sJogHOhWl5sbMgEqK0DdxXDe3TEIJbZ2cfuSGkUK2hna0j/hmnGiIoqib7yIG2AB+y5UI1aAgHCo3NpZ8RAY0e8AdqxsTzv9pnr3n2msA+XCNVizT6DSSA/ZbZhln7VcSM5jMXc6VdO5x/iAeOrTRSWrVxGfyVw3c9PrmZ4CqhzaWdfdHlwZSCkaGFzaIKkdHlwZQildmFsdWXEINUlMBgtQB4iaBJi7GGy22Ut61Br5DQX7Azs2plnT90oo3RhZ80CAqd2ZXJzaW9uAQ==
|
||||
|
||||
And finally, I am proving ownership of this host by posting or
|
||||
appending to this document.
|
||||
|
||||
View my publicly-auditable identity here: https://keybase.io/snowyluma
|
||||
|
||||
==================================================================
|
|
@ -0,0 +1,4 @@
|
|||
User-Agent: *
|
||||
Allow: /
|
||||
Disallow: /archives/
|
||||
Disallow: /dashboard/
|
|
@ -0,0 +1,29 @@
|
|||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA512
|
||||
|
||||
# beep boop :blobpeek:
|
||||
|
||||
Preferred-Languages: en, de
|
||||
Contact: mailto:lilly@snowyluma.dev
|
||||
|
||||
Canonical: https://mousey.app/security.txt
|
||||
|
||||
Encryption: https://files.snowyluma.dev/pgp.txt
|
||||
Encryption: openpgp4fpr:4EFEA4EA85CE267F83A6CCD7014BEA900E05897F
|
||||
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAEBCgAdFiEETv6k6oXOJn+DpszXAUvqkA4FiX8FAmAHAW8ACgkQAUvqkA4F
|
||||
iX9kqRAA1rNHekKV9HAA73mensp5yCSdn7vVxxpV4gxrMVZ0W2QR8r/4aVs9JLnx
|
||||
r5X5qaJgLM04xSIiFvnnnD6SPowBo3fkUlJFbFwsZruZnxreUPgd36IyzXeQ7EgT
|
||||
9T5NXqsFYUoKQ05Y/76qIQzg+EHxznFeT9l926JIWd39OwCC7gMaVftUGpDxsuc+
|
||||
fiLPC6PLSpkjlAEMyWnQyhBV38WfakeMAkIjJx7izEZWcTeCzI5f7oDVlVUi6wxU
|
||||
BIkZ1oeTX7hdLHaUU6DzSJTyTjZdfHV/rLsgpi3D1s9dmstldQT36hSfacLxNyl5
|
||||
YjDHA8KP/smcK2LJN3+iFiyYUqP07BrYdUh+JI1NT3wz4rUk7AwRdpAzPjnC+KRJ
|
||||
bLEWeFBXreg9BXZxDVJ3jlq/uMgA6cIkrKU0y77/wLLaAgEEC5xZOjBQJzcZxYP2
|
||||
R1g/DJP6Mw2V0Ja+99+b+KqTxh01rzxFKqt/EbZRqnwW+ZnzDVslrXk12+iXhwO9
|
||||
Lcyfu3cHfK8wpFYYbZDBIia1X4phkTQn/uDnwXGC8IGywWEplQeHWKE6rWM1TTVL
|
||||
ENZo0T+/axuRSXEOyDeJ7W0WF1eyTPcLsN9N3KFEGBrj/UwDSwVKQrAr7/Oxd5+v
|
||||
GPvrSFPV+Vz0peyisZxkIv4lj7C1/RPnOy/lxG4da+kIGYpjZ1o=
|
||||
=WukE
|
||||
-----END PGP SIGNATURE-----
|
|
@ -0,0 +1,8 @@
|
|||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
function App() {
|
||||
return <p>Hello, World!</p>;
|
||||
}
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById("root"));
|
|
@ -0,0 +1,2 @@
|
|||
node_modules
|
||||
worker
|
|
@ -0,0 +1,70 @@
|
|||
import {
|
||||
getAssetFromKV,
|
||||
MethodNotAllowedError,
|
||||
NotFoundError,
|
||||
serveSinglePageApp,
|
||||
} from "@cloudflare/kv-asset-handler";
|
||||
|
||||
const DAY = 86400;
|
||||
const YEAR = DAY * 365;
|
||||
|
||||
class HTTPError extends Error {
|
||||
constructor(status, message) {
|
||||
super(message);
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
function getCacheTTL(path) {
|
||||
// Match all paths with hashes in the filename
|
||||
// Eg. /blobluma.17155d19.png, but not /blobluma.png
|
||||
const isVersioned = /\/(?:[^/]+\.){2}[^/]+$/.test(path);
|
||||
|
||||
// As versioned assets will update their URLs when changed
|
||||
// We can return a very long (1 year) cache lifetime for these
|
||||
return isVersioned ? YEAR : DAY;
|
||||
}
|
||||
|
||||
export default async function getStaticAsset(event) {
|
||||
const path = new URL(event.request.url).pathname;
|
||||
|
||||
const cacheControl = {
|
||||
edgeTTL: DAY,
|
||||
browserTTL: getCacheTTL(path),
|
||||
};
|
||||
|
||||
try {
|
||||
return await getAssetFromKV(event, {
|
||||
cacheControl,
|
||||
mapRequestToAsset: serveSinglePageApp,
|
||||
});
|
||||
} catch (e) {
|
||||
if (e instanceof NotFoundError) {
|
||||
throw new HTTPError(404, "File not found.");
|
||||
} else if (e instanceof MethodNotAllowedError) {
|
||||
throw new HTTPError(405, "Method now allowed.");
|
||||
}
|
||||
|
||||
throw e; // Re-throw InternalError for debugging
|
||||
}
|
||||
}
|
||||
|
||||
async function handleEvent(event) {
|
||||
try {
|
||||
return await getStaticAsset(event);
|
||||
} catch (e) {
|
||||
if (!(e instanceof HTTPError)) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
const headers = {
|
||||
"Cache-Control": "no-cache",
|
||||
"Content-Type": "text/plain; charset=UTF-8",
|
||||
};
|
||||
return new Response(e.message, { headers, status: e.status });
|
||||
}
|
||||
}
|
||||
|
||||
addEventListener("fetch", (event) => {
|
||||
event.respondWith(handleEvent(event));
|
||||
});
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"name": "worker",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "1.0.0",
|
||||
"license": "AGPL-3.0",
|
||||
"dependencies": {
|
||||
"@cloudflare/kv-asset-handler": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@cloudflare/kv-asset-handler": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.1.0.tgz",
|
||||
"integrity": "sha512-sXZRw/Z5JJfi/nGh66SECSm5L2zomyf6f9O3nc5QOI11/R3W/4N+BPOecp/Dc8eL/q/Rwgb7lwhhjnqy8O5CYA==",
|
||||
"dependencies": {
|
||||
"@cloudflare/workers-types": "^2.0.0",
|
||||
"@types/mime": "^2.0.2",
|
||||
"mime": "^2.4.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@cloudflare/workers-types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-2.1.0.tgz",
|
||||
"integrity": "sha512-VmXaHTq0lt6Xre4aK1hUK25hjZjuEUkHtdUEt0FJamv+NzQO54Gwp6Zr5Cfu6SP5EQ/tTmTMP/tK9npA8zhcCg=="
|
||||
},
|
||||
"node_modules/@types/mime": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz",
|
||||
"integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q=="
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.5.0.tgz",
|
||||
"integrity": "sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag==",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudflare/kv-asset-handler": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.1.0.tgz",
|
||||
"integrity": "sha512-sXZRw/Z5JJfi/nGh66SECSm5L2zomyf6f9O3nc5QOI11/R3W/4N+BPOecp/Dc8eL/q/Rwgb7lwhhjnqy8O5CYA==",
|
||||
"requires": {
|
||||
"@cloudflare/workers-types": "^2.0.0",
|
||||
"@types/mime": "^2.0.2",
|
||||
"mime": "^2.4.6"
|
||||
}
|
||||
},
|
||||
"@cloudflare/workers-types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-2.1.0.tgz",
|
||||
"integrity": "sha512-VmXaHTq0lt6Xre4aK1hUK25hjZjuEUkHtdUEt0FJamv+NzQO54Gwp6Zr5Cfu6SP5EQ/tTmTMP/tK9npA8zhcCg=="
|
||||
},
|
||||
"@types/mime": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.3.tgz",
|
||||
"integrity": "sha512-Jus9s4CDbqwocc5pOAnh8ShfrnMcPHuJYzVcSUU7lrh8Ni5HuIqX3oilL86p3dlTrk0LzHRCgA/GQ7uNCw6l2Q=="
|
||||
},
|
||||
"mime": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-2.5.0.tgz",
|
||||
"integrity": "sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag=="
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "worker",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/SnowyLuma/Mousey.git"
|
||||
},
|
||||
"author": "Lilly Rose Berner <lilly@snowyluma.dev> (https://snowyluma.dev)",
|
||||
"license": "AGPL-3.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/SnowyLuma/Mousey/issues"
|
||||
},
|
||||
"homepage": "https://github.com/SnowyLuma/Mousey#readme",
|
||||
"dependencies": {
|
||||
"@cloudflare/kv-asset-handler": "^0.1.0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
name = "frontend"
|
||||
type = "webpack"
|
||||
account_id = "6e8f81ce0e8ba25c184fa66b5fea3ac1"
|
||||
workers_dev = false
|
||||
route = "https://mousey.app/*"
|
||||
zone_id = "f8de0f9058bde7873bba65185358924b"
|
||||
|
||||
[site]
|
||||
bucket = "dist/"
|
||||
entry-point = "worker"
|
Loading…
Reference in New Issue