Skip to content

michelou/deno-examples

Repository files navigation

Playing with Deno on Windows

Deno project This repository gathers Deno code examples coming from various websites and books.
It also includes several build scripts (batch files) for experimenting with Deno on a Windows machine.

Ada, Akka, C++, COBOL, Dafny, Dart, Docker, Erlang, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.

Read the interview "I have only one learning technique: projects that I’m working on”" with Ryan Dahl to learn more about the early days of Deno.

Project dependencies

This project depends on two external software for the Microsoft Windows platform:

Optionally one may also install the following software:

🔎 Git for Windows provides a BASH emulation used to run git from the command line (as well as over 250 Unix commands like awk, diff, file, grep, more, mv, rmdir, sed and wc).

For instance our development environment looks as follows (December 2024) 3:

C:\opt\ConEmu\                 ( 26 MB)
C:\opt\deno\                   (105 MB)
C:\opt\Git\                    (391 MB)
C:\opt\nmap\                   ( 29 MB)
C:\opt\node-v18.20.5-win-x64\  ( 78 MB)
C:\opt\VSCode\                 (381 MB)
%USERPROFILE%\.deno\4          (< 1 MB)

Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we defined C:\opt\ as the installation directory for optional software tools (in reference to the /opt/ directory on Unix).

Directory structure

This project is organized as follows:

bin\
docs\
effect-examples\{README.md, hello-effect}
examples\{README.md}
portela-examples\{README.md, Chapter01}
README.md
QUICKREF.md
RESOURCES.md
TYPESCRIPT.md
setenv.bat

where

We also define a virtual drive – e.g. drive O: – in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).

🔎 We use the Windows external command subst to create virtual drives; for instance:

> subst O: %USERPROFILE%\workspace\deno-examples

Batch commands

We execute command setenv.bat once to setup our development environment; it makes external tools such as deno.cmd, git.exe, and sh.exe directly available from the command prompt.

> setenv -verbose
Tool versions:
   deno 2.1.2, deployctl 1.12.0, node v18.20.5, ncat 7.95, rustc 1.82.0,
   git 2.47.1, diff 3.10, bash 5.2.37(1)
Tool paths:
   C:\opt\deno\deno.exe
   %USERPROFILE%\.deno\bin\deployctl.cmd
   C:\opt\nmap\ncat.exe
   %USERPROFILE%\.cargo\bin\rustc.exe
   C:\opt\Git\bin\git.exe
   C:\opt\Git\usr\bin\diff.exe
Environment variables:
   "CARGO_HOME=%USERPROFILE%\.cargo"
   "DENO_HOME=C:\opt\deno"
   "GIT_HOME=C:\opt\Git"
   "NMAP_HOME=C:\opt\nmap"
   "NODE_HOME=C:\opt\node-v18.20.5-win-x64"

> where deno git sh
C:\opt\deno\deno.exe
C:\opt\Git\bin\git.exe
C:\opt\Git\mingw64\bin\git.exe
C:\opt\Git\bin\sh.exe
C:\opt\Git\usr\bin\sh.exe

🔎 Subcommand help prints the following help message :

  > setenv help
  Usage: setenv { <option> | <subcommand> }
   
    Options:
      -bash       start Git bash shell instead of Windows command prompt
      -debug      print commands executed by this script
      -verbose    print progress messages
   
    Subcommands:
      help        print this help message
  

Footnotes

[1] Deno TypeScript

Command deno --version displays the supported version of TypeScript, namely version 5.6 in our case:
> deno --version
deno 2.1.2 (stable, release, x86_64-pc-windows-msvc)
v8 13.0.245.12-rusty
typescript 5.6.2

[2] Nmap tools

We are mostly interested in the Ncat tool for reading, writing, redirecting, and encrypting data across a network. Ncat operates in one of two modes: in connect mode, Ncat works as a client, in listen mode it is a server,

[3] Downloads

In our case we downloaded the following installation files (see section 1):
ConEmuPack.230724.7z              (  5 MB)
deno-x86_64-pc-windows-msvc.zip   ( 24 MB)
nmap-7.95-setup.zip               ( 28 MB)
node-v18.20.5-win-x64.zip         ( 27 MB)
PortableGit-2.47.1-64-bit.7z.exe  ( 41 MB)
VSCode-win32-x64-1.95.3.zip       (131 MB)

[4] Deployctl

deployctl is the command line tool for Deno Deploy.

mics/December 2024  

About

Playing with Deno on Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published