Skip to content

Manage Node dependencies for CLJS projects

Notifications You must be signed in to change notification settings

chlorinejs/lein-npm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

lein-npm

Leiningen plugin for enabling Node based ClojureScript projects.

Installation

To enable lein-npm for your project, put the following in the :plugins vector of your project.clj file:

[lein-npm "0.1.0"]

Managing NPM dependencies

You can specify a project's NPM dependencies by adding a :node-dependencies key in your project.clj:

:node-dependencies [[underscore "1.4.3"]
                    [nyancat "0.0.3"]
                    [mongodb "1.2.7"]]

These dependencies, and any :node-dependencies of packages pulled in through the regular :dependencies, will be installed through NPM when you run either lein npm install or lein deps.

Invoking NPM

You can execute NPM commands that require the presence of a package.json file using the lein npm command. This command creates a temporary package.json based on your project.clj before invoking the NPM command you specify. Note that the package.json currently only contains the keys name, description, version and dependencies.

$ lein npm install        # installs project dependencies
$ lein npm ls             # lists installed dependencies
$ lein npm search nyancat # searches for packages containing "nyancat"

Running ClojureScript apps

The plugin installs a lein run hook which enables you to specify a JavaScript file instead of a Clojure namespace for the :main key in your project.clj, like this:

:main "js/main.js"

If :main is a string that refers to a file that exists and ends with .js, it will launch this file using Node, after first running npm install if necessary. Any command line arguments following lein run will be passed through to the Node process.

License

Copyright 2012 Bodil Stokke

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Manage Node dependencies for CLJS projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 100.0%