cover Deno workspaces in setup-github-actions#106
cover Deno workspaces in setup-github-actions#106LadyBluenotes wants to merge 4 commits intomainfrom
Conversation
|
View your CI Pipeline Execution ↗ for commit bd5d731
☁️ Nx Cloud last updated this comment at |
commit: |
📝 WalkthroughWalkthroughThis 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/intent/tests/setup.test.ts (1)
349-360: Minor:usePackageJsonWorkspacesflag is overwritten.The test passes
usePackageJsonWorkspaces: truetocreateMonorepo, but then immediately overwrites the generatedpackage.json(which would have includedworkspaces) with one that has no workspaces field. Consider omitting the flag or usingfalseto 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 sinceJSON.parsewill 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
📒 Files selected for processing (5)
.changeset/spicy-laws-burn.mdpackages/intent/src/workspace-patterns.tspackages/intent/tests/project-context.test.tspackages/intent/tests/setup.test.tspackages/intent/tests/workspace-patterns.test.ts
Summary
Summary by CodeRabbit
Release Notes
New Features
deno.jsonanddeno.jsoncfiles) for workspace pattern detection.Bug Fixes