Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Jan 2, 2026

Sharing code by putting it in a workspace package and importing it on both the web and api sides now work, but the feature isn't polished enough for general availability yet. But I still want users to be able to experiment with this new feature, so I'm putting it behind an experimental flag.

Just add this to your redwood.toml file to enable the feature

[experimental.packagesWorkspace]
  enabled = true

@netlify
Copy link

netlify bot commented Jan 2, 2026

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit 8685a76
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/69579371d659480008afb7a9

@github-actions github-actions bot added this to the next-release milestone Jan 2, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 2, 2026

Greptile Summary

Added experimental feature flag for workspace packages functionality. The generate package command now requires users to explicitly enable [experimental.packagesWorkspace] enabled = true in their redwood.toml file.

  • Added packagesWorkspace.enabled boolean flag to the experimental config section in config.ts with default value of false
  • Implemented guard check in packageHandler.js that exits early with helpful error message and link to release notes if feature is not enabled
  • Updated test snapshot to reflect new config structure
  • Implementation follows existing pattern used by other experimental features like opentelemetry, rsc, and reactCompiler

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation of a feature flag following established patterns in the codebase. The changes are minimal, well-contained, and only affect the gating of an experimental feature. No breaking changes, proper error handling, and consistent with existing experimental flag implementations.
  • No files require special attention

Important Files Changed

Filename Overview
packages/cli/src/commands/generate/package/packageHandler.js Added experimental feature flag check to gate generate package command execution
packages/project-config/src/config.ts Added packagesWorkspace.enabled config to experimental section with default value false
packages/project-config/src/tests/config.test.ts Updated test snapshot to include new packagesWorkspace experimental config

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as CLI Handler
    participant Config as Project Config
    participant Terminal as Terminal Output
    
    User->>CLI: Run generate package command
    CLI->>CLI: Validate package name
    CLI->>Config: getConfig().experimental.packagesWorkspace.enabled
    
    alt Feature flag disabled
        Config-->>CLI: enabled = false
        CLI->>Terminal: Log error message
        CLI->>Terminal: Log instructions with release notes link
        CLI-->>User: Exit early
    else Feature flag enabled
        Config-->>CLI: enabled = true
        CLI->>CLI: Parse package name variants
        CLI->>CLI: Update workspace config
        CLI->>CLI: Update tsconfig
        CLI->>CLI: Generate package files
        CLI->>CLI: Install and build
        CLI->>CLI: Run ESLint cleanup
        CLI-->>User: Package created successfully
    end
Loading

@nx-cloud
Copy link

nx-cloud bot commented Jan 2, 2026

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 8685a76

Command Status Duration Result
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 2s View ↗
nx run-many -t test --minWorkers=1 --maxWorkers=4 ✅ Succeeded 3m 52s View ↗
nx run-many -t build ✅ Succeeded 3m 28s View ↗
nx run-many -t test:types ✅ Succeeded 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-02 10:01:47 UTC

@Tobbe Tobbe merged commit 55b9901 into main Jan 2, 2026
42 checks passed
@Tobbe Tobbe deleted the tobbe-feat-generate-package-exp-flag branch January 2, 2026 10:02
@Tobbe Tobbe modified the milestones: next-release, v2.3.0 Jan 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants