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

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 is one global configuration for the nodelix application:

  • :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,
  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__),
    env: [
      NODE_DEBUG: "*"
    ]
  ]

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.

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

Same as install_and_run/3 but using the latest known LTS version at the time of publishing.

Runs the given command with args.

Same as run/3 but using the latest known LTS version at the time of publishing.

Functions

Returns the configuration for the given profile.

Raises if the profile does not exist.

Link to this function

install_and_run(version, profile, args)

View Source

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

Returns the same as run/3.

Link to this function

install_and_run_lts(profile, extra_args \\ [])

View Source

Same as install_and_run/3 but using the latest known LTS version at the time of publishing.

Link to this function

run(version, 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.

Link to this function

run_lts(profile, extra_args \\ [])

View Source

Same as run/3 but using the latest known LTS version at the time of publishing.