0x80 / isolate-package

Isolate a monorepo package with its internal dependencies to form a self-contained directory with a pruned lockfile
MIT License
121 stars 13 forks source link

add functionality to omit scripts section in package.json #23

Closed jieey1140 closed 1 year ago

jieey1140 commented 1 year ago

Firebase Functions relies on the build script from package.json. However, Cloud Build only recognizes npm, not pnpm, leading to issues with commands like pnpm nest build. To resolve this, the script section from package.json is removed, as there is no need to rerun the script commands when the file, which should already be built and ready for deployment, is being deployed.

Ensure smooth deployments in a pnpm environment by utilizing the omitScripts option to prevent issues during deployment.

============ I am submitting this pull request due to the aforementioned issue. Currently, I am using a separately crafted "remove package script," but integrating it into isolate would be splendid as it would not only streamline the build step during a Firebase deploy but also add an additional feature to isolate!

Please consider the above matter! 😄

jieey1140 commented 1 year ago

@0x80

We execute scripts with this naming convention:

"build": "silvia-script functions:build",

Within this, it builds the necessary monorepo modules. When the script module is outside, it cannot read the command inside without prefixing it with pnpm, hence we inserted pnpm.

Also, in our CI pipeline, we build using nest and execute firebase deploy.

We've noticed that when there’s a build in the scripts section, it builds upon the already built files, elongating the cloud build time.

Thus, our approach has been to exclude the script part and deploy.

I’ve checked the commit content that used to be there and has since disappeared! I’m going to close this PR.

Thank you for letting me know!

0x80 commented 1 year ago

@jieey1140 I forgot why I got the request to include the scripts but someone needed it. Maybe as a compromise, we can only omit the "scripts.build" and leave the other scripts in tact :)

I'll look up what the issue was with omitting scripts...

0x80 commented 10 months ago

@jieey1140 There are now configuration options to pick or omit specific scripts from the output manifest. Also, all package managers now output correct lockfiles and you can choose to force output in NPM format for deployment.