Skip to content
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

feat: new article on the pnpm hoisting #438

Merged
merged 11 commits into from
Jan 10, 2024
Merged

feat: new article on the pnpm hoisting #438

merged 11 commits into from
Jan 10, 2024

Conversation

jpoissonnet
Copy link
Contributor

I had trouble with an expected behaviour using the node package manager pnpm. I tell the story in this article

@github-actions github-actions bot added the Size/S label Dec 8, 2023
@jpoissonnet jpoissonnet changed the title Hoisting pnpm feat: new article on the pnpm hoisting Dec 8, 2023
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-438.dsvmt7xpjktgx.amplifyapp.com

Copy link
Contributor

@EtienneDOYON EtienneDOYON left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Franchement un super article, bien joué 👏


# Comprendre la configuration de pnpm
## Hoisting des dépendances
Pour comprendre la configuration `public-hoist-pattern` il faut d’abord comprendre comment sont formés les `node_modules` par pnpm. Pnpm ne va mettre dans le dossier `node_modules` en racine uniquement les dépendances directes du projet, toutes les sous-dépendances seront placées dans un dossier caché .pnpm et un lien symbolique sera créé.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Pour comprendre la configuration `public-hoist-pattern` il faut d’abord comprendre comment sont formés les `node_modules` par pnpm. Pnpm ne va mettre dans le dossier `node_modules` en racine uniquement les dépendances directes du projet, toutes les sous-dépendances seront placées dans un dossier caché .pnpm et un lien symbolique sera créé.
Pour comprendre la configuration `public-hoist-pattern` il faut d’abord comprendre comment sont formés les `node_modules` par pnpm. Pnpm ne va mettre dans le dossier `node_modules` en racine qu'uniquement les dépendances directes du projet, toutes les sous-dépendances seront placées dans un dossier caché .pnpm et un lien symbolique sera créé.

Copy link
Member

@fdubost fdubost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Bravo pour ce premier petit traité de debuggage 💪


`public-hoist-pattern` permet d’indiquer quelles dépendances on veut forcer à être dans le dossier `node_modules` racine plutôt que `node_modules/.pnpm`.

La ligne `public-hoist-pattern[]=*jest*` veut donc dire qu’on ajoute jest aux dépendances qui sont accessibles depuis la racine et ainsi l’exécutable dans `node_modules/.bin` . Cela permet par exemple de déléguer la configuration et l’import de jest dans un package enfant du repository.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top l'explication 👍

Copy link
Member

@t-geindre t-geindre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

@jpoissonnet jpoissonnet merged commit c172757 into master Jan 10, 2024
3 checks passed
@jpoissonnet jpoissonnet deleted the hoisting-pnpm branch January 10, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants