JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q48168F
  • License MIT

Wrapper for https://github.com/npm/npm-registry-client to perform batched actions

Package Exports

  • @qiwi/npm-batch-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@qiwi/npm-batch-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@qiwi/npm-batch-client

Wrapper for https://github.com/npm/npm-registry-client with blackjack promises and batch actions.

Installation

npm install @qiwi/npm-batch-client
yarn add @qiwi/npm-batch-client

Usage

Creating an instance

import { NpmRegClientWrapper, RegClient } from '@qiwi/npm-batch-client'

const wrapper = new NpmRegClientWrapper(
  'https://registry.npmjs.org',
  {
    username: 'username',
    password: 'password'
  }
)

// You can use authorization via token
const wrapperWithTokenAuth = new NpmRegClientWrapper(
  'https://registry.npmjs.org',
  {
    token: 'your token',
  }
)

// You can pass your own npm-registry-client instance as third argument to constructor.
const wrapperWithCustomClientInstance = new NpmRegClientWrapper(
  'https://registry.npmjs.org',
  {
    token: 'your token',
  },
  new RegClient(yourCustomConfig)
)

Deprecate package version by given range and with given message

wrapper.deprecate('foo', '<1.2.0', 'foo <1.2.0 contains critical bugs')

Deprecate list of packages

 const params = [
  {
    packageName: 'foo',
    version: '>1.1.0',
    message: 'foo is deprecated'
  },
  {
    packageName: 'bar',
    version: '*',
    message: 'bar is deprecated'
  },
  {
    packageName: 'baz',
    version: '<1.2.0',
    message: 'baz is deprecated'
  },
]
wrapper.deprecateBatch(params)
wrapper.deprecateBatch(params, true) // if you want to ignore errors when executing a batch of actions

Un-deprecate list of packages

 const params = [
  {
    packageName: 'foo',
    version: '>1.1.0'
  },
  {
    packageName: 'bar',
    version: '*'
  },
  {
    packageName: 'baz',
    version: '<1.2.0'
  },
]
wrapper.unDeprecateBatch(params)
wrapper.unDeprecateBatch(params, true) // if you want to ignore errors when executing a batch of actions