Browse Source

Merge branch 'master' into branch 'Issue#188'

master
Michael J 1 year ago
parent
commit
bd359a7f9c
No known key found for this signature in database
GPG Key ID: 962BEC8725790894
  1. 15
      .dockerignore
  2. 5
      .gitignore
  3. 15
      Dockerfile.local
  4. 15
      Dockerfile.next
  5. 15
      Dockerfile.prod
  6. 44
      README.md
  7. 1078
      bun.lock
  8. 7
      deno.json
  9. 2905
      deno.lock
  10. 18
      import_map.json
  11. 114
      package-lock.json
  12. 5
      package.json
  13. 12
      svelte.config.js

15
.dockerignore

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
node_modules
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
README.md
LICENSE
.vscode
Makefile
helm-charts
.env
.editorconfig
.idea
coverage*

5
.gitignore vendored

@ -13,3 +13,8 @@ package-lock.json @@ -13,3 +13,8 @@ package-lock.json
# tests
/tests/e2e/html-report/*.html
/tests/e2e/test-results/*.last-run.json
# Deno
/.deno/
/deno_dir/
/import_map.lock.json

15
Dockerfile.local

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
FROM denoland/deno:alpine AS build
WORKDIR /app/src
COPY . .
RUN deno install
RUN deno task build
FROM denoland/deno:alpine AS release
WORKDIR /app
COPY --from=build /app/src/build/ ./build/
COPY --from=build /app/src/import_map.json .
ENV ORIGIN=http://localhost:3000
EXPOSE 3000
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ]

15
Dockerfile.next

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
FROM denoland/deno:alpine AS build
WORKDIR /app/src
COPY . .
RUN deno install
RUN deno task build
FROM denoland/deno:alpine AS release
WORKDIR /app
COPY --from=build /app/src/build/ ./build/
COPY --from=build /app/src/import_map.json .
ENV ORIGIN=https://$HOST
EXPOSE 3000
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ]

15
Dockerfile.prod

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
FROM denoland/deno:alpine AS build
WORKDIR /app/src
COPY . .
RUN deno install
RUN deno task build
FROM denoland/deno:alpine AS release
WORKDIR /app
COPY --from=build /app/src/build/ ./build/
COPY --from=build /app/src/import_map.json .
ENV ORIGIN=https://$HOST
EXPOSE 3000
CMD [ "deno", "run", "--allow-env", "--allow-read", "--allow-net", "--import-map=import_map.json", "./build/index.js" ]

44
README.md

@ -11,38 +11,52 @@ If you would like to suggest a feature or report a bug, or submit a patch for re @@ -11,38 +11,52 @@ If you would like to suggest a feature or report a bug, or submit a patch for re
## Developing
Make sure that you have [Node.js](https://nodejs.org/en/download/package-manager) installed.
Once you've cloned this repo, install dependencies with:
Make sure that you have [Node.js](https://nodejs.org/en/download/package-manager) (v22 or above) or [Deno](https://docs.deno.com/runtime/getting_started/installation/) (v2) installed.
Once you've cloned this repo, install dependencies with NPM:
```bash
npm install
```
then start a development server:
or with Deno:
```bash
deno install
```
then start a development server with Node:
```bash
npm run dev
```
or start the server and open the app in a new browser tab:
or with Deno:
```bash
npm run dev -- --open
deno task dev
```
## Building
> We have configured Alexandria to use the static adapter. To deploy your app with a different adapter, you will need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
Alexandria is configured to run on a Node server. The [Node adapter](https://svelte.dev/docs/kit/adapter-node) works on Deno as well.
To build a production version of your app, as a static site:
To build a production version of your app with Node, use:
```bash
npm run build
```
or with Deno:
```bash
deno task build
```
You can preview the (non-static) production build with:
```bash
npm run preview
```
or with Deno:
```bash
deno task preview
```
## Docker
This docker container performs the build.
@ -72,6 +86,20 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS @@ -72,6 +86,20 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
1d83d736322f gc-alexandria "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:4174->80/tcp, [::]:4174->80/tcp gc-alexandria
```
## Docker + Deno
This application is configured to use the Deno runtime. A Docker container is provided to handle builds and deployments.
To build the app for local development:
```bash
docker build -t local-alexandria -f Dockerfile.local .
```
To run the local development build:
```bash
docker run -d -p 3000:3000 local-alexandria
```
## Testing
*These tests are under development, but will run. They will later be added to the container.*

1078
bun.lock

File diff suppressed because it is too large Load Diff

7
deno.json

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
{
"importMap": "./import_map.json",
"compilerOptions": {
"allowJs": true,
"lib": ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
}
}

2905
deno.lock

File diff suppressed because it is too large Load Diff

18
import_map.json

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
{
"imports": {
"he": "npm:he@1.2.x",
"@nostr-dev-kit/ndk": "npm:@nostr-dev-kit/ndk@2.11.x",
"@nostr-dev-kit/ndk-cache-dexie": "npm:@nostr-dev-kit/ndk-cache-dexie@2.5.x",
"@popperjs/core": "npm:@popperjs/core@2.11.x",
"@tailwindcss/forms": "npm:@tailwindcss/forms@0.5.x",
"@tailwindcss/typography": "npm:@tailwindcss/typography@0.5.x",
"asciidoctor": "npm:asciidoctor@3.0.x",
"d3": "npm:d3@7.9.x",
"nostr-tools": "npm:nostr-tools@2.10.x",
"tailwind-merge": "npm:tailwind-merge@2.5.x",
"svelte": "npm:svelte@5.0.x",
"flowbite": "npm:flowbite@2.2.x",
"flowbite-svelte": "npm:flowbite-svelte@0.44.x",
"flowbite-svelte-icons": "npm:flowbite-svelte-icons@2.0.x"
}
}

114
package-lock.json generated

@ -16,12 +16,12 @@ @@ -16,12 +16,12 @@
"asciidoctor": "3.0.x",
"d3": "^7.9.0",
"he": "1.2.x",
"nostr-tools": "2.10.x",
"playwright": "^1.50.1"
"nostr-tools": "2.10.x"
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@sveltejs/adapter-auto": "3.x",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/adapter-static": "3.x",
"@sveltejs/kit": "2.x",
"@sveltejs/vite-plugin-svelte": "4.x",
@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
"flowbite": "2.x",
"flowbite-svelte": "0.x",
"flowbite-svelte-icons": "2.x",
"playwright": "^1.50.1",
"postcss": "8.x",
"postcss-load-config": "6.x",
"prettier": "3.x",
@ -1125,6 +1126,64 @@ @@ -1125,6 +1126,64 @@
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@rollup/plugin-commonjs": {
"version": "28.0.2",
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.2.tgz",
"integrity": "sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"commondir": "^1.0.1",
"estree-walker": "^2.0.2",
"fdir": "^6.2.0",
"is-reference": "1.2.1",
"magic-string": "^0.30.3",
"picomatch": "^4.0.2"
},
"engines": {
"node": ">=16.0.0 || 14 >= 14.17"
},
"peerDependencies": {
"rollup": "^2.68.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/plugin-commonjs/node_modules/is-reference": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz",
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "*"
}
},
"node_modules/@rollup/plugin-json": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz",
"integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.1.0"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@rollup/plugin-node-resolve": {
"version": "15.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz",
@ -1316,6 +1375,47 @@ @@ -1316,6 +1375,47 @@
"@sveltejs/kit": "^2.0.0"
}
},
"node_modules/@sveltejs/adapter-node": {
"version": "5.2.12",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-5.2.12.tgz",
"integrity": "sha512-0bp4Yb3jKIEcZWVcJC/L1xXp9zzJS4hDwfb4VITAkfT4OVdkspSHsx7YhqJDbb2hgLl6R9Vs7VQR+fqIVOxPUQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"rollup": "^4.9.5"
},
"peerDependencies": {
"@sveltejs/kit": "^2.4.0"
}
},
"node_modules/@sveltejs/adapter-node/node_modules/@rollup/plugin-node-resolve": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.0.tgz",
"integrity": "sha512-0FPvAeVUT/zdWoO0jnb/V5BlBsUSNfkIOtFHzMO4H9MOklrmQFY6FduVHKucNb/aTFxvnGhj4MNj/T1oNdDfNg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@rollup/pluginutils": "^5.0.1",
"@types/resolve": "1.20.2",
"deepmerge": "^4.2.2",
"is-module": "^1.0.0",
"resolve": "^1.22.1"
},
"engines": {
"node": ">=14.0.0"
},
"peerDependencies": {
"rollup": "^2.78.0||^3.0.0||^4.0.0"
},
"peerDependenciesMeta": {
"rollup": {
"optional": true
}
}
},
"node_modules/@sveltejs/adapter-static": {
"version": "3.0.8",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.8.tgz",
@ -2154,6 +2254,13 @@ @@ -2154,6 +2254,13 @@
"node": ">= 6"
}
},
"node_modules/commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
"integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
"dev": true,
"license": "MIT"
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@ -4708,6 +4815,7 @@ @@ -4708,6 +4815,7 @@
"version": "1.50.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.50.1.tgz",
"integrity": "sha512-G8rwsOQJ63XG6BbKj2w5rHeavFjy5zynBA9zsJMMtBoe/Uf757oG12NXz6e6OirF7RCrTVAKFXbLmn1RbL7Qaw==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"playwright-core": "1.50.1"
@ -4726,6 +4834,7 @@ @@ -4726,6 +4834,7 @@
"version": "1.50.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.50.1.tgz",
"integrity": "sha512-ra9fsNWayuYumt+NiM069M6OkcRb1FZSK8bgi66AtpFoWkg2+y0bJSNmkFrWhMbEBbVKC/EruAHH3g0zmtwGmQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"playwright-core": "cli.js"
@ -4738,6 +4847,7 @@ @@ -4738,6 +4847,7 @@
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,

5
package.json

@ -22,12 +22,12 @@ @@ -22,12 +22,12 @@
"asciidoctor": "3.0.x",
"d3": "^7.9.0",
"he": "1.2.x",
"nostr-tools": "2.10.x",
"playwright": "^1.50.1"
"nostr-tools": "2.10.x"
},
"devDependencies": {
"@playwright/test": "^1.50.1",
"@sveltejs/adapter-auto": "3.x",
"@sveltejs/adapter-node": "^5.2.12",
"@sveltejs/adapter-static": "3.x",
"@sveltejs/kit": "2.x",
"@sveltejs/vite-plugin-svelte": "4.x",
@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
"flowbite": "2.x",
"flowbite-svelte": "0.x",
"flowbite-svelte-icons": "2.x",
"playwright": "^1.50.1",
"postcss": "8.x",
"postcss-load-config": "6.x",
"prettier": "3.x",

12
svelte.config.js

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import adapter from "@sveltejs/adapter-static";
import adapter from "@sveltejs/adapter-node";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
@ -8,14 +8,8 @@ const config = { @@ -8,14 +8,8 @@ const config = {
preprocess: [vitePreprocess()],
kit: {
// Static adapter
adapter: adapter({
pages: "build",
assets: "build",
fallback: "index.html",
precompress: false,
strict: true,
}),
// Deno adapter
adapter: adapter(),
alias: {
$lib: "src/lib",
$components: "src/lib/components",

Loading…
Cancel
Save