chore: restart the repository with a clean history
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
This commit is contained in:
438 files changed
+45070
No files matched your search
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
BUILD_DIR="$ROOT/build/sea"
|
||||
STAGE_DIR="$BUILD_DIR/stage"
|
||||
PAYLOAD_DIR="$STAGE_DIR/app"
|
||||
BIN_NAME="${BIN_NAME:-frislit-server}"
|
||||
|
||||
NODE_BIN="${NODE_BIN:-$(command -v node)}"
|
||||
NODE_MAJOR="$("$NODE_BIN" -p 'process.versions.node.split(".")[0]')"
|
||||
if [ "$NODE_MAJOR" -lt 26 ]; then
|
||||
echo "Node 26+ required for --build-sea (have $($NODE_BIN --version))" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$("$NODE_BIN" -p 'require("'"$ROOT"'/package.json").version')"
|
||||
|
||||
echo "[build-sea] node $($NODE_BIN --version) version=$VERSION"
|
||||
rm -rf "$BUILD_DIR"
|
||||
mkdir -p "$PAYLOAD_DIR"
|
||||
|
||||
echo "[build-sea] staging app payload"
|
||||
cp -r "$ROOT/server" "$PAYLOAD_DIR/server"
|
||||
cp "$ROOT/package.json" "$ROOT/package-lock.json" "$PAYLOAD_DIR/"
|
||||
|
||||
if [ ! -d "$ROOT/client/dist" ]; then
|
||||
(cd "$ROOT/client" && npm ci && npm run build)
|
||||
fi
|
||||
mkdir -p "$PAYLOAD_DIR/client"
|
||||
cp -r "$ROOT/client/dist" "$PAYLOAD_DIR/client/dist"
|
||||
|
||||
(cd "$PAYLOAD_DIR" && npm ci --omit=dev --no-audit --no-fund)
|
||||
|
||||
find "$PAYLOAD_DIR/node_modules" \
|
||||
\( -name '*.map' -o -name '*.md' -o -name '*.markdown' \
|
||||
-o -name '*.ts' ! -name '*.d.ts' \
|
||||
-o -name 'CHANGELOG*' -o -name 'AUTHORS*' \
|
||||
-o -name '.github' -o -name 'test' -o -name 'tests' -o -name '__tests__' \
|
||||
-o -name 'example' -o -name 'examples' -o -name 'docs' \
|
||||
\) -prune -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
TARBALL="$STAGE_DIR/app-payload.tar.gz"
|
||||
tar -C "$STAGE_DIR" --format=ustar -cf - app | gzip -9 > "$TARBALL"
|
||||
du -sh "$TARBALL"
|
||||
|
||||
MANIFEST="$STAGE_DIR/app-manifest.json"
|
||||
printf '{"version":"%s"}' "$VERSION" > "$MANIFEST"
|
||||
|
||||
CONFIG_FILE="$STAGE_DIR/sea-config.json"
|
||||
if command -v cygpath >/dev/null 2>&1; then
|
||||
to_native() { cygpath -m "$1"; }
|
||||
else
|
||||
to_native() { printf '%s' "$1"; }
|
||||
fi
|
||||
|
||||
MAIN_PATH="$(to_native "$ROOT/scripts/sea-launcher.js")"
|
||||
OUTPUT_PATH="$(to_native "$BUILD_DIR/$BIN_NAME")"
|
||||
TARBALL_PATH="$(to_native "$TARBALL")"
|
||||
MANIFEST_PATH="$(to_native "$MANIFEST")"
|
||||
|
||||
cat > "$CONFIG_FILE" <<EOF
|
||||
{
|
||||
"main": "$MAIN_PATH",
|
||||
"output": "$OUTPUT_PATH",
|
||||
"disableExperimentalSEAWarning": true,
|
||||
"assets": {
|
||||
"app-payload.tar.gz": "$TARBALL_PATH",
|
||||
"app-manifest.json": "$MANIFEST_PATH"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
"$NODE_BIN" --build-sea="$CONFIG_FILE"
|
||||
chmod +x "$BUILD_DIR/$BIN_NAME"
|
||||
|
||||
rm -rf "$STAGE_DIR"
|
||||
ls -lh "$BUILD_DIR/$BIN_NAME"
|
||||
@@ -0,0 +1,72 @@
|
||||
const path = require("node:path");
|
||||
const fs = require("node:fs");
|
||||
const os = require("node:os");
|
||||
const zlib = require("node:zlib");
|
||||
const crypto = require("node:crypto");
|
||||
const Module = require("node:module");
|
||||
const sea = require("node:sea");
|
||||
|
||||
if (!process.env.NODE_ENV) process.env.NODE_ENV = "production";
|
||||
|
||||
const PAYLOAD_KEY = "app-payload.tar.gz";
|
||||
const MANIFEST_KEY = "app-manifest.json";
|
||||
|
||||
const payload = Buffer.from(sea.getAsset(PAYLOAD_KEY));
|
||||
const meta = JSON.parse(new TextDecoder().decode(sea.getAsset(MANIFEST_KEY)));
|
||||
|
||||
const fingerprint = crypto.createHash("sha256").update(payload).digest("hex").slice(0, 16);
|
||||
const cacheRoot = path.join(os.tmpdir(), `frislit-sea-${meta.version}-${fingerprint}`);
|
||||
const appDir = path.join(cacheRoot, "app");
|
||||
const readyMarker = path.join(cacheRoot, ".ready");
|
||||
|
||||
const extract = () => {
|
||||
const staging = `${cacheRoot}.tmp-${process.pid}`;
|
||||
fs.rmSync(staging, { recursive: true, force: true });
|
||||
fs.mkdirSync(staging, { recursive: true });
|
||||
|
||||
const tar = zlib.gunzipSync(payload);
|
||||
let offset = 0;
|
||||
while (offset < tar.length) {
|
||||
const header = tar.subarray(offset, offset + 512);
|
||||
offset += 512;
|
||||
const rawName = header.subarray(0, 100).toString("utf8").replace(/\0.*$/, "");
|
||||
if (!rawName) {
|
||||
if (offset >= tar.length || tar[offset] === 0) break;
|
||||
continue;
|
||||
}
|
||||
const prefix = header.subarray(345, 500).toString("utf8").replace(/\0.*$/, "");
|
||||
const name = prefix ? `${prefix}/${rawName}` : rawName;
|
||||
const sizeOctal = header.subarray(124, 136).toString("utf8").replace(/[\0 ]+$/, "");
|
||||
const size = sizeOctal ? parseInt(sizeOctal, 8) : 0;
|
||||
const typeflag = String.fromCharCode(header[156]);
|
||||
const modeOctal = header.subarray(100, 108).toString("utf8").replace(/[\0 ]+$/, "");
|
||||
const mode = modeOctal ? parseInt(modeOctal, 8) : 0o644;
|
||||
const data = tar.subarray(offset, offset + size);
|
||||
offset += Math.ceil(size / 512) * 512;
|
||||
|
||||
const target = path.join(staging, name);
|
||||
if (typeflag === "5") {
|
||||
fs.mkdirSync(target, { recursive: true });
|
||||
} else if (typeflag === "2") {
|
||||
const linkname = header.subarray(157, 257).toString("utf8").replace(/\0.*$/, "");
|
||||
fs.mkdirSync(path.dirname(target), { recursive: true });
|
||||
try { fs.symlinkSync(linkname, target); } catch { /* a link we cannot make is not fatal */ }
|
||||
} else {
|
||||
fs.mkdirSync(path.dirname(target), { recursive: true });
|
||||
fs.writeFileSync(target, data, { mode });
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
fs.renameSync(staging, cacheRoot);
|
||||
} catch (err) {
|
||||
if (err.code !== "ENOTEMPTY" && err.code !== "EEXIST") throw err;
|
||||
fs.rmSync(staging, { recursive: true, force: true });
|
||||
}
|
||||
fs.writeFileSync(readyMarker, "");
|
||||
};
|
||||
|
||||
if (!fs.existsSync(readyMarker)) extract();
|
||||
|
||||
const appRequire = Module.createRequire(path.join(appDir, "package.json"));
|
||||
appRequire(path.join(appDir, "server", "index.js"));
|
||||
Reference in new issue
Block a user