yarnpkg / yarnpkg/berry

[Feature] Add lifecycle script targets for "link"

Open
#5,437 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

NPM natively exposes a number of "pre" and "post" scripts for various package lifecycle events like "install" ("preinstall", "postinstall"), "build" ("prebuild", "postbuild"), etc.

It would be great to extend this behavior to concepts like "link" to enable automatic scripted behaviors. For instance, a "postlink" script might run yarn dedupe to eliminate a duplicate copy of react from the node_modules tree between a component library and consuming application.

Describe the solution you'd like

Add lifecycle scripts for "prelink" and "postlink", such that yarn link triggers "prelink" before running and "postlink" after running.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the yarn link command and compare it with the existing lifecycle-script behavior for other package events. Done means prelink runs before linking and postlink runs after linking, with tests covering both hooks.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.