这是indexloc提供的服务,不要输入任何密码
Skip to content

Update turbo's postinstall script to use optionalDependencies #403

@jaredpalmer

Description

@jaredpalmer

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) (using optionalDependencies)
    • 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.json have the correctly specified keys
  • A custom script will likely be needed when bumping versions of turbo to alter the turbo package's optionalDependencies that should set the versions of each of os-specific packages. This script should also run in the platform-neutral command in turbo's makefile https://github.com/vercel/turborepo/blob/main/cli/Makefile#L112

Resources

Non-goals

  • Improve on esbuild's script in any way. Make as few changes as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions