6. How does one test lerna packages at exile.watch: locally and in the real world
5 min read
Last updated
Was this helpful?
5 min read
Last updated
Was this helpful?
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.
A significant limitation emerges with chain linking.
Why does this matter?
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 :))
(WIP) Next on the line: Dependabot
Yalc offers a solution akin to npm link
, presenting a viable option for linking packages, though its success rate varies (see ).
When it comes to integrating Yalc with Next.js, the reliability dips even further, as evidenced by mixed results (see and the mirrored issue on the Vercel repository).
Yalc falls short in resolving dependencies of dependencies (see ).
. (I won't elaborate how this action works under the hood here as it deserves it's own post - for now here is the which highlights what each step is responsible for).
The links below won't redirect you to the initial page so here you have it for the conclusion of these parts: