From c3386933434cbb0397e2b9ce1b9ada03b2223954 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sun, 28 Jan 2024 14:13:37 +0100 Subject: [PATCH] Upgrade to deno 1.40 --- .github/workflows/docker.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/server.yml | 2 +- .github/workflows/test.yml | 2 +- Dockerfile | 2 +- cmd/upgrade.ts | 2 +- common/spaces/disk_space_primitives.ts | 2 +- deno.jsonc | 18 +++++++++--------- docker-entrypoint.sh | 4 ++-- plugos/deps.ts | 2 +- plugos/hooks/endpoint.test.ts | 5 ++++- plugos/runtime.test.ts | 5 ++++- website/Install/Deno.md | 4 ++-- 13 files changed, 29 insertions(+), 23 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5dd35c64..16864d7f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.39 + deno-version: v1.40 - name: Run bundle build run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc7905ee..2a1b37e7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.39 + deno-version: v1.40 - name: Run build run: deno task build - name: Bundle diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index cef227b0..911c0df4 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.39 + deno-version: v1.40 - name: Build bundles run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5957c6d2..f84a6d7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.39 + deno-version: v1.40 - name: Run build run: deno task build diff --git a/Dockerfile b/Dockerfile index 9f6cfa0d..e9ffa991 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lukechannings/deno:v1.39.4 +FROM lukechannings/deno:v1.40.2 # The volume that will keep the space data # Either create a volume: diff --git a/cmd/upgrade.ts b/cmd/upgrade.ts index a8be25c2..7292a8e6 100644 --- a/cmd/upgrade.ts +++ b/cmd/upgrade.ts @@ -17,7 +17,7 @@ export async function upgradeCommand() { "So, that's done. Now let's see if this actually did anything...", ); const vp = new Deno.Command("deno", { - args: ["run", "-A", "--unstable", Deno.mainModule, "version"], + args: ["run", "-A", Deno.mainModule, "version"], }); const versionStatus = await vp.output(); if (!versionStatus.success) { diff --git a/common/spaces/disk_space_primitives.ts b/common/spaces/disk_space_primitives.ts index 9e16ca94..ec46ae6f 100644 --- a/common/spaces/disk_space_primitives.ts +++ b/common/spaces/disk_space_primitives.ts @@ -48,7 +48,7 @@ export class DiskSpacePrimitives implements SpacePrimitives { const f = await Deno.open(localPath, { read: true }); const data = await readAll(f); - Deno.close(f.rid); + f.close(); return { data, diff --git a/deno.jsonc b/deno.jsonc index 39d561bd..ac348d2e 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -4,13 +4,13 @@ "deep-clean-mac": "rm -f deno.lock && rm -rf $HOME/Library/Caches/deno && deno task clean", "install": "deno install -f --unstable -A --importmap import_map.json silverbullet.ts", "check": "find . -name '*.ts*' | xargs deno check", - "test": "deno test -A --unstable", - "build": "deno run -A build_plugs.ts && deno run -A --unstable build_web.ts", + "test": "deno test -A --unstable-kv --unstable-worker-options", + "build": "deno run -A build_plugs.ts && deno run -A build_web.ts", "plugs": "deno run -A build_plugs.ts", - "server": "deno run -A --unstable --check silverbullet.ts", + "server": "deno run -A --unstable-kv --unstable-worker-options --check silverbullet.ts", "watch-web": "deno run -A --check build_web.ts --watch", - "watch-server": "deno run -A --unstable --check --watch silverbullet.ts", + "watch-server": "deno run -A --unstable-kv --unstable-worker-options --check --watch silverbullet.ts", "watch-plugs": "deno run -A --check build_plugs.ts -w", "bundle": "deno run -A build_bundle.ts", @@ -18,11 +18,11 @@ "generate": "./scripts/generate.sh", // Compile - "compile": "deno task bundle && deno compile -A --unstable -o silverbullet dist/silverbullet.js", - "server:dist:linux-x86_64": "deno task bundle && deno compile -A --unstable --target x86_64-unknown-linux-gnu -o silverbullet dist/silverbullet.js && zip silverbullet-server-linux-x86_64.zip silverbullet", - "server:dist:darwin-x86_64": "deno task bundle && deno compile -A --unstable --target x86_64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-x86_64.zip silverbullet", - "server:dist:darwin-aarch64": "deno task bundle && deno compile -A --unstable --target aarch64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-aarch64.zip silverbullet", - "server:dist:windows-x86_64": "deno task bundle && deno compile -A --unstable --target x86_64-pc-windows-msvc -o silverbullet.exe dist/silverbullet.js && zip silverbullet-server-windows-x86_64.zip silverbullet.exe" + "compile": "deno task bundle && deno compile -A --unstable-kv --unstable-worker-options -o silverbullet dist/silverbullet.js", + "server:dist:linux-x86_64": "deno task bundle && deno compile -A --unstable-kv --unstable-worker-options --target x86_64-unknown-linux-gnu -o silverbullet dist/silverbullet.js && zip silverbullet-server-linux-x86_64.zip silverbullet", + "server:dist:darwin-x86_64": "deno task bundle && deno compile -A --unstable-kv --unstable-worker-options --target x86_64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-x86_64.zip silverbullet", + "server:dist:darwin-aarch64": "deno task bundle && deno compile -A --unstable-kv --unstable-worker-options --target aarch64-apple-darwin -o silverbullet dist/silverbullet.js && zip silverbullet-server-darwin-aarch64.zip silverbullet", + "server:dist:windows-x86_64": "deno task bundle && deno compile -A --unstable-kv --unstable-worker-options --target x86_64-pc-windows-msvc -o silverbullet.exe dist/silverbullet.js && zip silverbullet-server-windows-x86_64.zip silverbullet.exe" }, "compilerOptions": { diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index c52996ad..1590dcb8 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,7 +13,7 @@ fi if [ "$PUID" == "0" ] || [ "$UID" != "0" ]; then # Will run SilverBullet as default user - deno run -A --unstable /silverbullet.js $@ + deno run -A --unstable-kv --unstable-worker-options /silverbullet.js $@ else # Create silverbullet user and group ad-hoc mapped to PUID and PGID getent group $PGID &> /dev/null || groupadd -g $PGID silverbullet @@ -24,6 +24,6 @@ else # And run via su as requested PUID, usually this will be 'silverbullet' but if a user with this idea already exists, we will use that USERNAME=$(getent passwd $PUID | cut -d ":" -f 1) echo "Running SilverBullet as $USERNAME (configured as PUID $PUID and PGID $PGID)" - su $USERNAME -s /bin/bash -c "deno run -A --unstable /silverbullet.js $args" + su $USERNAME -s /bin/bash -c "deno run -A --unstable-kv --unstable-worker-options /silverbullet.js $args" fi diff --git a/plugos/deps.ts b/plugos/deps.ts index 8f9751bb..6025eea4 100644 --- a/plugos/deps.ts +++ b/plugos/deps.ts @@ -5,6 +5,6 @@ export { expandGlobSync } from "https://deno.land/std@0.165.0/fs/mod.ts"; export { mime } from "https://deno.land/x/mimetypes@v1.0.0/mod.ts"; export { default as cacheDir } from "https://deno.land/x/cache_dir@0.2.0/mod.ts"; export * as flags from "https://deno.land/std@0.165.0/flags/mod.ts"; -export * as esbuild from "https://deno.land/x/esbuild@v0.19.12/mod.js"; +export * as esbuild from "https://deno.land/x/esbuild@v0.20.0/mod.js"; export { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.5/mod.ts"; export * as YAML from "https://deno.land/std@0.184.0/yaml/mod.ts"; diff --git a/plugos/hooks/endpoint.test.ts b/plugos/hooks/endpoint.test.ts index 5e7a535b..a493a2b4 100644 --- a/plugos/hooks/endpoint.test.ts +++ b/plugos/hooks/endpoint.test.ts @@ -7,7 +7,10 @@ import { compileManifest } from "../compile.ts"; import { esbuild } from "../deps.ts"; import { Hono } from "../../server/deps.ts"; -Deno.test("Run a plugos endpoint server", async () => { +Deno.test("Run a plugos endpoint server", { + sanitizeResources: false, + sanitizeOps: false, +}, async () => { const tempDir = await Deno.makeTempDir(); const system = new System("server"); diff --git a/plugos/runtime.test.ts b/plugos/runtime.test.ts index b907f8da..ea79866d 100644 --- a/plugos/runtime.test.ts +++ b/plugos/runtime.test.ts @@ -10,7 +10,10 @@ import { import { sleep } from "$sb/lib/async.ts"; import { SysCallMapping } from "./system.ts"; -Deno.test("Run a deno sandbox", async () => { +Deno.test("Run a deno sandbox", { + sanitizeResources: false, + sanitizeOps: false, +}, async () => { const system = new System("server"); system.registerSyscalls([], { addNumbers: (_ctx, a, b) => { diff --git a/website/Install/Deno.md b/website/Install/Deno.md index 21819c61..8c67aedc 100644 --- a/website/Install/Deno.md +++ b/website/Install/Deno.md @@ -1,9 +1,9 @@ The SilverBullet is implemented using a JavaScript runtime called [Deno](https://deno.com/) which is a lot like node.js, just... you know, better. And we like better. -To run SilverBullet directly on your host system (so not in a [[Install/Docker]] container), you need to [install Deno](https://docs.deno.com/runtime/manual/getting_started/installation) 1.39: +To run SilverBullet directly on your host system (so not in a [[Install/Docker]] container), you need to [install Deno](https://docs.deno.com/runtime/manual/getting_started/installation) 1.40 or later: ```bash -$ curl -fsSL https://deno.land/install.sh | sh -s v1.39.4 +$ curl -fsSL https://deno.land/install.sh | sh ``` After having installed Deno, run: