Node.js public

Node Lockfile Check

Share this script safely, inspect its metadata, and copy the exact command you need.

Dashboard

Ready to run

One-liner

Copy the command, then review before execution.
curl -fsSL https://runny.sh/r/BEDPCWMA79FY | node

Current version: 1.1 · Updated by Godmode · 2026-09-07 02:38:59.720

At a glance

Script metadata

Slug
BEDPCWMA79FY
Fetches
0
Size
1383 B · 51 lines
Expires
never
Last fetch
Created
2026-09-07 00:36:01.424
Description
Detect npm, pnpm, or Yarn lockfiles

Readable before runnable

Preview

#!/usr/bin/env node
// Node lockfile check
// Read-only: detects package-lock.json, pnpm-lock.yaml, or yarn.lock in cwd.
// Exit 0 if exactly one lockfile exists, 1 if none or several, 2 if cwd cannot be read.
// Hosted on Runny.sh. Review the script page before you run it.

'use strict';

const fs = require('fs');
const path = require('path');

function note(line) {
  process.stdout.write(String(line) + '\n');
}

note('=== Node lockfile check ===');
note('Cwd:      ' + process.cwd());

const names = ['package-lock.json', 'pnpm-lock.yaml', 'yarn.lock'];
let found;
try {
  found = names.filter((name) => fs.existsSync(path.join(process.cwd(), name)));
} catch (err) {
  note('          CRITICAL: cannot read cwd (' + err.message + ')');
  note('Result: CRITICAL');
  process.exit(2);
}

const hasPkg = fs.existsSync(path.join(process.cwd(), 'package.json'));
note('package.json: ' + (hasPkg ? 'present' : 'absent'));
note('Lockfiles: ' + (found.length ? found.join(', ') : 'none'));

let status = 0;
if (found.length === 1) {
  note('          OK');
} else if (found.length === 0) {
  note('          WARNING: no npm/pnpm/yarn lockfile in cwd');
  status = 1;
} else {
  note('          WARNING: multiple lockfiles; installers may disagree');
  status = 1;
}

note('');
if (status === 0) {
  note('Result: HEALTHY');
} else {
  note('Result: WARNING');
}
process.exit(status);

Raw endpointhttps://runny.sh/r/BEDPCWMA79FY

See something unsafe?

Report this script

Tell us why it should come down. Anyone can also report a URL at /abuse.

Restore revision