mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
feat: use npm and nix flake
This commit is contained in:
parent
b8c94ebc0b
commit
1e1a02fb99
9 changed files with 9810 additions and 5603 deletions
|
@ -10,7 +10,7 @@ dist/
|
||||||
logs/
|
logs/
|
||||||
|
|
||||||
package.json
|
package.json
|
||||||
yarn.lock
|
package-lock.json
|
||||||
robots.txt
|
robots.txt
|
||||||
\.licenseignore
|
\.licenseignore
|
||||||
\.woodpecker.yml
|
\.woodpecker.yml
|
||||||
|
|
|
@ -3,9 +3,9 @@ FROM node:20-alpine as builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN yarn --pure-lockfile
|
RUN npm ci
|
||||||
RUN yarn run build:server
|
RUN npm run build:server
|
||||||
RUN yarn run build:static
|
RUN npm run build:static
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|
28
README.md
28
README.md
|
@ -15,13 +15,13 @@ Self-hosting Keyoxide is an important aspect of the project. Users need to trust
|
||||||
|
|
||||||
### Docker
|
### 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
|
```sh
|
||||||
docker run -d -p 3000:3000 codeberg.org/keyoxide/keyoxide-web:latest
|
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/).
|
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)
|
- using [nvm](https://github.com/nvm-sh/nvm)
|
||||||
- directly from their [website](https://nodejs.org/)
|
- 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
|
## Contributing
|
||||||
|
|
||||||
|
|
61
flake.lock
Normal file
61
flake.lock
Normal 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
28
flake.nix
Normal 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
9688
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -48,14 +48,15 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./",
|
"start": "node ./",
|
||||||
"dev": "LOG_LEVEL=debug yarn run watch & yarn run build:static:dev",
|
"dev": "LOG_LEVEL=debug npm run watch & npm run build:static:dev",
|
||||||
"test": "yarn run lint && mocha",
|
"pretest": "npm run lint",
|
||||||
|
"test": "mocha",
|
||||||
"watch": "nodemon --config nodemon.json ./",
|
"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:server": "ncc build ./src/index.js -o dist",
|
||||||
"build:static": "webpack --config webpack.config.js --env static=true --env mode=production",
|
"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",
|
"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:check": "biome check ./src && biome lint ./src",
|
||||||
"biome:fix": "biome check --apply ./src && biome lint --apply ./src",
|
"biome:fix": "biome check --apply ./src && biome lint --apply ./src",
|
||||||
"standard:check": "standard ./src",
|
"standard:check": "standard ./src",
|
||||||
|
|
16
shell.nix
16
shell.nix
|
@ -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";
|
|
||||||
}
|
|
Loading…
Reference in a new issue