PHP 8.2.30
Preview: index.ts Size: 984 B
/home/byroehnu/.trash/node_modules11/simple-update-notifier/src/index.ts

import isNpmOrYarn from './isNpmOrYarn';
import hasNewVersion from './hasNewVersion';
import { IUpdate } from './types';
import borderedText from './borderedText';

const simpleUpdateNotifier = async (args: IUpdate) => {
  if (
    !args.alwaysRun &&
    (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))
  ) {
    if (args.debug) {
      console.error('Opting out of running simpleUpdateNotifier()');
    }
    return;
  }

  try {
    const latestVersion = await hasNewVersion(args);
    if (latestVersion) {
      console.error(
        borderedText(`New version of ${args.pkg.name} available!
Current Version: ${args.pkg.version}
Latest Version: ${latestVersion}`)
      );
    }
  } catch (err) {
    // Catch any network errors or cache writing errors so module doesn't cause a crash
    if (args.debug && err instanceof Error) {
      console.error('Unexpected error in simpleUpdateNotifier():', err);
    }
  }
};

export default simpleUpdateNotifier;

Directory Contents

Dirs: 0 × Files: 11

Name Size Perms Modified Actions
371 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
527 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
1.03 KB lrw-r--r-- 2026-02-03 15:06:46
Edit Download
810 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
811 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
2.32 KB lrw-r--r-- 2026-02-03 15:06:46
Edit Download
1.12 KB lrw-r--r-- 2026-02-03 15:06:46
Edit Download
744 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
984 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
444 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download
202 B lrw-r--r-- 2026-02-03 15:06:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).