csspin_frontend.node

The csspin_frontend.node plugin provides a way to provision and run Node.js as well as the Node Package Manager npm.

How to setup the csspin_frontend.node plugin?

For using the csspin_frontend.node plugin, a project’s spinfile.yaml must at least contain the following configuration.

Minimal configuration of spinfile.yaml to use csspin_frontend.node
plugin_packages:
    - csspin-python
    - csspin-frontend
plugins:
    - csspin_frontend.node
python:
    version: '3.11.9'
node:
    version: '18.17.1'

The provisioning of the required virtual environment as well as the plugins dependencies can be done via the well-known spin provision-command.

How to run tools provisioned by csspin_frontend.node?

After the project is provisioned, node node can be used as follows:

Running tools provisioned by csspin_frontend.node
spin run node # Run the Node.js REPL
spin run npm install <package> # Install a package using NPM
...

How to use a local Node.js installation?

The csspin_frontend.node plugin allows to use a local Node.js installation instead of provisioning a new one. This can be done by setting the node.use property to the path of the local Node.js installation. This can be done in the spinfile.yaml or via the command line.

Using a local Node.js installation
spin -p node.use=/usr/bin/node provision
spin -p node.use=/usr/bin/node node

How to use a mirror when provisioning Node.js?

Sometimes it is necessary to use a mirror when provisioning Node.js. This can be done by setting the node.mirror property to the URL of the mirror.

Using a mirror when provisioning Node.js
...
node:
    version: '18.17.1'
    mirror: <the custom mirror goes here>

Note

The URL that node.mirror points to must point to the same site as https://nodejs.org/dist/.

csspin_frontend.node schema reference

node: 'object'

Configuration of the Node plugin.

node.install_dir: 'path'

Directory where downloaded and NodeJS installations are stored and being used from

node.version: 'str'

The NodeJS version. Can be “lts” or any of “major”, “major.minor” or “major.minor.sl” with or without a leading “v”

node.use: 'path'

Alternative path to a local NodeJS executable

node.mirror: 'str'

Proxy to get NodeJS sources from

node.schema: 'object'
node.requires: 'object'
node.requires.spin: 'list'
node._requires: 'list'