Skip to content

chore: scripts/audit-competition-logos.mjs imports sharp without declaring it as a dependency #252

Description

@yakew7

Problem

scripts/audit-competition-logos.mjs (added in #226's follow-up work) does:

import { readFileSync, readdirSync } from "node:fs";
import sharp from "sharp";

but sharp is not listed anywhere in package.json (dependencies or devDependencies):

$ grep -n '"sharp"' package.json
# (no output)

$ npm ls sharp
studymap@2.4.0 /path/to/StudyMap
├─┬ @vercel/og@1.0.1
│ └── sharp@0.35.3
└─┬ next@16.2.9
  └── sharp@0.34.5

The script only works today because sharp happens to be a transitive dependency of @vercel/og and next, and npm's hoisting happens to put a copy where a top-level import sharp can find it. That's not a guarantee — a lockfile change, a different package manager (pnpm doesn't hoist transitive deps by default), or a future version bump of @vercel/og/next that stops depending on sharp (or changes its version) would silently break this script with a confusing Cannot find module 'sharp' or a version mismatch, with nothing in package.json documenting that the script needs it.

Fix

Add sharp as an explicit devDependency in package.json (it's a dev/audit tool, not part of the shipped app) at a version compatible with what's already resolved, and re-run npm install to update the lockfile.

Acceptance criteria

  • sharp is declared in package.json
  • node scripts/audit-competition-logos.mjs still runs correctly after a clean npm ci

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreMaintenance / cleanup

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions