CoolFace
Apppublic

opusdev/vector-similarity-api

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes
index.ts35 linesDownload Raw Back to src
1import isNpmOrYarn from './isNpmOrYarn';2import hasNewVersion from './hasNewVersion';3import { IUpdate } from './types';4import borderedText from './borderedText';5 6const simpleUpdateNotifier = async (args: IUpdate) => {7  if (8    !args.alwaysRun &&9    (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))10  ) {11    if (args.debug) {12      console.error('Opting out of running simpleUpdateNotifier()');13    }14    return;15  }16 17  try {18    const latestVersion = await hasNewVersion(args);19    if (latestVersion) {20      console.error(21        borderedText(`New version of ${args.pkg.name} available!22Current Version: ${args.pkg.version}23Latest Version: ${latestVersion}`)24      );25    }26  } catch (err) {27    // Catch any network errors or cache writing errors so module doesn't cause a crash28    if (args.debug && err instanceof Error) {29      console.error('Unexpected error in simpleUpdateNotifier():', err);30    }31  }32};33 34export default simpleUpdateNotifier;35