View Source Nodelix (nodelix v1.0.0-alpha.8)

Nodelix is an installer and runner for Node.js.

Warning

This is a pre-release version. As such, anything may change at any time, the public API should not be considered stable, and using a pinned version is recommended.

Nodelix configuration

There are two global configurations for the nodelix application:

  • :version - the Node.js version to use

  • :cacerts_path - the directory to find certificates for https connections

Profiles

You can define multiple nodelix profiles. There is a default empty profile which you can configure its args, current directory and environment:

config :nodelix,
version: "20.10.0",
default: [
  args: ~w(
    some-script.js
    --some-option
  ),
  cd: Path.expand("../assets", __DIR__),
],
custom: [
  args: ~w(
    another-script.js
    --another-option
  ),
  cd: Path.expand("../assets/scripts", __DIR__),
]

The default current directory is your project's root.

To use a profile other than default, you can use the --profile option:

mix nodelix --profile custom

When mix nodelix is invoked, the task arguments will be appended to the ones configured in the profile.

Summary

Functions

Returns the configuration for the given profile.

Returns the configured Node.js version.

Installs Node.js if the configured version is not available, and then runs node.

Runs the given command with args.

Functions

Returns the configuration for the given profile.

Raises if the profile does not exist.

Returns the configured Node.js version.

Link to this function

install_and_run(profile, args)

View Source

Installs Node.js if the configured version is not available, and then runs node.

Returns the same as run/2.

Link to this function

run(profile, extra_args \\ [])

View Source

Runs the given command with args.

The given args will be appended to the configured args. The task output will be streamed directly to stdio. It returns the status of the underlying call.