update-notifier icon indicating copy to clipboard operation
update-notifier copied to clipboard

Notify Option to show Changelog in default message.

Open karanshah-browserstack opened this issue 4 years ago • 4 comments

Add a option to add ChangeLog message in default message. Example :

  ╭──────────────────────────────────╮
   │                                                                                                                                  │
   │                          Update available 0.9.2 → 1.2.0                                                     │
   │    Changelog: https://github.com/sindresorhus/public-ip/releases/tag/v1.2.0  │
   │                         Run npm i -g public-ip to update                                                  │
   │                                                                                                                                  │
   ╰──────────────────────────────────╯

karanshah-browserstack avatar Oct 07 '21 15:10 karanshah-browserstack

I also want to know how to add a link to the change log.

Like npm does it:

╭───────────────────────────────────────────────────────────────╮
│                                                               │
│      New major version of npm available! 6.14.15 → 8.3.0      │
│   Changelog: https://github.com/npm/cli/releases/tag/v8.3.0   │
│               Run npm install -g npm to update!               │
│                                                               │
╰───────────────────────────────────────────────────────────────╯

macCesar avatar Jan 01 '22 00:01 macCesar

It will be good to have it as a property, but actually you can do it using the custom message option:

https://github.com/yeoman/update-notifier#options-and-custom-message

equiman avatar Jul 01 '22 17:07 equiman

If that's any useful, I am now using the following custom message based on this thread and https://github.com/yeoman/update-notifier/blob/main/update-notifier.js#L152-L156:

if (notifier.update) {
  notifier.notify({
    message: `New ${notifier.update.type} version available: ${chalk.dim(
      '{currentVersion}',
    )}${chalk.reset(' → ')}${
      notifier.update.type === 'major' ? chalk.red('{latestVersion}')
        : notifier.update.type === 'minor' ? chalk.yellow('{latestVersion}')
        : chalk.green('{latestVersion}')
    }\n` +
    `Run ${chalk.cyan('{updateCommand}')} to update\n` +
    '${chalk.dim.underline(`${packageJson.homepage ?? ''}/releases`)}`,
  });
}

Result:

Screen Shot 2022-08-25 at 6 45 43 PM

I would love for this to be the default! Or at the very least be able to append to the default template without having to re-specify it entirely!

astorije avatar Aug 25 '22 22:08 astorije

@equiman Use https://github.com/sindresorhus/terminal-link

LitoMore avatar Aug 29 '22 05:08 LitoMore