Skip to content

int64ago/update-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

update-notifier with custom scope registry

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published