clan-ui: remove intermediate app directory
12
.gitignore
vendored
@@ -48,9 +48,9 @@ dist
|
||||
select
|
||||
|
||||
# Generated files
|
||||
pkgs/ui/webview-ui/app/api/API.json
|
||||
pkgs/ui/webview-ui/app/api/API.ts
|
||||
pkgs/ui/webview-ui/app/api/Inventory.ts
|
||||
pkgs/ui/webview-ui/app/api/modules_schemas.json
|
||||
pkgs/ui/webview-ui/app/api/schema.json
|
||||
pkgs/ui/webview-ui/app/.fonts
|
||||
pkgs/clan-app/ui/api/API.json
|
||||
pkgs/clan-app/ui/api/API.ts
|
||||
pkgs/clan-app/ui/api/Inventory.ts
|
||||
pkgs/clan-app/ui/api/modules_schemas.json
|
||||
pkgs/clan-app/ui/api/schema.json
|
||||
pkgs/clan-app/ui/.fonts
|
||||
|
||||
@@ -45,7 +45,7 @@ pkgs.stdenv.mkDerivation {
|
||||
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
|
||||
|
||||
# Copy icons into place
|
||||
cp -af ../pkgs/clan-app/webview-ui/app/icons ./site/static/
|
||||
cp -af ../pkgs/clan-app/ui/icons ./site/static/
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
|
||||
@@ -4,7 +4,7 @@ A powerful application that allows users to create and manage their own Clans.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Enter the `pkgs/ui` directory and allow [direnv] to load the `ui` devshell with `direnv allow`:
|
||||
Enter the `pkgs/clan-app` directory and allow [direnv] to load the `clan-app` devshell with `direnv allow`:
|
||||
|
||||
```console
|
||||
❯ direnv allow
|
||||
@@ -27,11 +27,11 @@ Once that has loaded, you can run the local dev environment by running `process-
|
||||
|
||||
This will start a [process-compose] instance containing two processes:
|
||||
|
||||
* `webview-ui` which is a background process running a [vite] server for `./webview-ui` in a hot-reload fashion
|
||||
* `clan-app-ui` which is a background process running a [vite] server for `./ui` in a hot-reload fashion
|
||||
* `clan-app` which is a [foreground process](https://f1bonacc1.github.io/process-compose/launcher/?h=foreground#foreground-processes),
|
||||
that is started on demand and provides the [webview] wrapper for the UI.
|
||||
|
||||
Wait for the `webview-ui` process to enter the `Running` state, then navigate to the `clan-app` process and press `F7`.
|
||||
Wait for the `clan-app-ui` process to enter the `Running` state, then navigate to the `clan-app` process and press `F7`.
|
||||
This will start the [webview] window and bring `clan-app`'s terminal into the foreground, allowing for interaction with
|
||||
the debugger if required.
|
||||
|
||||
@@ -52,7 +52,7 @@ Follow the instructions below to set up your development environment and start t
|
||||
|
||||
1. **Navigate to the Webview UI Directory**
|
||||
|
||||
Go to the `clan-core/pkgs/clan-app/webview-ui/app` directory and start the web server by executing:
|
||||
Go to the `clan-core/pkgs/clan-app/ui` directory and start the web server by executing:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
script_dir=$(dirname "$(readlink -f "$0")")
|
||||
|
||||
clan_cli="$script_dir/../../clan-cli"
|
||||
clan_cli="$script_dir/../clan-cli"
|
||||
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
tmpdir=$(mktemp -d)
|
||||
|
||||
set -x
|
||||
python "$clan_cli/api.py" > "$tmpdir/API.json"
|
||||
json2ts --input "$tmpdir/API.json" > "$tmpdir/API.ts"
|
||||
|
||||
# compare sha256 sums of old and new API.ts
|
||||
old_api_hash=$(sha256sum "$script_dir/../app/api/API.ts" | cut -d ' ' -f 1)
|
||||
old_api_hash=$(sha256sum "$script_dir/../api/API.ts" | cut -d ' ' -f 1)
|
||||
new_api_hash=$(sha256sum "$tmpdir/API.ts" | cut -d ' ' -f 1)
|
||||
if [ "$old_api_hash" != "$new_api_hash" ]; then
|
||||
cp "$tmpdir/API.json" "$script_dir/../app/api/API.json"
|
||||
cp "$tmpdir/API.ts" "$script_dir/../app/api/API.ts"
|
||||
cp "$tmpdir/API.json" "$script_dir/../api/API.json"
|
||||
cp "$tmpdir/API.ts" "$script_dir/../api/API.ts"
|
||||
fi
|
||||
@@ -16,10 +16,10 @@
|
||||
"path": "../../lib/build-clan"
|
||||
},
|
||||
{
|
||||
"path": "../webview-ui"
|
||||
"path": "./ui"
|
||||
},
|
||||
{
|
||||
"path": "../webview-lib"
|
||||
"path": "./webview-lib"
|
||||
},
|
||||
{
|
||||
"path": "../clan-cli/clan_lib"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
copyDesktopItems,
|
||||
clan-cli,
|
||||
makeDesktopItem,
|
||||
webview-ui,
|
||||
clan-app-ui,
|
||||
webview-lib,
|
||||
fontconfig,
|
||||
pythonRuntime,
|
||||
@@ -146,7 +146,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/${pythonRuntime.sitePackages}/clan_app/.webui
|
||||
cp -r ${webview-ui}/lib/node_modules/@clan/webview-ui/dist/* $out/${pythonRuntime.sitePackages}/clan_app/.webui
|
||||
cp -r ${clan-app-ui}/lib/node_modules/@clan/ui/dist/* $out/${pythonRuntime.sitePackages}/clan_app/.webui
|
||||
mkdir -p $out/share/icons/hicolor
|
||||
cp -r ./clan_app/assets/white-favicons/* $out/share/icons/hicolor
|
||||
'';
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
{
|
||||
imports = [
|
||||
./webview-ui/flake-module.nix
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{
|
||||
self',
|
||||
@@ -17,15 +13,22 @@
|
||||
|
||||
devShells.clan-app = pkgs.callPackage ./shell.nix {
|
||||
inherit self';
|
||||
inherit (self'.packages) clan-app webview-lib webview-ui;
|
||||
inherit (self'.packages) clan-app webview-lib clan-app-ui;
|
||||
inherit (config.packages) clan-ts-api;
|
||||
};
|
||||
|
||||
packages.clan-app = pkgs.callPackage ./default.nix {
|
||||
inherit (config.packages) clan-cli webview-ui webview-lib;
|
||||
inherit (config.packages) clan-cli clan-app-ui webview-lib;
|
||||
pythonRuntime = pkgs.python3;
|
||||
};
|
||||
|
||||
packages.fonts = pkgs.callPackage ./fonts.nix { };
|
||||
|
||||
packages.clan-app-ui = pkgs.callPackage ./ui.nix {
|
||||
clan-ts-api = config.packages.clan-ts-api;
|
||||
fonts = config.packages.fonts;
|
||||
};
|
||||
|
||||
checks = config.packages.clan-app.tests;
|
||||
};
|
||||
}
|
||||
|
||||
24
pkgs/clan-app/fonts.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ fetchurl, runCommand }:
|
||||
let
|
||||
# 400 -> Regular
|
||||
archivoRegular = fetchurl {
|
||||
url = "https://github.com/Omnibus-Type/Archivo/raw/b5d63988ce19d044d3e10362de730af00526b672/fonts/webfonts/ArchivoSemiCondensed-Regular.woff2";
|
||||
hash = "sha256-3PeB6tMpbYxR9JFyQ+yjpM7bAvZIjcJ4eBiHr9iV5p4=";
|
||||
};
|
||||
# 500 -> Medium
|
||||
archivoMedium = fetchurl {
|
||||
url = "https://github.com/Omnibus-Type/Archivo/raw/b5d63988ce19d044d3e10362de730af00526b672/fonts/webfonts/ArchivoSemiCondensed-Medium.woff2";
|
||||
hash = "sha256-IKaY3YhpmjMaIVUpwKRLd6eFiIihBoAP99I/pwmyll8=";
|
||||
};
|
||||
# 600 -> SemiBold
|
||||
archivoSemiBold = fetchurl {
|
||||
url = "https://github.com/Omnibus-Type/Archivo/raw/b5d63988ce19d044d3e10362de730af00526b672/fonts/webfonts/ArchivoSemiCondensed-SemiBold.woff2";
|
||||
hash = "sha256-fOE+b+UeTRoj+sDdUWR1pPCZVn0ABy6FEDDmXrOA4LY=";
|
||||
};
|
||||
in
|
||||
runCommand "" { } ''
|
||||
mkdir -p $out
|
||||
cp ${archivoRegular} $out/ArchivoSemiCondensed-Regular.woff2
|
||||
cp ${archivoMedium} $out/ArchivoSemiCondensed-Medium.woff2
|
||||
cp ${archivoSemiBold} $out/ArchivoSemiCondensed-SemiBold.woff2
|
||||
''
|
||||
@@ -1,12 +1,11 @@
|
||||
version: "0.5"
|
||||
|
||||
processes:
|
||||
webview-ui:
|
||||
clan-app-ui:
|
||||
command: |
|
||||
cd $(git rev-parse --show-toplevel)/pkgs/clan-app/webview-ui/app
|
||||
direnv allow
|
||||
direnv exec . npm install
|
||||
direnv exec . vite
|
||||
cd $(git rev-parse --show-toplevel)/pkgs/clan-app/ui
|
||||
npm install
|
||||
vite
|
||||
ready_log_line: "VITE"
|
||||
|
||||
clan-app:
|
||||
@@ -14,7 +13,7 @@ processes:
|
||||
cd $(git rev-parse --show-toplevel)/pkgs/clan-app
|
||||
./bin/clan-app --debug --content-uri http://localhost:3000
|
||||
depends_on:
|
||||
webview-ui:
|
||||
clan-app-ui:
|
||||
condition: "process_log_ready"
|
||||
is_foreground: true
|
||||
ready_log_line: "Debug mode enabled"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
mkShell,
|
||||
ruff,
|
||||
webview-lib,
|
||||
webview-ui,
|
||||
clan-app-ui,
|
||||
clan-ts-api,
|
||||
process-compose,
|
||||
python3,
|
||||
@@ -16,7 +16,7 @@ mkShell {
|
||||
|
||||
inputsFrom = [
|
||||
self'.devShells.default
|
||||
webview-ui
|
||||
clan-app-ui
|
||||
];
|
||||
|
||||
packages = [
|
||||
@@ -59,8 +59,8 @@ mkShell {
|
||||
popd
|
||||
|
||||
## Webview UI
|
||||
# Add webview-ui scripts to PATH
|
||||
pushd "$CLAN_CORE_PATH/pkgs/clan-app/webview-ui/app"
|
||||
# Add clan-app-ui scripts to PATH
|
||||
pushd "$CLAN_CORE_PATH/pkgs/clan-app/ui"
|
||||
export NODE_PATH="$(pwd)/node_modules"
|
||||
export PATH="$NODE_PATH/.bin:$(pwd)/bin:$PATH"
|
||||
cp -r ${self'.packages.fonts} .fonts
|
||||
|
||||
25
pkgs/clan-app/ui.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
buildNpmPackage,
|
||||
nodejs_20,
|
||||
importNpmLock,
|
||||
|
||||
clan-ts-api,
|
||||
fonts,
|
||||
}:
|
||||
buildNpmPackage {
|
||||
pname = "clan-app-ui";
|
||||
version = "0.0.1";
|
||||
nodejs = nodejs_20;
|
||||
src = ./ui;
|
||||
|
||||
npmDeps = importNpmLock {
|
||||
npmRoot = ./ui;
|
||||
};
|
||||
npmConfigHook = importNpmLock.npmConfigHook;
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p api
|
||||
cp -r ${clan-ts-api}/* api
|
||||
cp -r ${fonts} ".fonts"
|
||||
'';
|
||||
}
|
||||
|
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
|
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
|
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 373 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
|
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 355 B |
|
Before Width: | Height: | Size: 400 B After Width: | Height: | Size: 400 B |
|
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 260 B After Width: | Height: | Size: 260 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 363 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 206 B After Width: | Height: | Size: 206 B |
|
Before Width: | Height: | Size: 319 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "@clan/webview-ui",
|
||||
"name": "@clan/ui",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@clan/webview-ui",
|
||||
"name": "@clan/ui",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@clan/webview-ui",
|
||||
"name": "@clan/ui",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"type": "module",
|
||||