Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/degree9/boot-npm

Node Package Manager (NPM) wrapper task for boot-clj
https://github.com/degree9/boot-npm

boot-clj

Last synced: about 1 month ago
JSON representation

Node Package Manager (NPM) wrapper task for boot-clj

Awesome Lists containing this project

README

        

[![Clojars Project](https://img.shields.io/clojars/v/degree9/boot-npm.svg)](https://clojars.org/degree9/boot-npm)
[![Dependencies Status](https://jarkeeper.com/degree9/boot-npm/status.svg)](https://jarkeeper.com/degree9/boot-npm)
[![Downloads](https://jarkeeper.com/degree9/boot-npm/downloads.svg)](https://jarkeeper.com/degree9/boot-npm)
[![Slack][slack]][d9-slack]

Node Package Manager (NPM) wrapper for [boot-clj][boot-clj].

---







boot-npm is developed and maintained by Degree9

---

* Provides `npm` task for installing node modules.
* Provides `exec` task for executing node modules. (auto-installs local module)

> The following outlines basic usage of the task, extensive testing has not been done.
> Please submit issues and pull requests!

## Usage

Add `boot-npm` to your `build.boot` dependencies and `require` the namespace:

```clj
(set-env! :dependencies '[[degree9/boot-npm "X.Y.Z" :scope "test"]])
(require '[degree9.boot-npm :as npm])
```

Install a Node Module:

```clojure
(boot/deftask bower
"Install bower to node_modules."
[]
(npm/npm :install ["bower@latest"])))
```

## Task Options

The `npm` task exposes a few options when using npm as part of a build process.

```clojure
[p package VAL str "An edn file containing a package.json map."
i install FOO=BAR [str] "Dependency map."
d develop bool "Include development dependencies with packages."
r dry-run bool "Report what changes npm would have made. (usefull with boot -vv)"
g global bool "Opperates in global mode. Packages are installed to prefix."
c cache-key VAL kw "Optional cache key for when npm is used with multiple dependency sets."
_ include bool "Include package.json in fileset output."
_ pretty bool "Pretty print generated package.json file"]
```

The `:install` option is provided for installing node modules, takes a map containing a dependency/version pair. This will install the module to a temporary `node_modules` folder and include this folder in the fileset output.

```clojure
(boot/deftask bower
"Install bower to node_modules."
[]
(npm/npm :install ["bower@latest"]))
```

The `:cache-key` option is provided to avoid downloading node modules each time boot is restarted. This will cache the `node_modules` folder and include this folder in the fileset output.

```clojure
(boot/deftask bower
"Install bower to node_modules."
[]
(npm/npm :install ["bower@latest"]
:cache-key ::cache))
```

---



Patreon



Support this and other open-source projects on Patreon!

---

[boot-clj]: https://github.com/boot-clj/boot
[slack]: https://img.shields.io/badge/clojurians-degree9-%23e01563.svg?logo=slack
[d9-slack]: https://clojurians.slack.com/channels/degree9/