Skip to content

Conversation

@ppchart
Copy link
Contributor

@ppchart ppchart commented Nov 2, 2022

This PR is used to prompt when using yarn or npm or cnpm to install dependencies, only pnpm is supported

But there is a bug when using npm to install:
the execution of preinstall is after install
so when this prompt is displayed, the dependent packages have already been installed.

has another solution is:
"preinstall": "npx only-allow pnpm", it's use only-allow package be supported by pnpm
This solution has the same bug as above


这个 PR 用来在使用 yarn 或 npm 或 cnpm 安装依赖时,进行提示只支持 pnpm

但使用 npm 安装时有一个 bug:
preinstall 的执行是在 install 安装之后
所以当出现这个提示的时候,依赖包其实已经安装好了。(只能起到提示的作用)

还有一个方案是使用 pnpm 提供的包 (only-allow)[https://github.com/pnpm/only-allow]:

// package.json
"scripts": {
    "preinstall": "npx only-allow pnpm"
}

这个方案也会出现上面说到的 npm 的 bug

@robinv8
Copy link
Contributor

robinv8 commented Nov 2, 2022

Thanks for the contribution

@robinv8 robinv8 merged commit 86ac1f1 into apache:main Nov 2, 2022
@ppchart ppchart deleted the ci-only-use-pnpm branch November 3, 2022 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants