# Npm (/pipeline-sdk/reference/toolchains/npm)



{/* Generated by docs-site/scripts/generate-dsl-docs.ts — do not edit. */}

## `npm` [#npm]

Callable singleton for the npm toolchain — access as `hm.npm`.

Call directly to construct an `NpmProject`, or use the bare-form
action methods (`npm.test()`, `npm.run(script)`, etc.) for a
one-shot leaf.

```python
npm(*, path='.', version='20', image=None, base=None) -> NpmProject
```

| Parameter             | Type           | Default | Description                                              |
| --------------------- | -------------- | ------- | -------------------------------------------------------- |
| `path`                | `str`          | `'.'`   | Path to the npm project root (must contain a             |
| `package-lock.json`). |                |         |                                                          |
| `version`             | `str`          | `'20'`  | Node.js major version to install (e.g. `"20"` or         |
| `"20.x"`).            |                |         |                                                          |
| `image`               | `str \| None`  | `None`  | Local-mode Docker base image override.                   |
| `base`                | `Step \| None` | `None`  | Existing `Step` to attach to instead of emitting a fresh |
| apt-base step.        |                |         |                                                          |

**Returns** `NpmProject` — An `NpmProject` whose `installed` step is `npm ci`.

### `npm.fmt()` [#npmfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `npm.install()` [#npminstall]

```python
install(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `npm.lint()` [#npmlint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `npm.run()` [#npmrun]

```python
run(script, **kw) -> Step
```

| Parameter | Type  | Default    | Description |
| --------- | ----- | ---------- | ----------- |
| `script`  | `str` | *required* | —           |
| `kw`      | `Any` | `{}`       | —           |

**Returns** `Step`

### `npm.test()` [#npmtest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

## `NpmEntry` [#npmentry]

Callable singleton for the npm toolchain — access as `hm.npm`.

Call directly to construct an `NpmProject`, or use the bare-form
action methods (`npm.test()`, `npm.run(script)`, etc.) for a
one-shot leaf.

### `NpmEntry.fmt()` [#npmentryfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `NpmEntry.install()` [#npmentryinstall]

```python
install(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `NpmEntry.lint()` [#npmentrylint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `NpmEntry.run()` [#npmentryrun]

```python
run(script, **kw) -> Step
```

| Parameter | Type  | Default    | Description |
| --------- | ----- | ---------- | ----------- |
| `script`  | `str` | *required* | —           |
| `kw`      | `Any` | `{}`       | —           |

**Returns** `Step`

### `NpmEntry.test()` [#npmentrytest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

## `NpmProject` [#npmproject]

npm project install chain — constructed via `hm.npm()`.

`installed` is the `npm ci` step. Action methods (`run`,
`test`, `lint`, `fmt`) attach leaves to `installed` so
dependency installation is shared across CI actions.

### Fields [#fields]

| Field       | Type   | Default    |
| ----------- | ------ | ---------- |
| `path`      | `str`  | *required* |
| `installed` | `Step` | *required* |

### `NpmProject.fmt()` [#npmprojectfmt]

```python
fmt(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `NpmProject.install()` [#npmprojectinstall]

```python
install() -> Step
```

**Returns** `Step`

### `NpmProject.lint()` [#npmprojectlint]

```python
lint(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`

### `NpmProject.run()` [#npmprojectrun]

```python
run(script, **kw) -> Step
```

| Parameter | Type  | Default    | Description |
| --------- | ----- | ---------- | ----------- |
| `script`  | `str` | *required* | —           |
| `kw`      | `Any` | `{}`       | —           |

**Returns** `Step`

### `NpmProject.test()` [#npmprojecttest]

```python
test(**kw) -> Step
```

| Parameter | Type  | Default | Description |
| --------- | ----- | ------- | ----------- |
| `kw`      | `Any` | `{}`    | —           |

**Returns** `Step`
