Skip to content

cover Deno workspaces in setup-github-actions#106

Open
LadyBluenotes wants to merge 4 commits intomainfrom
deno-workspaces-pr
Open

cover Deno workspaces in setup-github-actions#106
LadyBluenotes wants to merge 4 commits intomainfrom
deno-workspaces-pr

Conversation

@LadyBluenotes
Copy link
Copy Markdown
Member

@LadyBluenotes LadyBluenotes commented Mar 30, 2026

Summary

  • add Deno workspace support to readWorkspacePatterns, including deno.json and deno.jsonc
  • handle JSONC comments and trailing commas so Deno workspace config parses cleanly without a new dependency
  • expand coverage across workspace parsing, project context resolution, and setup-github-actions so Deno monorepos resolve their workspace root and monorepo paths correctly

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Deno monorepo configuration (deno.json and deno.jsonc files) for workspace pattern detection.
    • GitHub Actions workflow setup now functions correctly in Deno monorepos, writing workflows to the monorepo root with proper path substitutions.
  • Bug Fixes

    • Improved handling of workspace configurations to safely process both npm and Deno formats.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Mar 30, 2026

View your CI Pipeline Execution ↗ for commit bd5d731

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-30 18:23:17 UTC

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 30, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@106

commit: bd5d731

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

This PR adds support for Deno workspace configuration (deno.json/deno.jsonc) to the monorepo setup system. It includes JSONC parsing utilities, extends workspace pattern resolution to detect Deno configs, and adds tests validating workspace detection and GitHub Actions workflow generation from workspace packages in Deno-based monorepos.

Changes

Cohort / File(s) Summary
Changesets
.changeset/spicy-laws-burn.md
Added patch-level release note documenting Deno monorepo setup coverage for @tanstack/intent.
Core Implementation
packages/intent/src/workspace-patterns.ts
Added lenient JSON/JSONC parsing utilities (stripJsonCommentsAndTrailingCommas, readJsonFile). Extended readWorkspacePatterns to detect and parse Deno config files (deno.json, deno.jsonc), extracting workspace patterns while maintaining precedence for package.json workspaces. Introduced warning-level logging for failed Deno config parsing.
Tests
packages/intent/tests/project-context.test.ts, packages/intent/tests/setup.test.ts, packages/intent/tests/workspace-patterns.test.ts
Added test coverage for: Deno workspace detection in resolveProjectContext, workflow generation from workspace packages with Deno configs, reading workspace patterns from deno.json/deno.jsonc with JSONC comment handling, and error logging for invalid Deno configs.

Sequence Diagram

sequenceDiagram
    participant Setup as runSetupGithubActions
    participant Context as resolveProjectContext
    participant Patterns as readWorkspacePatterns
    participant Reader as File Reader

    Setup->>Context: resolve from workspace package (packages/router)
    Context->>Patterns: read workspace patterns
    Patterns->>Reader: check deno.jsonc
    Reader-->>Patterns: parse & extract workspace: ["packages/*"]
    Patterns-->>Context: return workspace patterns
    Context-->>Setup: monorepo root + workspace patterns
    Setup->>Reader: write workflows to .github/workflows at root
    Reader-->>Setup: notify-intent.yml, check-skills.yml created
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A Deno dream comes into view,
Where workspace roots shine fresh and new,
From JSON comments we now parse free,
Monorepo magic, clear to see!
With workflows dancing at the root,
Our setup flow bears sweeter fruit! 🌿

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main changes but does not follow the repository's required template structure with sections for 🎯 Changes and ✅ Checklist. Reformat the description to match the template: add '## 🎯 Changes' section header before the summary and include the '## ✅ Checklist' section with the required checkboxes for Contributing guide and test verification.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'cover Deno workspaces in setup-github-actions' is specific and directly describes the primary change: adding Deno workspace support to the setup-github-actions workflow.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deno-workspaces-pr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/intent/tests/setup.test.ts (1)

349-360: Minor: usePackageJsonWorkspaces flag is overwritten.

