From 978b0d2c448ee47a6aee31ef90dd258847d71e63 Mon Sep 17 00:00:00 2001 From: Michael Arnaldi Date: Sat, 14 Jan 2023 12:38:51 +0000 Subject: [PATCH] minimum deno example (#1) --- .gitpod.yml | 10 ++++------ deno/.gitignore | 1 + deno/.vscode/settings.json | 4 ++++ deno/debug.init.ts | 6 ++++++ deno/debug.sh | 2 ++ deno/debug.ts | 2 ++ deno/install.sh | 2 ++ deno/main.sh | 2 ++ deno/main.ts | 8 ++++++++ deno/tsconfig.json | 16 ++++++++++++++++ 10 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 deno/.gitignore create mode 100644 deno/.vscode/settings.json create mode 100755 deno/debug.init.ts create mode 100755 deno/debug.sh create mode 100644 deno/debug.ts create mode 100755 deno/install.sh create mode 100755 deno/main.sh create mode 100644 deno/main.ts create mode 100644 deno/tsconfig.json diff --git a/.gitpod.yml b/.gitpod.yml index eae2dd7..252bc8a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,8 +1,6 @@ -# This configuration file was automatically generated by Gitpod. -# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) -# and commit this file to your remote git repository to share the goodness with others. - tasks: - - init: yarn install - + - init: yarn install && brew install deno +vscode: + extensions: + - denoland.vscode-deno diff --git a/deno/.gitignore b/deno/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/deno/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/deno/.vscode/settings.json b/deno/.vscode/settings.json new file mode 100644 index 0000000..1a48b77 --- /dev/null +++ b/deno/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "editor.formatOnSave": true, + "[typescript]": { "editor.defaultFormatter": "denoland.vscode-deno" } +} diff --git a/deno/debug.init.ts b/deno/debug.init.ts new file mode 100755 index 0000000..6db3c8e --- /dev/null +++ b/deno/debug.init.ts @@ -0,0 +1,6 @@ +import * as Debug from "npm:@effect/io/Debug"; + +Debug.runtimeDebug.minumumLogLevel = "Debug"; +Debug.runtimeDebug.traceExecutionLogEnabled = true; +Debug.runtimeDebug.getCallTrace = Debug.getCallTraceFromNewError; +Debug.runtimeDebug.traceFilter = (trace) => !trace.includes(".deno"); diff --git a/deno/debug.sh b/deno/debug.sh new file mode 100755 index 0000000..c015cce --- /dev/null +++ b/deno/debug.sh @@ -0,0 +1,2 @@ +#!/bin/sh +deno run --unstable --node-modules-dir debug.ts \ No newline at end of file diff --git a/deno/debug.ts b/deno/debug.ts new file mode 100644 index 0000000..d071358 --- /dev/null +++ b/deno/debug.ts @@ -0,0 +1,2 @@ +import "./debug.init.ts"; +import "./main.ts"; diff --git a/deno/install.sh b/deno/install.sh new file mode 100755 index 0000000..f47aae1 --- /dev/null +++ b/deno/install.sh @@ -0,0 +1,2 @@ +#!/bin/sh +deno cache --unstable --node-modules-dir main.ts \ No newline at end of file diff --git a/deno/main.sh b/deno/main.sh new file mode 100755 index 0000000..b56cb94 --- /dev/null +++ b/deno/main.sh @@ -0,0 +1,2 @@ +#!/bin/sh +deno run --unstable --node-modules-dir main.ts \ No newline at end of file diff --git a/deno/main.ts b/deno/main.ts new file mode 100644 index 0000000..68e845f --- /dev/null +++ b/deno/main.ts @@ -0,0 +1,8 @@ +import * as Effect from "npm:@effect/io/Effect"; + +const main = Effect.gen(function* ($) { + yield* $(Effect.log("hello")); + yield* $(Effect.log("world")); +}); + +Effect.unsafeFork(main); diff --git a/deno/tsconfig.json b/deno/tsconfig.json new file mode 100644 index 0000000..437e14a --- /dev/null +++ b/deno/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "strict": true, + "noEmit": true, + "baseUrl": ".", + "paths": { + "npm:*": ["node_modules/*"] + }, + "downlevelIteration": true, + "module": "ES2022", + "moduleResolution": "node", + "target": "ES2022", + "skipLibCheck": true + }, + "include": ["./**/*.ts"] +}