From 1da81089cd0742b7a16e230dddb2e87809e4f83f Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 11 Jan 2026 15:51:42 -0600 Subject: [PATCH 1/4] Add sync.sh script This downloads and installs dependencies necessary to run or develop. Add docker-compose.yml for initial use --- framework/shims/node | 4 +-- framework/shims/node.common | 24 ++++++-------- framework/versions | 16 +++++++++ sync.sh | 66 +++++++++++++++++++++++++++++++++++++ 4 files changed, 93 insertions(+), 17 deletions(-) create mode 100644 framework/versions create mode 100755 sync.sh diff --git a/framework/shims/node b/framework/shims/node index 090bb9a..5ac98a8 100755 --- a/framework/shims/node +++ b/framework/shims/node @@ -5,10 +5,8 @@ set -eu node_shim_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -export node_shim_DIR - -source "$node_shim_DIR"/../versions +# shellcheck source=node.common source "$node_shim_DIR"/node.common exec "$nodejs_binary_dir/node" "$@" diff --git a/framework/shims/node.common b/framework/shims/node.common index c3253e1..3745766 100644 --- a/framework/shims/node.common +++ b/framework/shims/node.common @@ -2,23 +2,19 @@ # shellcheck shell=bash node_common_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +project_root="$node_common_DIR/../.." -# FIXME this shouldn't be hardcoded here of course -nodejs_binary_dir="$node_common_DIR/../binaries/node-v22.15.1-linux-x64/bin" +# shellcheck source=../versions +source "$node_common_DIR"/../versions + +nodejs_binary_dir="$project_root/$nodejs_bin_dir" # This might be too restrictive. Or not restrictive enough. PATH="$nodejs_binary_dir":/bin:/usr/bin -project_root="$node_common_DIR/../.." +node_dist_dir="$project_root/$nodejs_dist_dir" -node_dir="$project_root/$nodejs_binary_dir" - -export NPM_CONFIG_PREFIX="$node_dir/npm" -export NPM_CONFIG_CACHE="$node_dir/cache" -export NPM_CONFIG_TMP="$node_dir/tmp" -export NODE_PATH="$node_dir/node_modules" - -# echo $NPM_CONFIG_PREFIX -# echo $NPM_CONFIG_CACHE -# echo $NPM_CONFIG_TMP -# echo $NODE_PATH +export NPM_CONFIG_PREFIX="$node_dist_dir/npm" +export NPM_CONFIG_CACHE="$node_dist_dir/cache" +export NPM_CONFIG_TMP="$node_dist_dir/tmp" +export NODE_PATH="$node_dist_dir/node_modules" diff --git a/framework/versions b/framework/versions new file mode 100644 index 0000000..0177ebf --- /dev/null +++ b/framework/versions @@ -0,0 +1,16 @@ +# shellcheck shell=bash + +# This file belongs to the framework. You are not expected to modify it. + +nodejs_binary_linux_x86_64=https://nodejs.org/dist/v22.15.1/node-v22.15.1-linux-x64.tar.xz +nodejs_checksum_linux_x86_64=7dca2ab34ec817aa4781e2e99dfd34d349eff9be86e5d5fbaa7e96cae8ee3179 +nodejs_dist_dir=framework/binaries/node-v22.15.1-linux-x64 +nodejs_bin_dir="$nodejs_dist_dir/bin" + +caddy_binary_linux_x86_64=fixme +caddy_checksum_linux_x86_64=fixmetoo + +pnpm_binary_linux_x86_64=https://github.com/pnpm/pnpm/releases/download/v10.12.4/pnpm-linux-x64 +pnpm_checksum_linux_x86_64=sha256:ac2768434cbc6c5fec71da4abae7845802bbfe326d590aa0004cdf8bf0815b26 + +golangci_lint=v2.7.2-alpine \ No newline at end of file diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..5aa223d --- /dev/null +++ b/sync.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# Note: This is kind of AI slop and needs to be more carefully reviewed. + +set -eu + +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +# shellcheck source=framework/versions +source "$DIR/framework/versions" + +# Ensure correct node version is installed +node_installed_checksum_file="$DIR/framework/binaries/.node.checksum" +node_installed_checksum="" +if [ -f "$node_installed_checksum_file" ]; then + node_installed_checksum=$(cat "$node_installed_checksum_file") +fi + +if [ "$node_installed_checksum" != "$nodejs_checksum_linux_x86_64" ]; then + echo "Downloading Node.js..." + node_archive="$DIR/framework/downloads/node.tar.xz" + curl -fsSL "$nodejs_binary_linux_x86_64" -o "$node_archive" + + echo "Verifying checksum..." + echo "$nodejs_checksum_linux_x86_64 $node_archive" | sha256sum -c - + + echo "Extracting Node.js..." + tar -xf "$node_archive" -C "$DIR/framework/binaries" + rm "$node_archive" + + echo "$nodejs_checksum_linux_x86_64" >"$node_installed_checksum_file" +fi + +# Ensure correct pnpm version is installed +pnpm_binary="$DIR/framework/binaries/pnpm" +pnpm_installed_checksum_file="$DIR/framework/binaries/.pnpm.checksum" +pnpm_installed_checksum="" +if [ -f "$pnpm_installed_checksum_file" ]; then + pnpm_installed_checksum=$(cat "$pnpm_installed_checksum_file") +fi + +# pnpm checksum includes "sha256:" prefix, strip it for sha256sum +pnpm_checksum="${pnpm_checksum_linux_x86_64#sha256:}" + +if [ "$pnpm_installed_checksum" != "$pnpm_checksum" ]; then + echo "Downloading pnpm..." + curl -fsSL "$pnpm_binary_linux_x86_64" -o "$pnpm_binary" + + echo "Verifying checksum..." + echo "$pnpm_checksum $pnpm_binary" | sha256sum -c - + + chmod +x "$pnpm_binary" + + echo "$pnpm_checksum" >"$pnpm_installed_checksum_file" +fi + +# Get golang binaries in place +cd "$DIR/master" +go build + +cd "$DIR/logger" +go build + +# Update framework code +cd "$DIR/express" +../cmd pnpm install From 70ddcb2a943d0eca5e6d8c739f1c5f03e86b023b Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 11 Jan 2026 16:04:22 -0600 Subject: [PATCH 2/4] Note that we need bash --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c6948c..3795006 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,9 @@ To run a more complete system, you also need to have docker compose installed. To hack on diachron itself, you need the following: +- bash - docker and docker compose - [fd](https://github.com/sharkdp/fd) - golang, version 1.23.6 or greater - shellcheck - shfmt - - From 93ab4b5d5385f365cce1e485adff9c5728112d40 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 11 Jan 2026 16:07:24 -0600 Subject: [PATCH 3/4] Update node version --- framework/versions | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/versions b/framework/versions index 0177ebf..f6af704 100644 --- a/framework/versions +++ b/framework/versions @@ -2,8 +2,9 @@ # This file belongs to the framework. You are not expected to modify it. -nodejs_binary_linux_x86_64=https://nodejs.org/dist/v22.15.1/node-v22.15.1-linux-x64.tar.xz -nodejs_checksum_linux_x86_64=7dca2ab34ec817aa4781e2e99dfd34d349eff9be86e5d5fbaa7e96cae8ee3179 +# https://nodejs.org/dist +nodejs_binary_linux_x86_64=https://nodejs.org/dist/v24.12.0/node-v24.12.0-linux-x64.tar.xz +nodejs_checksum_linux_x86_64=bdebee276e58d0ef5448f3d5ac12c67daa963dd5e0a9bb621a53d1cefbc852fd nodejs_dist_dir=framework/binaries/node-v22.15.1-linux-x64 nodejs_bin_dir="$nodejs_dist_dir/bin" From 6ace2163ed2de7ccd28fc72a7c5740d783e10272 Mon Sep 17 00:00:00 2001 From: Michael Wolf Date: Sun, 11 Jan 2026 16:07:32 -0600 Subject: [PATCH 4/4] Update pnpm version --- framework/versions | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/versions b/framework/versions index f6af704..de9fbd4 100644 --- a/framework/versions +++ b/framework/versions @@ -11,7 +11,9 @@ nodejs_bin_dir="$nodejs_dist_dir/bin" caddy_binary_linux_x86_64=fixme caddy_checksum_linux_x86_64=fixmetoo -pnpm_binary_linux_x86_64=https://github.com/pnpm/pnpm/releases/download/v10.12.4/pnpm-linux-x64 -pnpm_checksum_linux_x86_64=sha256:ac2768434cbc6c5fec71da4abae7845802bbfe326d590aa0004cdf8bf0815b26 +# https://github.com/pnpm/pnpm/releases +pnpm_binary_linux_x86_64=https://github.com/pnpm/pnpm/releases/download/v10.28.0/pnpm-linux-x64 +pnpm_checksum_linux_x86_64=sha256:348e863d17a62411a65f900e8d91395acabae9e9237653ccc3c36cb385965f28 + golangci_lint=v2.7.2-alpine \ No newline at end of file