How to run a postinstall script *after* the package.json file is written? #8479
Unanswered
stevebeauge
asked this question in
Q&A
Replies: 0 comments
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Hi,
I'm maintaining a monorepo (around 30 packages) that has a
postinstall
script at the monorepo root.This script will run a local custom script that should perform some consistency checks across all package.json files and tsconfig.json files.
However, I observe that the script runs before the package.json file is updated.
If I have monorepo with, let's say
shared
andapp1
packages, here is what I observe:node_modules
structurepostinstall
script of the monorepo rootBecause the app1's package.json is not already written when the
postinstall
script is ran, the script fails to detect the newly added packages.Running manually the
postinstall
script solves the issue, but I'd like it to be automatic.First of all, did I understand the pnpm lifecycle correctly ?
Is there anything I can do to execute my script after the package.json files are written ?
Thanks for any suggestion
Beta Was this translation helpful? Give feedback.
All reactions