EXPERIMENTAL: It's early days yet for Deno and how Stencil will work with it, so we'll label this experimental.
Stencil's architecture allows it to be passed a system (
sys) that interacts with the runtime. For example, Node's
fs will use
readdir() and must be passed a callback, whereas Deno uses
readDir() (has a capital D) and returns a promise. The same concept is applied to the browser and web worker systems, which allows the compiler to stay generic and versatile for any JS runtime.
The Stencil compiler, and its Command-Line Interface (CLI), can also be executed with Deno, but it works differently than a traditional Node CLI. The biggest difference is that Deno does not have a centralized package manager, so Deno doesn't have an
With Deno there is no
npm install command, but instead you specify the external URL of the executable script to install. After
installing Deno, run the command:
deno install -n stencil --allow-read --allow-write --allow-net https://stenciljs.com/cli.ts
Let's break this down a little further to explain what this command is doing:
|Command / Arg||Description|
| ||The Deno command already installed .|
||Installer script argument.|
||The name you'll give the executable your installing.|
||The CLI will need to access files, so this option allows it to read local files.|
||The CLI will also need to write files.|
||The CLI will need to access the net to install dependencies.|
||The location of the Stencil's Deno installer.|
Don't worry, this command doesn't need to be ran everytime you're running Stencil with Deno, but instead it's just installing it, and giving your machine the executable name of
stencil. During the installing you'll see where additional script files are coming from, which in our case is
After installing you'll then have the global
stencil command ready to be used and you can test it out by running the CLI's help command:
To update the installed Deno Stencil CLI, add the
-f option to "force" overwriting the existing executable and reinstalling the latest.
deno install -n stencil --allow-read --allow-write --allow-net -f https://stenciljs.com/cli.ts
After the installer script has successfully ran, the
stencil executable is ready to be used with the same options as the Node CLI. See the
CLI docs for all available options or run
stencil is now a global executable, its goal is still aimed at running each individual application's local Stencil version. The installed command is simply the entry, but it's not locked into a specific compiler version. When the
stencil command is ran, it looks to use the locally installed install Stencil compiler, and if one isn't already installed, it'll dynamically load the latest Stencil version.
The Deno CLI is still experimental, the generate command has not been ported yet.