Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/stale-dep. Check if your node_modules is stale.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031import consola from 'consola'import { resolveCommand, type AgentName } from 'package-manager-detector'import { calcHash, calcMtime, checkHash, checkMtime, storeHash, storeMtime,} from './index.ts'
export async function update(pm: AgentName): Promise<void> { await Promise.all([ calcHash(pm).then((hash) => storeHash(hash)), calcMtime(pm).then((mtime) => storeMtime(mtime)), ]) consola.success('Updated dependency snapshot')}
export async function check(pm: AgentName): Promise<void> { if (!(await checkMtime(pm)) && !(await checkHash(pm))) { const cmd = resolveCommand(pm, 'install', []) if (!cmd) throw new Error(`No install command found for ${pm}.`)
const cmdStr = `${cmd.command} ${cmd.args.join(' ')}` throw new Error( `Your node_modules is stale. Please run \`${cmdStr}\` first.`, ) }}