├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── access.js
├── adduser.js
├── appveyor.yml
├── config.js
├── extract.js
├── fetch.js
├── get-prefix.js
├── hook.js
├── index.js
├── link-bin.js
├── log.js
├── logical-tree.js
├── login.js
├── manifest.js
├── org.js
├── package-lock.json
├── package.json
├── packument.js
├── parse-arg.js
├── profile.js
├── publish.js
├── read-json.js
├── run-script.js
├── search.js
├── stringify-package.js
├── tarball.js
├── team.js
├── test
├── index.js
└── util
│ └── tnock.js
├── unpublish.js
└── verify-lock.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /.nyc_output
3 | /test/cache
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: false
3 | node_js:
4 | - "12"
5 | - "10"
6 | - "8"
7 | - "6"
8 | os:
9 | - linux
10 | - windows
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 |
6 | ## [3.0.1](https://github.com/npm/libnpm/compare/v3.0.0...v3.0.1) (2019-07-16)
7 |
8 |
9 |
10 |
11 | # [3.0.0](https://github.com/npm/libnpm/compare/v2.0.1...v3.0.0) (2019-07-10)
12 |
13 |
14 | * npm-lifecycle@3.0.0 ([56cc8e5](https://github.com/npm/libnpm/commit/56cc8e5))
15 |
16 |
17 | ### BREAKING CHANGES
18 |
19 | * requires updating node-gyp in npm/cli
20 |
21 |
22 |
23 |
24 | ## [2.0.1](https://github.com/npm/libnpm/compare/v2.0.0...v2.0.1) (2018-12-05)
25 |
26 |
27 | ### Bug Fixes
28 |
29 | * **read-json:** use bluebird for promisification ([8dddde6](https://github.com/npm/libnpm/commit/8dddde6))
30 |
31 |
32 |
33 |
34 | # [2.0.0](https://github.com/npm/libnpm/compare/v1.5.0...v2.0.0) (2018-11-27)
35 |
36 |
37 | ### deps
38 |
39 | * bump all libs ([83ae929](https://github.com/npm/libnpm/commit/83ae929))
40 |
41 |
42 | ### BREAKING CHANGES
43 |
44 | * This includes a breaking libnpmaccess patch
45 |
46 |
47 |
48 |
49 | # [1.5.0](https://github.com/npm/libnpm/compare/v1.4.0...v1.5.0) (2018-11-26)
50 |
51 |
52 | ### Features
53 |
54 | * **pacote:** minimal requires for pacote-related APIs ([e19ce11](https://github.com/npm/libnpm/commit/e19ce11))
55 |
56 |
57 |
58 |
59 | # [1.4.0](https://github.com/npm/libnpm/compare/v1.3.0...v1.4.0) (2018-11-13)
60 |
61 |
62 | ### Features
63 |
64 | * **libnpm:** add support for partial requires ([7ba10a7](https://github.com/npm/libnpm/commit/7ba10a7))
65 |
66 |
67 |
68 |
69 | # [1.3.0](https://github.com/npm/libnpm/compare/v1.2.0...v1.3.0) (2018-11-07)
70 |
71 |
72 | ### Features
73 |
74 | * **bin:** add binLinks lib ([2f4d551](https://github.com/npm/libnpm/commit/2f4d551))
75 |
76 |
77 |
78 |
79 | # [1.2.0](https://github.com/npm/libnpm/compare/v1.1.0...v1.2.0) (2018-11-07)
80 |
81 |
82 | ### Features
83 |
84 | * **log:** add npmlog to the bundle ([c20abd1](https://github.com/npm/libnpm/commit/c20abd1))
85 |
86 |
87 |
88 |
89 | # [1.1.0](https://github.com/npm/libnpm/compare/v1.0.0...v1.1.0) (2018-11-07)
90 |
91 |
92 | ### Features
93 |
94 | * **config:** add libnpmconfig ([6a44725](https://github.com/npm/libnpm/commit/6a44725))
95 | * **json+tree:** add read-package-json and npm-logical-tree ([0198a91](https://github.com/npm/libnpm/commit/0198a91))
96 | * **lock+prefix:** add lock-verify and find-npm-prefix ([00750c9](https://github.com/npm/libnpm/commit/00750c9))
97 | * **parseArg:** add npm-package-arg ([5712614](https://github.com/npm/libnpm/commit/5712614))
98 | * **stringify:** add stringify-package ([0ec5bba](https://github.com/npm/libnpm/commit/0ec5bba))
99 |
100 |
101 |
102 |
103 | # [1.0.0](https://github.com/npm/libnpm/compare/v0.0.1...v1.0.0) (2018-08-31)
104 |
105 |
106 | ### Features
107 |
108 | * **api:** document and export libnpm api ([f85f8f8](https://github.com/npm/libnpm/commit/f85f8f8))
109 |
110 |
111 |
112 |
113 | ## 0.0.1 (2018-04-04)
114 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | ISC License
2 |
3 | Copyright (c) npm, Inc.
4 |
5 | Permission to use, copy, modify, and/or distribute this software for
6 | any purpose with or without fee is hereby granted, provided that the
7 | above copyright notice and this permission notice appear in all copies.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE COPYRIGHT HOLDER DISCLAIMS
10 | ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 | WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 | COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
13 | CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
14 | OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 | OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
16 | USE OR PERFORMANCE OF THIS SOFTWARE.
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # libnpm
2 |
3 | [`libnpm`](https://github.com/npm/libnpm) is the programmatic API for npm.
4 |
5 | For bug reports and support, please head over to [npm.community](https://npm.community).
6 |
7 |
8 | ## Install
9 |
10 | `$ npm install libnpm`
11 |
12 | ## Table of Contents
13 |
14 | * [Example](#example)
15 | * [Features](#features)
16 | * [API](#api)
17 | * Fetching Packages and Their Info
18 | * [`manifest`](https://www.npmjs.com/package/pacote#manifest)
19 | * [`packument`](https://www.npmjs.com/package/pacote#packument)
20 | * [`tarball`](https://www.npmjs.com/package/pacote#tarball)
21 | * [`extract`](https://www.npmjs.com/package/pacote#extract)
22 | * [`search`](https://npm.im/libnpmsearch)
23 | * Package-related Registry APIs
24 | * [`publish`]()
25 | * [`unpublish`](#unpublish)
26 | * [`access`](https://npm.im/libnpmaccess)
27 | * Account-related Registry APIs
28 | * [`login`](https://www.npmjs.com/package/npm-profile#login)
29 | * [`adduser`](https://www.npmjs.com/package/npm-profile#adduser)
30 | * [`profile`](https://npm.im/npm-profile)
31 | * [`hook`](https://npm.im/libnpmhook)
32 | * [`team`](https://npm.im/libnpmteam)
33 | * [`org`](https://npm.im/libnpmorg)
34 | * Miscellaneous
35 | * [`parseArg`](https://npm.im/npm-package-arg)
36 | * [`config`](https://npm.im/libnpmconfig)
37 | * [`readJSON`](https://npm.im/read-package-json)
38 | * [`verifyLock`](https://npm.im/lock-verify)
39 | * [`getPrefix`](https://npm.im/find-npm-prefix)
40 | * [`logicalTree`](https://npm.im/npm-logical-tree)
41 | * [`stringifyPackage`](https://npm.im/stringify-package)
42 | * [`runScript`](https://www.npmjs.com/package/npm-lifecycle)
43 | * [`log`](https://npm.im/npmlog)
44 | * [`fetch`](https://npm.im/npm-registry-fetch) (plain ol' client for registry interaction)
45 | * [`linkBin`](https://npm.im/bin-links)
46 |
47 | ### Example
48 |
49 | ```javascript
50 | await libnpm.manifest('libnpm') // => Manifest { name: 'libnpm', ... }
51 | ```
52 |
53 | ### API
54 |
55 | This package re-exports the APIs from other packages for convenience. Refer to
56 | the [table of contents](#table-of-contents) for detailed documentation on each
57 | individual exported API.
58 |
--------------------------------------------------------------------------------
/access.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmaccess')
4 |
--------------------------------------------------------------------------------
/adduser.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-profile').adduser
4 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | environment:
2 | matrix:
3 | - nodejs_version: "9"
4 | - nodejs_version: "8"
5 | - nodejs_version: "7"
6 | - nodejs_version: "6"
7 |
8 | platform:
9 | - x64
10 |
11 | install:
12 | - ps: Install-Product node $env:nodejs_version $env:platform
13 | - npm config set spin false
14 | - npm install
15 |
16 | test_script:
17 | - npm test
18 |
19 | matrix:
20 | fast_finish: true
21 |
22 | build: off
23 |
--------------------------------------------------------------------------------
/config.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmconfig')
4 |
--------------------------------------------------------------------------------
/extract.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('pacote/extract')
4 |
--------------------------------------------------------------------------------
/fetch.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-registry-fetch')
4 |
--------------------------------------------------------------------------------
/get-prefix.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('find-npm-prefix')
4 |
--------------------------------------------------------------------------------
/hook.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmhook')
4 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = {
4 | config: require('./config.js'),
5 | parseArg: require('./parse-arg.js'),
6 | readJSON: require('./read-json.js'),
7 | logicalTree: require('./logical-tree.js'),
8 | getPrefix: require('./get-prefix.js'),
9 | verifyLock: require('./verify-lock.js'),
10 | stringifyPackage: require('./stringify-package.js'),
11 | manifest: require('./manifest.js'),
12 | tarball: require('./tarball.js'),
13 | extract: require('./extract.js'),
14 | packument: require('./packument.js'),
15 | hook: require('./hook.js'),
16 | access: require('./access.js'),
17 | search: require('./search.js'),
18 | team: require('./team.js'),
19 | org: require('./org.js'),
20 | fetch: require('./fetch.js'),
21 | login: require('./login.js'),
22 | adduser: require('./adduser.js'),
23 | profile: require('./profile.js'),
24 | publish: require('./publish.js'),
25 | unpublish: require('./unpublish.js'),
26 | runScript: require('./run-script.js'),
27 | log: require('./log.js'),
28 | linkBin: require('./link-bin.js')
29 | }
30 |
--------------------------------------------------------------------------------
/link-bin.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('bin-links')
4 |
--------------------------------------------------------------------------------
/log.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npmlog')
4 |
--------------------------------------------------------------------------------
/logical-tree.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-logical-tree')
4 |
--------------------------------------------------------------------------------
/login.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-profile').login
4 |
--------------------------------------------------------------------------------
/manifest.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('pacote/manifest')
4 |
--------------------------------------------------------------------------------
/org.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmorg')
4 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "libnpm",
3 | "version": "3.0.1",
4 | "description": "Collection of programmatic APIs for the npm CLI",
5 | "main": "index.js",
6 | "files": [
7 | "*.js",
8 | "lib"
9 | ],
10 | "scripts": {
11 | "prerelease": "npm t",
12 | "postrelease": "npm publish && git push --follow-tags",
13 | "pretest": "standard",
14 | "release": "standard-version -s",
15 | "test": "tap -J --coverage test/*.js",
16 | "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
17 | "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
18 | },
19 | "repository": "https://github.com/npm/libnpm",
20 | "keywords": [
21 | "npm",
22 | "api",
23 | "package manager",
24 | "lib"
25 | ],
26 | "author": "Kat Marchán ",
27 | "license": "ISC",
28 | "dependencies": {
29 | "bin-links": "^1.1.2",
30 | "bluebird": "^3.5.3",
31 | "find-npm-prefix": "^1.0.2",
32 | "libnpmaccess": "^3.0.2",
33 | "libnpmconfig": "^1.2.1",
34 | "libnpmhook": "^5.0.3",
35 | "libnpmorg": "^1.0.1",
36 | "libnpmpublish": "^1.1.2",
37 | "libnpmsearch": "^2.0.2",
38 | "libnpmteam": "^1.0.2",
39 | "lock-verify": "^2.0.2",
40 | "npm-lifecycle": "^3.0.0",
41 | "npm-logical-tree": "^1.2.1",
42 | "npm-package-arg": "^6.1.0",
43 | "npm-profile": "^4.0.2",
44 | "npm-registry-fetch": "^4.0.0",
45 | "npmlog": "^4.1.2",
46 | "pacote": "^9.5.3",
47 | "read-package-json": "^2.0.13",
48 | "stringify-package": "^1.0.0"
49 | },
50 | "devDependencies": {
51 | "nock": "^9.2.3",
52 | "standard": "^11.0.1",
53 | "standard-version": "^4.3.0",
54 | "tap": "^12.0.1",
55 | "weallbehave": "^1.2.0",
56 | "weallcontribute": "^1.0.8"
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/packument.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('pacote/packument')
4 |
--------------------------------------------------------------------------------
/parse-arg.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-package-arg')
4 |
--------------------------------------------------------------------------------
/profile.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-profile')
4 |
--------------------------------------------------------------------------------
/publish.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmpublish').publish
4 |
--------------------------------------------------------------------------------
/read-json.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('bluebird').promisify(require('read-package-json'))
4 |
--------------------------------------------------------------------------------
/run-script.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('npm-lifecycle')
4 |
--------------------------------------------------------------------------------
/search.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmsearch')
4 |
--------------------------------------------------------------------------------
/stringify-package.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('stringify-package')
4 |
--------------------------------------------------------------------------------
/tarball.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('pacote/tarball')
4 |
--------------------------------------------------------------------------------
/team.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmteam')
4 |
--------------------------------------------------------------------------------
/test/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const test = require('tap').test
4 |
5 | test('it works')
6 |
--------------------------------------------------------------------------------
/test/util/tnock.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | const nock = require('nock')
4 |
5 | module.exports = tnock
6 | function tnock (t, host) {
7 | const server = nock(host)
8 | t.tearDown(function () {
9 | server.done()
10 | })
11 | return server
12 | }
13 |
--------------------------------------------------------------------------------
/unpublish.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('libnpmpublish').unpublish
4 |
--------------------------------------------------------------------------------
/verify-lock.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 |
3 | module.exports = require('lock-verify')
4 |
--------------------------------------------------------------------------------