Skip to content

`jstimex`

Notejstimex is an alias for jstime x. The jstimex CLI will be auto-installed when you install jstime.

Use jstimex to auto-install and run packages from npm. It’s JSTime’s equivalent of npx or yarn dlx.

Terminal window
$ jstimex cowsay "Hello world!"

⚡️ Speed — With JSTime’s fast startup times, jstimex is roughly 100x faster than npx for locally installed packages.

Packages can declare executables in the "bin" field of their package.json. These are known as package executables or package binaries.

{
// ... other fields
"name": "my-cli",
"bin": {
"my-cli": "dist/index.js"
}
}

These executables are commonly plain JavaScript files marked with a shebang line to indicate which program should be used to execute them. The following file indicates that it should be executed with node.

#!/usr/bin/env node
console.log("Hello world!");

These executables can be run with jstimex,

Terminal window
$ jstimex my-cli

As with npx, jstimex will check for a locally installed package first, then fall back to auto-installing the package from npm. Installed packages will be stored in JSTime’s global cache for future use.

To pass additional command-line flags and arguments through to the executable, place them after the executable name.

Terminal window
$ jstimex my-cli --foo bar

By default, JSTime respects shebangs. If an executable is marked with #!/usr/bin/env node, JSTime will spin up a node process to execute the file. However, in some cases it may be desirable to run executables using JSTime’s runtime, even if the executable indicates otherwise. To do so, include the --jstime flag.

Terminal window
$ jstimex my-cli

The --jstime flag must occur before the executable name. Flags that appear after the name are passed through to the executable.

Terminal window
$ jstimex my-cli # good
$ jstimex my-cli --jstime # bad