Skip to content

Conversation

@Tobbe
Copy link
Member

@Tobbe Tobbe commented Jan 3, 2026

Having workspace packages in our test-project fixture, including code to add them using the Cedar CLI is the best way to ensure the feature works and no regressions are introduced in the future

@github-actions github-actions bot added this to the chore milestone Jan 3, 2026
@netlify
Copy link

netlify bot commented Jan 3, 2026

Deploy Preview for cedarjs canceled.

Name Link
🔨 Latest commit d457c97
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/695a7cfb7c126800072e0ee0

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 3, 2026

Greptile Summary

Refactored the build command structure by extracting package building logic into a separate buildPackagesTask.js module and reorganizing files into a build/ subdirectory. Added comprehensive tests for buildPackagesTask covering both wildcard expansion (packages/*) and specific workspace building scenarios.

Key Changes:

  • Moved buildHandler.js from commands/ to commands/build/ subdirectory
  • Extracted package building logic from inline implementation in buildHandler.js to standalone buildPackagesTask.js module
  • Moved test file to align with new directory structure
  • Added new test suite buildPackagesTask.test.js with test cases for wildcard expansion and specific workspace builds
  • Enhanced test mocks to improve test performance (from ~2s to ~250ms for collect phase)
  • Renamed variable restWorkspaces to more descriptive nonApiWebWorkspaces

Benefits:

  • Improved code organization and separation of concerns
  • Better testability with isolated package building logic
  • More comprehensive test coverage for workspace building scenarios
  • Faster test execution through aggressive mocking

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • This is a well-executed refactoring with proper test coverage. The code changes are straightforward: moving files to a new directory structure and extracting logic into a testable module. All imports are correctly updated, and new comprehensive tests verify the extracted functionality works correctly. The refactoring improves code organization without changing behavior.
  • No files require special attention

Important Files Changed

Filename Overview
packages/cli/src/commands/build/tests/buildPackagesTask.test.js New test file with comprehensive test cases for buildPackagesTask function
packages/cli/src/commands/build/buildHandler.js File moved and refactored to extract package building logic into separate module
packages/cli/src/commands/build/buildPackagesTask.js New module extracted from buildHandler containing package building logic

Sequence Diagram

sequenceDiagram
    participant User
    participant BuildCommand as build.js
    participant BuildHandler as buildHandler.js
    participant BuildPackages as buildPackagesTask.js
    participant FS as FileSystem
    participant Concurrently

    User->>BuildCommand: cedar build [workspace]
    BuildCommand->>BuildHandler: handler(options)
    
    alt nonApiWebWorkspaces.length > 0
        BuildHandler->>BuildPackages: buildPackagesTask(nonApiWebWorkspaces)
        
        alt workspace includes 'packages/*'
            BuildPackages->>FS: glob(cedarPaths.packages/*)
            FS-->>BuildPackages: ['/path/to/pkg1', '/path/to/pkg2']
        else specific workspaces
            BuildPackages->>FS: existsSync(workspacePath)
            FS-->>BuildPackages: true/false
        end
        
        BuildPackages->>Concurrently: run yarn build in parallel
        Concurrently-->>BuildPackages: result promise
        BuildPackages-->>BuildHandler: completed
    end
    
    BuildHandler->>BuildHandler: continue with other build tasks
    BuildHandler-->>BuildCommand: build complete
    BuildCommand-->>User: success
Loading

@nx-cloud
Copy link

nx-cloud bot commented Jan 3, 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 d457c97

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

☁️ Nx Cloud last updated this comment at 2026-01-04 15:01:29 UTC

@Tobbe Tobbe changed the title chore(cli): Add tests for building workspace packages chore(cli): workspace packages: cedar build test and test-fixture Jan 3, 2026
@Tobbe Tobbe changed the title chore(cli): workspace packages: cedar build test and test-fixture chore(cli): workspace packages: cedar build test + test project fixture Jan 3, 2026
@Tobbe Tobbe changed the title chore(cli): workspace packages: cedar build test + test project fixture chore(cli): Add workspace packages to test-project fixture Jan 4, 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