michelou / deno-examples

Playing with Deno on Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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, Dart, Docker, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak and WiX Toolset are other topics we are continuously monitoring.

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 (May 2024) 3:

%USERPROFILE%\.deno\4          (< 1 MB)
C:\opt\deno\                   ( 75 MB)
C:\opt\Git\                    (367 MB)
C:\opt\nmap-7.95\              ( 29 MB)
C:\opt\node-v18.20.2-win-x64\  ( 80 MB)
C:\opt\VSCode\                 (341 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:

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 1.43.1, deployctl 1.5.0, node v18.20.2, ncat 7.95, rustc 1.76.0,
   git 2.45.0.windows.1, diff 3.10, bash 5.2.26(1)-release
Tool paths:
   C:\opt\deno\deno.exe
   %USERPROFILE%\.deno\bin\deployctl.cmd
   C:\opt\nmap-7.95\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-7.95"
   "NODE_HOME=C:\opt\node-v18.20.2-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.4 in our case:
> deno --version
deno 1.43.1 (release, x86_64-pc-windows-msvc)
v8 12.4.254.12
typescript 5.4.3

[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):
deno-x86_64-pc-windows-msvc.zip   (24 MB)
nmap-7.95-setup.zip               (28 MB)
node-v18.20.2-win-x64.zip         (27 MB)
PortableGit-2.45.0-64-bit.7z.exe  (41 MB)

[4] Deployctl

deployctl is the command line tool for Deno Deploy.

mics/May 2024  

About

Playing with Deno on Windows


Languages

Language:TypeScript 100.0%