6. How does one test lerna packages at exile.watch: locally and in the real world
5 min read
Last updated
5 min read
Last updated
This page is part of list - 6/7
The final part explores how to effectively operate within this environment, focusing not only on local development but also on verifying the correct publication of prereleased packages.
As a starting point, I recommend reading The package manager of exile.watch first. In it, I discuss package linking across all the package managers I evaluated, ultimately choosing npm as my go-to option.
Utilizing npm link
and npm link @exile-watch/<package>
is the straightforward approach that works well most of the time—despite the occasional hiccup when symlinks go out of sync, which isn't a frequent issue and can be managed.
I've detailed the challenges with this method in the previously mentioned post about package managers for those interested in digging deeper.
Yalc offers a solution akin to npm link
, presenting a viable option for linking packages, though its success rate varies (see #217).
When it comes to integrating Yalc with Next.js, the reliability dips even further, as evidenced by mixed results (see #188 and the mirrored issue #35110 on the Vercel repository).
A significant limitation emerges with chain linking.
Why does this matter?
Yalc falls short in resolving dependencies of dependencies (see #95).
For exile.watch, where each package serves as a comprehensive boilerplate focusing on distinct functionalities and configurations, this limitation complicates the testing process in consumer projects, making it a tedious task to ensure package compatibility.
So, outside of using npm link
, how do we test a package in its consumer environment?
Enter our homebuilt automated prerelease system, which versions each release based on the commit hash.
This method is as close as it gets to real-world testing.
Why?
Because it evaluates the package post-bundling, ensuring the changes behave as expected.
Occasionally, local modifications might not carry over after bundling, leading to errors from unsupported syntax (this is a skill issue of mine by sometimes being a dummy :))
You can see it in action here. (I won't elaborate how this action works under the hood here as it deserves it's own post - for now here is the sub-actions section which highlights what each step is responsible for).
(WIP) Next on the line: Dependabot
The links below won't redirect you to the initial page so here you have it for the conclusion of these parts: