-
-
Notifications
You must be signed in to change notification settings - Fork 100
Open
Description
Background
We're currently using yalc for local package testing in our CI workflows. However, we've encountered persistent issues with yalc's interaction with TypeScript compilation, particularly:
- TypeScript cannot resolve node modules (
path,fs, etc.) when run within yalc'sprepublishOnlyhook - Even with
@types/nodein dependencies, module resolution fails in the yalc environment - This forces us to work around the issue by building TypeScript separately before yalc publish
Current Workaround
As of #PR (commit ac5d496), we've implemented a temporary fix:
- Removed
prepublishOnlyscript from package.json - Added explicit TypeScript build step before
yalc publishin CI workflows
Proposed Alternatives
Option 1: npm link (Simplest)
Pros:
- Native to npm/yarn ecosystem
- Better TypeScript support
- No additional tooling required
Cons:
- Can have issues with peer dependencies
- Global link registry can cause conflicts
Migration path:
- Replace
yalc publishwithnpm linkin root - Replace
yalc link shakapackerwithnpm link shakapacker
Option 2: npm pack + file: protocol
Pros:
- Most accurate simulation of real npm install
- No global state issues
- Works reliably with all dependency types
Cons:
- Requires rebuilding and reinstalling for each change
- Slightly more complex CI workflow
Migration path:
- Use
npm packto create tarball - Install via
npm install ../../shakapacker-*.tgz
Option 3: Yarn/npm Workspaces (Best long-term)
Pros:
- Native support for local packages
- Excellent TypeScript support
- Modern monorepo best practice
- Automatic symlinking
Cons:
- Requires restructuring the project
- May need adjustments to existing tooling
Migration path:
- Add workspaces configuration to root package.json
- Move test apps into workspace structure
Discussion Points
- Which approach best fits our project structure and CI requirements?
- Are there other alternatives we should consider?
- What's the timeline for migration?
- Should we maintain backward compatibility during transition?
Related Issues/Context
- Current TypeScript migration: Next Steps: Complete TypeScript Migration for NPM Package #605
- CI workflow files:
.github/workflows/test-bundlers.yml
Metadata
Metadata
Assignees
Labels
No labels