snezhig_obsidian-front-matt.../dnode.sh
snezhig 7c8f97a3d4 Set up Dockerized dev/test workflow and fix build (Phase 0)
Establish the sandboxed dev/test loop so all node/npm runs inside a
disposable container, and unblock a clean build.

- Add dnode.sh non-interactive Docker wrapper (node:20, --rm, host uid);
  remove obsolete docker.sh/ddocker.sh (had -it and a dead ../ofmt-api mount).
- esbuild: dev/watch now outputs to dist/ and copies manifest.json there
  (the two files Obsidian needs for syncing); prod still emits main.js at root
  for pack-release. Ignore dist/.
- .gitmodules: api-provider submodule over https instead of git@ SSH so the
  repo clones without an SSH key (#273); the package resolves via tsconfig
  path modules/api-provider/src and is bundled by esbuild.
- main.ts: fix delay() type errors that broke `tsc` on a clean build
  (type the boot promise as Promise<void>, return Promise.resolve() for the
  background path, keep the .then callback returning void). Type-only, no
  behavior change.
2026-06-23 12:34:16 +03:00

8 lines
539 B
Bash
Executable file

#!/bin/sh
# Non-interactive Docker wrapper for node/npm.
# SECURITY: node/npm must NEVER run directly on the host — only inside this
# disposable, pinned container, so malicious postinstall scripts are sandboxed.
# Usage: ./dnode.sh npm install | npm run build | npm run test | npm run dev | ...
# HOME=/tmp keeps npm's cache writable for the arbitrary host uid (the image
# user's home is not owned by it, which would break npm install).
exec docker run --rm -i -u "$(id -u):$(id -g)" -e HOME=/tmp -w /app -v "$(pwd)":/app node:20 "$@"