FredKSchott/pika-pack

Feature request: lerna integration

Closed this issue ยท 9 comments

First of all, thanks for the great tool! As a developer, I would like to integrate pack into my web components monorepo built with lerna and yarn workspaces, so that I could pack multiple packages at once. Are there any plans regarding this feature?

I actually already use Lerna & @pika/pack together for https://github.com/pikapkg/builders. It's not obvious/painless but there's definitely support for it:

# Update all package versions
lerna exec npm version [patch|minor|major] 
# Rebuild all packages, now with the new updated version
lerna run build 
# Publish!
lerna publish from-package --contents pkg 

I'll update that monorepo's scripts to show this

Thanks for taking a look! Let me know how it goes!

Thanks, will try it out. BTW is it necessary to keep pkg under git repository or it can be added to .gitignore?

Not at all, I should probably remove pkg/ from the official builders repo myself

Update: Added some scripts to the main repo: https://github.com/pikapkg/builders/blob/b9a13c5ba9020353ce5d5cf55434420c1c7c0d4e/package.json#L5-L7 The only tricky one to remember is that npm run version needs a version argument (ex: npm run version patch) otherwise it just outputs rubbish.

It only looks for dependencies in the closest node_modules folder. So in case you have a dev dependency like typescript defined in the root package.json, it isn't able to find it.

Also creating a whole new directory to publish is going to confuse people.

I am using lerna with yarn workspaces enabled.

You can see a Lerna repo working today with @pika/pack & TypeScript here: https://github.com/pikapkg/builders.

I'm not entirely sure what you mean but it's able to find root-level & package-level dependencies fine.

I think the issue is resolved and can be closed unless the problem described by @ritz078 is valid.

give me some time to test it out. Will keep everyone posted. :)

Closing + added a section on Lerna to the README: https://github.com/pikapkg/pack/blob/master/README.md