The test passes usePackageJsonWorkspaces: true to createMonorepo, but then immediately overwrites the generated package.json (which would have included workspaces) with one that has no workspaces field. Consider omitting the flag or using false to make the test setup clearer.

Suggested cleanup
   it('writes workflows to the Deno workspace root from a workspace package', () => {
     const monoRoot = createMonorepo({
-      usePackageJsonWorkspaces: true,
       packages: [
         { name: 'router', hasSkills: true },
         { name: 'start', hasSkills: true },
       ],
     })
+
+    // Overwrite root package.json to remove pnpm-workspace.yaml-based detection
+    // so the test relies solely on deno.jsonc for workspace resolution.
+    writeFileSync(
+      join(monoRoot, 'package.json'),
+      JSON.stringify({ name: 'root', private: true }, null, 2),
+    )
+    rmSync(join(monoRoot, 'pnpm-workspace.yaml'), { force: true })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/setup.test.ts` around lines 349 - 360, The test
currently passes usePackageJsonWorkspaces: true to createMonorepo but then
immediately overwrites the generated package.json with writeFileSync, removing
the workspaces field; either remove the flag (usePackageJsonWorkspaces) or set
it to false when calling createMonorepo, or stop overwriting package.json so the
workspaces generated by createMonorepo remain; update the call site using
createMonorepo and/or the subsequent writeFileSync to ensure package.json
content reflects the intended test setup.
packages/intent/src/workspace-patterns.ts (1)

67-77: Consider handling unclosed block comments gracefully.

If a block comment is opened but never closed (e.g., /* unterminated), the loop exits without error and parsing continues with potentially malformed JSON. This is unlikely to cause issues since JSON.parse will fail anyway, but you could optionally emit a more descriptive warning.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/workspace-patterns.ts` around lines 67 - 77, The
block-comment handling loop that checks for "/*" and advances index until "*/"
can run off the end of the input without notice; inside the branch that starts
with if (char === '/' && next === '*') modify the logic to detect EOF after the
inner while (i.e., when index >= source.length) and handle it explicitly: either
emit a descriptive warning (e.g., console.warn with the offending snippet and
position) or throw a SyntaxError so callers get a clear message instead of
continuing to parse malformed JSON; use the existing variables (source, index,
char, next) to build the message and ensure the code still advances/returns
correctly after handling the unclosed comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/intent/src/workspace-patterns.ts`:
- Around line 67-77: The block-comment handling loop that checks for "/*" and
advances index until "*/" can run off the end of the input without notice;
inside the branch that starts with if (char === '/' && next === '*') modify the
logic to detect EOF after the inner while (i.e., when index >= source.length)
and handle it explicitly: either emit a descriptive warning (e.g., console.warn
with the offending snippet and position) or throw a SyntaxError so callers get a
clear message instead of continuing to parse malformed JSON; use the existing
variables (source, index, char, next) to build the message and ensure the code
still advances/returns correctly after handling the unclosed comment.

In `@packages/intent/tests/setup.test.ts`:
- Around line 349-360: The test currently passes usePackageJsonWorkspaces: true
to createMonorepo but then immediately overwrites the generated package.json
with writeFileSync, removing the workspaces field; either remove the flag
(usePackageJsonWorkspaces) or set it to false when calling createMonorepo, or
stop overwriting package.json so the workspaces generated by createMonorepo
remain; update the call site using createMonorepo and/or the subsequent
writeFileSync to ensure package.json content reflects the intended test setup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 641d45c9-9dc4-445a-8a47-08965e6c242e

📥 Commits

Reviewing files that changed from the base of the PR and between 2f29aa2 and bd5d731.

📒 Files selected for processing (5)
  • .changeset/spicy-laws-burn.md
  • packages/intent/src/workspace-patterns.ts
  • packages/intent/tests/project-context.test.ts
  • packages/intent/tests/setup.test.ts
  • packages/intent/tests/workspace-patterns.test.ts

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.

1 participant