clan-ui: remove intermediate app directory
12
.gitignore
vendored
@@ -48,9 +48,9 @@ dist
|
|||||||
select
|
select
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
pkgs/ui/webview-ui/app/api/API.json
|
pkgs/clan-app/ui/api/API.json
|
||||||
pkgs/ui/webview-ui/app/api/API.ts
|
pkgs/clan-app/ui/api/API.ts
|
||||||
pkgs/ui/webview-ui/app/api/Inventory.ts
|
pkgs/clan-app/ui/api/Inventory.ts
|
||||||
pkgs/ui/webview-ui/app/api/modules_schemas.json
|
pkgs/clan-app/ui/api/modules_schemas.json
|
||||||
pkgs/ui/webview-ui/app/api/schema.json
|
pkgs/clan-app/ui/api/schema.json
|
||||||
pkgs/ui/webview-ui/app/.fonts
|
pkgs/clan-app/ui/.fonts
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ pkgs.stdenv.mkDerivation {
|
|||||||
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
|
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
|
||||||
|
|
||||||
# Copy icons into place
|
# 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 = ''
|
buildPhase = ''
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ A powerful application that allows users to create and manage their own Clans.
|
|||||||
|
|
||||||
## Getting Started
|
## 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
|
```console
|
||||||
❯ direnv allow
|
❯ 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:
|
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),
|
* `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.
|
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
|
This will start the [webview] window and bring `clan-app`'s terminal into the foreground, allowing for interaction with
|
||||||
the debugger if required.
|
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**
|
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
|
```bash
|
||||||
npm install
|
npm install
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eux -o pipefail
|
||||||
|
|
||||||
script_dir=$(dirname "$(readlink -f "$0")")
|
script_dir=$(dirname "$(readlink -f "$0")")
|
||||||
|
|
||||||
clan_cli="$script_dir/../../clan-cli"
|
clan_cli="$script_dir/../clan-cli"
|
||||||
|
|
||||||
trap 'rm -rf "$tmpdir"' EXIT
|
trap 'rm -rf "$tmpdir"' EXIT
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
|
|
||||||
set -x
|
|
||||||
python "$clan_cli/api.py" > "$tmpdir/API.json"
|
python "$clan_cli/api.py" > "$tmpdir/API.json"
|
||||||
json2ts --input "$tmpdir/API.json" > "$tmpdir/API.ts"
|
json2ts --input "$tmpdir/API.json" > "$tmpdir/API.ts"
|
||||||
|
|
||||||
# compare sha256 sums of old and new 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)
|
new_api_hash=$(sha256sum "$tmpdir/API.ts" | cut -d ' ' -f 1)
|
||||||
if [ "$old_api_hash" != "$new_api_hash" ]; then
|
if [ "$old_api_hash" != "$new_api_hash" ]; then
|
||||||
cp "$tmpdir/API.json" "$script_dir/../app/api/API.json"
|
cp "$tmpdir/API.json" "$script_dir/../api/API.json"
|
||||||
cp "$tmpdir/API.ts" "$script_dir/../app/api/API.ts"
|
cp "$tmpdir/API.ts" "$script_dir/../api/API.ts"
|
||||||
fi
|
fi
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
"path": "../../lib/build-clan"
|
"path": "../../lib/build-clan"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../webview-ui"
|
"path": "./ui"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../webview-lib"
|
"path": "./webview-lib"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "../clan-cli/clan_lib"
|
"path": "../clan-cli/clan_lib"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
copyDesktopItems,
|
copyDesktopItems,
|
||||||
clan-cli,
|
clan-cli,
|
||||||
makeDesktopItem,
|
makeDesktopItem,
|
||||||
webview-ui,
|
clan-app-ui,
|
||||||
webview-lib,
|
webview-lib,
|
||||||
fontconfig,
|
fontconfig,
|
||||||
pythonRuntime,
|
pythonRuntime,
|
||||||
@@ -146,7 +146,7 @@ pythonRuntime.pkgs.buildPythonApplication {
|
|||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/${pythonRuntime.sitePackages}/clan_app/.webui
|
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
|
mkdir -p $out/share/icons/hicolor
|
||||||
cp -r ./clan_app/assets/white-favicons/* $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 =
|
perSystem =
|
||||||
{
|
{
|
||||||
self',
|
self',
|
||||||
@@ -17,15 +13,22 @@
|
|||||||
|
|
||||||
devShells.clan-app = pkgs.callPackage ./shell.nix {
|
devShells.clan-app = pkgs.callPackage ./shell.nix {
|
||||||
inherit self';
|
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;
|
inherit (config.packages) clan-ts-api;
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.clan-app = pkgs.callPackage ./default.nix {
|
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;
|
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;
|
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"
|
version: "0.5"
|
||||||
|
|
||||||
processes:
|
processes:
|
||||||
webview-ui:
|
clan-app-ui:
|
||||||
command: |
|
command: |
|
||||||
cd $(git rev-parse --show-toplevel)/pkgs/clan-app/webview-ui/app
|
cd $(git rev-parse --show-toplevel)/pkgs/clan-app/ui
|
||||||
direnv allow
|
npm install
|
||||||
direnv exec . npm install
|
vite
|
||||||
direnv exec . vite
|
|
||||||
ready_log_line: "VITE"
|
ready_log_line: "VITE"
|
||||||
|
|
||||||
clan-app:
|
clan-app:
|
||||||
@@ -14,7 +13,7 @@ processes:
|
|||||||
cd $(git rev-parse --show-toplevel)/pkgs/clan-app
|
cd $(git rev-parse --show-toplevel)/pkgs/clan-app
|
||||||
./bin/clan-app --debug --content-uri http://localhost:3000
|
./bin/clan-app --debug --content-uri http://localhost:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
webview-ui:
|
clan-app-ui:
|
||||||
condition: "process_log_ready"
|
condition: "process_log_ready"
|
||||||
is_foreground: true
|
is_foreground: true
|
||||||
ready_log_line: "Debug mode enabled"
|
ready_log_line: "Debug mode enabled"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
mkShell,
|
mkShell,
|
||||||
ruff,
|
ruff,
|
||||||
webview-lib,
|
webview-lib,
|
||||||
webview-ui,
|
clan-app-ui,
|
||||||
clan-ts-api,
|
clan-ts-api,
|
||||||
process-compose,
|
process-compose,
|
||||||
python3,
|
python3,
|
||||||
@@ -16,7 +16,7 @@ mkShell {
|
|||||||
|
|
||||||
inputsFrom = [
|
inputsFrom = [
|
||||||
self'.devShells.default
|
self'.devShells.default
|
||||||
webview-ui
|
clan-app-ui
|
||||||
];
|
];
|
||||||
|
|
||||||
packages = [
|
packages = [
|
||||||
@@ -59,8 +59,8 @@ mkShell {
|
|||||||
popd
|
popd
|
||||||
|
|
||||||
## Webview UI
|
## Webview UI
|
||||||
# Add webview-ui scripts to PATH
|
# Add clan-app-ui scripts to PATH
|
||||||
pushd "$CLAN_CORE_PATH/pkgs/clan-app/webview-ui/app"
|
pushd "$CLAN_CORE_PATH/pkgs/clan-app/ui"
|
||||||
export NODE_PATH="$(pwd)/node_modules"
|
export NODE_PATH="$(pwd)/node_modules"
|
||||||
export PATH="$NODE_PATH/.bin:$(pwd)/bin:$PATH"
|
export PATH="$NODE_PATH/.bin:$(pwd)/bin:$PATH"
|
||||||
cp -r ${self'.packages.fonts} .fonts
|
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",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@clan/webview-ui",
|
"name": "@clan/ui",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "@clan/webview-ui",
|
"name": "@clan/ui",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||