Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/debopamsengupta/requirey
Intelligent multi-version dependency management for npm packages
https://github.com/debopamsengupta/requirey
dependency-manager multi-version npm package require
Last synced: 2 days ago
JSON representation
Intelligent multi-version dependency management for npm packages
- Host: GitHub
- URL: https://github.com/debopamsengupta/requirey
- Owner: debopamsengupta
- License: mit
- Created: 2017-02-15T16:09:10.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-02T15:27:32.000Z (over 7 years ago)
- Last Synced: 2025-01-15T13:10:27.808Z (9 days ago)
- Topics: dependency-manager, multi-version, npm, package, require
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 7
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm version](https://img.shields.io/npm/v/requirey.svg)](https://www.npmjs.com/package/requirey)
[![Build Status](https://img.shields.io/travis/debopamsengupta/requirey.svg)](https://travis-ci.org/debopamsengupta/requirey)
[![Windows Build Status](https://img.shields.io/appveyor/ci/debopamsengupta/requirey/master.svg?label=appveyor)](https://ci.appveyor.com/project/debopamsengupta/requirey)![Logo](https://www.dropbox.com/s/a89s7cegzye0d79/requirey.png?dl=1)
Intelligent multi-version dependency management for npm packages.
### Install
`npm install --save requirey`### Usage
- #### Initialize
```js
const ry = require('requirey')(config, options);
```
`config` - object of module names mapped to arrays of supported versions
`options` - extra options to override default behaviors like `strict`**Default behavior is strict mode enabled which will always use config to determine which versions can be installed and required**
**Strict mode will ignore version overrides for require calls**
eg:
```js
{
"lodash": ['1.0.0', '2.1.2'],
...
}
```- #### Install
```js
ry.installAll();
```
or
```js
ry.install('lodash');
// or
ry.install('lodash', '1.0.0');
ry.install('lodash', '2.0.0');
```- #### Require
```js
const requirer = new ry.Requirer(pkgJson);requirer.require('lodash'); // ==> highest possible version supported
requirer.require('[email protected]'); // ==> version 1.0.0
requirer.require('lodash', '^2.0.0'); // ==> highest version in the range between 2.0.0 and 3.0.0
requirer.require('lodash', '~2.2.0'); // ==> highest version in the range between 2.2.0 to 2.3.0
requirer.require('lodash/fp/curry'); // ==> require sub-paths from auto-detected version
requirer.require('[email protected]/array/chunk'); // ==> require sub-paths from particular version
```The `require` method also takes an optional third parameter:
`force` - boolean ==> Forces a require call for a particular version
```js
requirer.require('lodash', '4.0.0', true);
```#### Built Using
- [npm-install-version](https://www.npmjs.com/package/npm-install-version)
- [semver](https://www.npmjs.com/package/semver)