haven

0.5.5 • Public • Published

Haven

A dependency manager for web applications

Haven is a dependency manager for front-end web applications, which will integrate nicely with other build tools. Haven comes with it's own Central Repository but can also take dependencies from Maven repositories, including the many webjar artifacts, the Bower repository, as well as any other private repositories that you point it at. Haven does not make any assumptions, it is completely agnostic to your choice of build tool, source code repository and code. A haven artifact can contain any type of asset, and any number of assets and it does not enforce any standards (eg. AMD, CommonJS)

Installing Haven

Haven depends on NodeJS and NPM. Once these are installed run the following command to install Haven.

npm install -g haven

Using Haven

Configuring Haven

Haven requires a haven.json file in the root of your project. As a minimum this should include the project name and current version

{
    "name": "my-artifact",
    "version": "0.1.0"
}

Configuring dependencies

{
    ...
    "dependencies": [
        {
            "name": "my-artifact",
            "version": "0.1.0"
        }
    ]
}
Take only certain files from the artifact
{
    ...
    "dependencies": [
        {
            "name": "my-artifact",
            "version": "0.1.0",
            "includes": ["file1.js"]
        }
    ]
}
Set the scope of a dependency

The default scope is "main", and only these dependencies are transient.

{
    ...
    "dependencies": [
        {
            "name": "my-artifact",
            "version": "0.1.0",
            "scope": "test"
        }
    ]
}

Defining which files are included in your artifact

{
    ...
    "artifacts": [
        {
            "files": [
                "test.js"
            ]
        }
    ],
}

Defining multiple artifacts

The following example will deploy 2 artifacts "my-artifact" and "my-artifact-min" containing different files

{
    ...
    "artifacts": [
        {
            "files": [
                "test.js"
            ]
        },
        {
            "id": "min",
            "files": [
                "test-min.js"
            ]
        }
    ]
}

Mapping files to your artifact

The following example will take src/test.js and put it in the artifact as my-artifact.js at the top level. It will also include the contents of the assets directory and include those files at the top level.

{
    ...
    "artifacts": [
        {
            "files": [
                "src/test.js": "my-artifact.js"
                "assets": "."
            ]
        }
    ],
}

Configuring extra repositories for dependencies

The default repository type is "haven", but haven can also support maven repositories.

{
    ...
    "repositories": {
        "dependencies": [
            {
                "url": "http://localhost:8080/haven-repository",
                "type": "haven"
            }
        ]
    }
}

Configuring distribution repositories

{
    ...
    "repositories": {
        "distribution": [
            {
                "url": "http://localhost:8080/haven-repository"
            }
        ]
    }
}

The Haven command line

Updating dependencies

haven update

Installing artifacts into your local repository

haven install

Deploying artifacts to a remote repository

haven deploy

Cleaning haven dependencies

haven clean

Cleaning local repository

haven cleanCache

Package Sidebar

Install

npm i haven

Weekly Downloads

58

Version

0.5.5

License

none

Last publish

Collaborators

  • adamknight