Skip to content

Utility for performing batch actions on given NPM registry

License

Notifications You must be signed in to change notification settings

qiwi/npm-batch-action

Repository files navigation

@qiwi/npm-batch-client-monorepo

Build Status Test Coverage Maintainability

Packages for performing batched actions on NPM registry.

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

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

const wrapper = new NpmRegClientWrapper(
  'https://registry.npmjs.org',
  {
    username: 'username',
    password: 'password'
  }
)
wrapper.deprecate('foo', '<1.2.0', 'foo <1.2.0 contains critical bugs')

CLI utility for performing batched npm actions.

npx @qiwi/npm-batch-cli --config=config.json

config.json:

{
    "registryUrl": "https://registry.npmjs.org",
    "auth": {
        "token": "12345678-1234-1234-1234-12345678"
    },
    "action": "deprecate",
    "data": [
        {
            "packageName": "foo",
            "version": "*",
            "message": "foo is deprecated"
        },
        {
            "packageName": "bar",
            "version": "<1.3.2",
            "message": "bar@<1.3.2 contains critical vulnerabilities"
        },
        ...
    ]
}

The same as @qiwi/npm-batch-cli, but with configuring via a pipeline.

cat config.json | npx @qiwi/npm-batch-cli-pipe

API for npm-batch CLI utilities.

import { readConfigAndRun } from '@qiwi/npm-batch-cli-api'

readConfigAndRun({ config: 'config.json' })
    .then(() => console.log('Done.'))

License

MIT