Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Latest commit

 

History

History
61 lines (37 loc) · 1.68 KB

node.md

File metadata and controls

61 lines (37 loc) · 1.68 KB

Node

The django_node.node module provides utils for introspecting and calling Node.

Methods

Attributes

django_node.node.run()

Invokes Node with the arguments provided and return the resulting stderr and stdout.

Accepts an optional keyword argument, production, which will ensure that the command is run with the NODE_ENV environment variable set to 'production'.

from django_node import node

stderr, stdout = node.run('/path/to/some/file.js', '--some-argument')

# With NODE_ENV set to production
stderr, stdout = node.run('/path/to/some/file.js', '--some-argument', production=True)

django_node.node.ensure_installed()

Raises an exception if Node is not installed.

django_node.node.ensure_version_gte()

Raises an exception if the installed version of Node is less than the version required.

Arguments:

version_required: a tuple containing the minimum version required.

from django_node import node

node.ensure_version_gte((0, 10, 0,))

django_node.node.is_installed

A boolean indicating if Node is installed.

django_node.node.version

A tuple containing the version of Node installed. For example, (0, 10, 33)

django_node.node.version_raw

A string containing the raw version returned from Node. For example, 'v0.10.33'