Compare commits

..

2 commits
dev ... npm-nix

Author SHA1 Message Date
Yarmo Mackenbach
bda71db95d
feat: improve CI config 2024-06-14 10:03:33 +02:00
Yarmo Mackenbach
1e1a02fb99
feat: use npm and nix flake 2024-06-14 10:03:33 +02:00
16 changed files with 9861 additions and 8270 deletions

11
.gitignore vendored
View file

@ -33,13 +33,4 @@ node_modules
ignore
dist
static
logs
# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
logs

View file

@ -10,7 +10,7 @@ dist/
logs/
package.json
yarn.lock
package-lock.json
robots.txt
\.licenseignore
\.woodpecker.yml

View file

@ -1,57 +0,0 @@
steps:
test:
image: node
commands:
- yarn --pure-lockfile
- yarn run test
build-latest-container:
when:
branch: main
event: tag
image: plugins/docker
settings:
registry: https://codeberg.org/v2
username:
from_secret: codeberg_username
password:
from_secret: codeberg_password
repo: codeberg.org/keyoxide/keyoxide-web
tags: latest
build_args_from_env:
- CI_COMMIT_SHA
- CI_COMMIT_BRANCH
build-tag-container:
when:
branch: main
event: tag
image: plugins/docker
settings:
registry: https://codeberg.org/v2
username:
from_secret: codeberg_username
password:
from_secret: codeberg_password
repo: codeberg.org/keyoxide/keyoxide-web
auto_tag: true
build_args_from_env:
- CI_COMMIT_SHA
- CI_COMMIT_BRANCH
build-dev-container:
when:
branch: dev
event: push
image: plugins/docker
settings:
registry: https://codeberg.org/v2
username:
from_secret: codeberg_username
password:
from_secret: codeberg_password
repo: codeberg.org/keyoxide/keyoxide-web
tags: dev
build_args_from_env:
- CI_COMMIT_SHA
- CI_COMMIT_BRANCH

View file

@ -0,0 +1,20 @@
when:
branch: dev
event: push
steps:
build-latest-container:
image: woodpeckerci/plugin-docker-buildx
settings:
registry: https://codeberg.org/v2
username:
from_secret: codeberg_username
password:
from_secret: codeberg_password
repo: codeberg.org/keyoxide/keyoxide-web
tag: dev
build_args_from_env:
- CI_COMMIT_SHA
- CI_COMMIT_BRANCH
depends_on:
- test

20
.woodpecker/.release.yml Normal file
View file

@ -0,0 +1,20 @@
when:
branch: main
event: tag
steps:
build-latest-container:
image: woodpeckerci/plugin-docker-buildx
settings:
registry: https://codeberg.org/v2
username:
from_secret: codeberg_username
password:
from_secret: codeberg_password
repo: codeberg.org/keyoxide/keyoxide-web
auto_tag: true
build_args_from_env:
- CI_COMMIT_SHA
- CI_COMMIT_BRANCH
depends_on:
- test

8
.woodpecker/.test.yml Normal file
View file

@ -0,0 +1,8 @@
when:
event: [push, pull_request, tag, release, manual]
steps:
test:
image: node:20
commands:
- npm ci
- npm test

View file

@ -1,4 +0,0 @@
nodeLinker: node-modules
npmScopes:
myriation:
npmRegistryServer: https://git.myriation.xyz/api/packages/myriation/npm/

View file

@ -3,9 +3,9 @@ FROM node:20-alpine as builder
WORKDIR /app
COPY . .
RUN corepack enable
RUN yarn install --immutable
RUN yarn run build:server && yarn run build:static
RUN npm ci
RUN npm run build:server
RUN npm run build:static
###

View file

