Skip to content

RFC: Migrate from yalc to alternative local package testing solution #611

@justin808

Description

@justin808

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's prepublishOnly hook
  • Even with @types/node in 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:

  1. Removed prepublishOnly script from package.json
  2. Added explicit TypeScript build step before yalc publish in 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 publish with npm link in root
  • Replace yalc link shakapacker with npm 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 pack to 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

  1. Which approach best fits our project structure and CI requirements?
  2. Are there other alternatives we should consider?
  3. What's the timeline for migration?
  4. Should we maintain backward compatibility during transition?

Related Issues/Context

cc: @justin808 @tomdracz @Judahmeek @G-Rath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions