@hspkg/update-notifier

update-notifier with custom scope registry

Usage no npm install needed!

<script type="module">
  import hspkgUpdateNotifier from 'https://cdn.skypack.dev/@hspkg/update-notifier';
</script>

README

update-notifier

NPM version Downloads

update-notifier with custom scope registry

Usage

No new concept, use update-notifier under the hood.

npm i @hspkg/update-notifier -S
const chalk = require('chalk')
const updateNotifier = require('@hspkg/update-notifier')
const pkg = require('./package.json')

const notifier = updateNotifier({
  // optional, default is package scope
  scope: '@ali',
  // optional, default is https://registry.npmjs.org
  registry: 'https://registry.npm.taobao.org',
})({ pkg })

// optional, the same as update-notifier
notifier.update && notifier.notify({
  message: `发现新版本 ${chalk.gray(notifier.update.current)} -> ${chalk.green(notifier.update.latest)}
  运行 ${chalk.cyan('cnpm i -g ') + notifier.packageName} 更新`
})

// Put your code here

Tips

The tool writes custom registry into $HOME/.config/npm whose priority is lower than $HOME/.npmrc, so users can override the custom registry in $HOME/.npmrc.

License

MIT © Cody Chan