-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Fixes #390
Problem
npx turbo currently fails when in an npm-powered monorepo on Vercel and Netlify because of a user permissions issue related to its use of postinstall script. it works fine with yarn- and pnpm-powered monorepos
Background
The actual turbo npm package is a small wrapper around a postinstall npm script that is responsible for downloading the correct os-specific version of turbo and copying it into position. I (@jaredpalmer) initially copied the script directly from esbuild around March 2021.
Package managers have since started to correctly handle optionalDependencies. esbuild has thus updated its script and its latest iterations fixes the above issue
High Level Solution
- Update/copy
turbo's postinstall script to the latest iteration of esbuild's postinstall ( we only care about node.js, as we don't have a browser target) (usingoptionalDependencies)- Copy it to JS so we don't have a new build step
- Ensure that each of the os-target package's is correct and that their
package.jsonhave the correctly specified keys - A custom script will likely be needed when bumping versions of turbo to alter the
turbopackage'soptionalDependenciesthat should set the versions of each of os-specific packages. This script should also run in theplatform-neutralcommand inturbo's makefile https://github.com/vercel/turborepo/blob/main/cli/Makefile#L112
Resources
- The
turbopackage'sposinstallscript- For reference, see
esbuild's old postinstall script to see differences (they are very very small)
- For reference, see
- The
turbopackage'spackage.json - esbuild's current
postinstallscript (note that it is now split in multiple files) - esbuild's current
package.json - NPM docs on
optionalDependencies - Yarn 2 docs on
optionalDependencies(even though we don't officially support it yet, this script should, since esbuild's script already does) - Yarn 1 docs on
optionalDependencies
Non-goals
- Improve on esbuild's script in any way. Make as few changes as possible.
Metadata
Metadata
Assignees
Labels
No labels