@ -15,13 +15,13 @@ Self-hosting Keyoxide is an important aspect of the project. Users need to trust
### Docker
The Docker container allows you to easily self-host the [Keyoxide](https://keyoxide.org) project. To get started, simply run:
The Docker container allows you to easily self-host the [Keyoxide](https://keyoxide.org) project. To get started, run:
```sh
docker run -d -p 3000:3000 codeberg.org/keyoxide/keyoxide-web:latest
```
Keyoxide will now be available by visiting http://localhost:3000.
Keyoxide will now be available at [http://localhost:3000](localhost:3000).
More information available in the [documentation](https://docs.keyoxide.org/guides/self-hosting/).
@ -34,9 +34,29 @@ Install `node` in one of the following ways:
- using [nvm](https://github.com/nvm-sh/nvm)
- directly from their [website](https://nodejs.org/)
Install dependencies with `npm install` or `yarn`.
Install the dependencies and run the server:
Run the server with `npm dev` or `yarn dev`. The Keyoxide web client will now be available at [https://localhost:3000](https://localhost:3000).
```sh
npm install
npm run dev
```
The web client will now be available at [http://localhost:3000](localhost:3000).
### Using nix
Enter a development shell:
```sh
nix develop
npm run dev
```
Alternatively, start a local server directly:
```sh
nix develop --command bash -c "npm run dev"
```
## Contributing

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1717144377,
"narHash": "sha256-F/TKWETwB5RaR8owkPPi+SPJh83AQsm6KrQAlJ8v/uA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "805a384895c696f802a9bf5bf4720f37385df547",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

28
flake.nix Normal file
View file

@ -0,0 +1,28 @@
{
description = "keyoxide-web";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, utils }:
utils.lib.eachDefaultSystem (system:
let
name = "keyoxide-web";
pkgs = import nixpkgs { inherit system; };
in
{
# nix develop
devShell = with pkgs; mkShell {
buildInputs = [
nodejs_20
];
shellHook = ''
echo "node: `${nodejs_20}/bin/node --version`"
echo "npm: `${nodejs_20}/bin/npm --version`"
'';
};
});
}

9688
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -4,13 +4,12 @@
"description": "Verifying online identity with cryptography",
"main": "./src/index.js",
"type": "module",
"packageManager": "yarn@3.6.1",
"dependencies": {
"ajv": "^8.6.3",
"bent": "^7.3.12",
"body-parser": "^1.19.0",
"colorjs.io": "^0.4.5",
"doipjs": "npm:@myriation/doipjs@1.2.9+myriation.1",
"doipjs": "^1.2.9",
"dotenv": "^16.0.3",
"express": "^4.17.1",
"express-http-context2": "^1.0.0",
@ -49,14 +48,15 @@
},
"scripts": {
"start": "node ./",
"dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev",
"test": "yarn run lint && mocha",
"dev": "LOG_LEVEL=debug npm run watch & npm run build:static:dev",
"pretest": "npm run lint",
"test": "mocha",
"watch": "nodemon --config nodemon.json ./",
"build": "yarn run build:server && yarn run build:static",
"build": "npm run build:server && npm run build:static",
"build:server": "ncc build ./src/index.js -o dist",
"build:static": "webpack --config webpack.config.js --env static=true --env mode=production",
"build:static:dev": "webpack --config webpack.config.js --env static=true --env mode=development",
"lint": "yarn run standard:check && yarn run biome:check",
"lint": "npm run standard:check && npm run biome:check",
"biome:check": "biome check ./src && biome lint ./src",
"biome:fix": "biome check --apply ./src && biome lint --apply ./src",
"standard:check": "standard ./src",

View file

@ -1,16 +0,0 @@
{ pkgs ? import <nixpkgs> {}}:
let
unstable = import (fetchTarball "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz") {};
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
yarn
xvfb_run
unstable.cypress
];
CYPRESS_INSTALL_BINARY=0; #skip installing the Cypress binary from yarn
CYPRESS_RUN_BINARY="${unstable.cypress}/bin/Cypress";
}

View file

@ -42,12 +42,7 @@ const opts = {
privateKey: process.env.ACTIVITYPUB_PRIVATE_KEY || null
},
irc: {
nick: process.env.IRC_NICK || null,
sasl: Object.keys(process.env).filter(k => k.startsWith('IRC_SASL_USERNAME_')).map(k => ({
username: process.env[k],
password: process.env[`IRC_SASL_PASSWORD_${k.substring('IRC_SASL_USERNAME_'.length)}`],
domainRegex: process.env[`IRC_SASL_DOMAIN_REGEX_${k.substring('IRC_SASL_USERNAME_'.length)}`]
}))
nick: process.env.IRC_NICK || null
},
matrix: {
instance: process.env.MATRIX_INSTANCE || null,

8163
yarn.lock

File diff suppressed because it is too large Load diff