Skip to content

Enforce Yarn-Only Policy & Auto-Cleanup Forbidden Lock Files #1202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

subhankarmaiti
Copy link
Contributor

@subhankarmaiti subhankarmaiti commented Jun 9, 2025

This PR enforces the use of Yarn as the only package manager for this project and introduces automated cleanup for forbidden lock files and node_modules if npm or pnpm is used.

✨ What’s Changed

  • Added scripts/ensure-yarn.js:
    Checks the package manager during install. If npm or pnpm is detected, it runs scripts/clean-forbidden.sh to remove package-lock.json, pnpm-lock.yaml, and node_modules from both the root and example/ directories, then exits with an error. Also it safely deletes forbidden lock files and node_modules, ignoring errors if files do not exist.
  • 🔄 Updated the preinstall script in package.json to invoke ensure-yarn.js, ensuring this check runs automatically on every install.

🛡️ Why

  • Prevents accidental use of npm or pnpm.
  • Keeps the workspace clean and consistent with a Yarn-only policy.
  • Automatically cleans up unwanted lock files and node_modules if another package manager is used.

🧑‍💻 Impact

  • Contributors and CI will be blocked from using npm or pnpm.
  • Any forbidden files will be automatically cleaned up if attempted.

🧹 No more rogue lock files! Only Yarn is allowed.

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner June 9, 2025 04:05
@subhankarmaiti subhankarmaiti merged commit 6845ebf into beta Jun 11, 2025
4 checks passed
@subhankarmaiti subhankarmaiti deleted the SDK-5979-ensure-yarn branch June 11, 2025 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants