Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix parallel install from local directory #398

Merged
merged 1 commit into from
Apr 21, 2022
Merged

Conversation

dead-horse
Copy link
Member

No description provided.

// use npm pack to ensure npmignore/gitignore/package.files work fine
const res = await cp.exec('npm pack', { cwd: filepath });
const res = await cp.exec('npm pack', { cwd: tmpDir });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm pack 没有提供指定打包位置的方式,最保险就是把整体放到一个临时目录来打包,避免并发时的冲突。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会慢一点,但是使用 local 的包应该不多,影响不大。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.npmjs.com/cli/v8/commands/npm-pack#pack-destination npm8 有这个。下个月我们可以升级到这个版本。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

等不了下个月了,先解决问题...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

升级到 npm8 的时候重构一下就行

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs.npmjs.com/cli/v8/commands/npm-pack#pack-destination npm8 有这个。下个月我们可以升级到这个版本。

这个也看到了,等升级 npm 8 的时候我来蹭 PR 吧 hhhh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

想到一种更好的方法。可以用 npm-packlist 这个包获取到所有的文件,然后直接 cp 就好了,不需要 tgz 了。

Copy link
Contributor

@killagu killagu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dead-horse dead-horse merged commit 08b5f88 into 5.x Apr 21, 2022
@dead-horse dead-horse deleted the fix-local-install branch April 21, 2022 11:43
@dead-horse
Copy link
Member Author

我只发到 5.8.1,6.x 到时候升级到 npm8 重新实现?

vagusX pushed a commit to vagusX/npminstall that referenced this pull request Aug 26, 2022
gemwuu pushed a commit that referenced this pull request Aug 26, 2022
* fix: fix parallel install from local directory (#398)

* fix: parallel install from local directory

Co-authored-by: Yiyu He <dead_horse@qq.com>
vagusX added a commit to vagusX/npminstall that referenced this pull request Oct 17, 2022
…m#412)

* fix: fix parallel install from local directory (cnpm#398)

* fix: parallel install from local directory

Co-authored-by: Yiyu He <dead_horse@qq.com>
gemwuu pushed a commit that referenced this pull request Oct 17, 2022
…421)

* fix: fix parallel install from local directory (#398)

* fix: parallel install from local directory

Co-authored-by: Yiyu He <dead_horse@qq.com>

Co-authored-by: Yiyu He <dead_horse@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants