Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/zkochan/sort-pkgs

Sort packages. Dependents first.
https://github.com/zkochan/sort-pkgs

Last synced: 10 days ago
JSON representation

Sort packages. Dependents first.

Awesome Lists containing this project

README

        

# sort-pkgs

> Sort packages. Dependents first.

[![Build Status](https://img.shields.io/travis/zkochan/sort-pkgs/master.svg)](https://travis-ci.org/zkochan/sort-pkgs) [![npm version](https://img.shields.io/npm/v/sort-pkgs.svg)](https://www.npmjs.com/package/sort-pkgs)

## Installation

```
npm i -g sort-pkgs
```

## Usage

```js
const sortPkgs = require('sort-pkgs')

const pkgs = sortPkgs({
'[email protected]': {
manifest: {
name: 'foo',
version: '1.0.0',
},
dependencies: ['[email protected]', '[email protected]']
},
'[email protected]': {
manifest: {
name: 'bar',
version: '2.0.0',
},
dependencies: []
},
'[email protected]': {
manifest: {
name: 'qar',
version: '3.0.0',
},
dependencies: ['[email protected]']
},
})

console.log(pkgs)
//> [
// {
// manifest: {
// name: 'bar',
// version: '2.0.0',
// },
// dependencies: []
// },
// {
// manifest: {
// name: 'qar',
// version: '3.0.0',
// },
// dependencies: ['[email protected]']
// },
// {
// manifest: {
// name: 'foo',
// version: '1.0.0',
// },
// dependencies: ['[email protected]', '[email protected]']
// }
// ]
```

## Related

* [find-packages](https://github.com/zkochan/find-packages) - Find all packages inside a directory
* [pkgs-graph](https://github.com/zkochan/pkgs-graph) - Create a graph from an array of packages

## License

[MIT](LICENSE) © [Zoltan Kochan](http://kochan.io)