Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe generator and tests were updated to prevent duplicate Forge entrypoints: the webpack template now emits only Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
1898a5b to
c1119a8
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
e2e/nx-forge-e2e/tests/application.generator.spec.ts (1)
28-28: Assert the bundled files here too.Line 28 only proves
src/main.tsis not scaffolded. Issue#195is about webpack output, so this test can still pass if the build emitsdist/apps/${appName}/src/main.jsor writesindex.jsto the wrong path.💡 Example follow-up
expect(() => checkFilesExist(`apps/${appName}/src/index.ts`)).not.toThrow(); expect(() => checkFilesExist(`apps/${appName}/src/main.ts`)).toThrow(); + + await runNxCommandAsync(`build ${appName}`); + expect(() => + checkFilesExist(`dist/apps/${appName}/src/index.js`) + ).not.toThrow(); + expect(() => + checkFilesExist(`dist/apps/${appName}/src/main.js`) + ).toThrow();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/nx-forge-e2e/tests/application.generator.spec.ts` at line 28, Current test only asserts src/main.ts is absent; add positive assertions to verify the webpack output is produced in the correct bundle location. After the existing expect(() => checkFilesExist(`apps/${appName}/src/main.ts`)).toThrow(), call expect(() => checkFilesExist(`dist/apps/${appName}/src/main.js`)).not.toThrow() (and optionally also check `dist/apps/${appName}/index.js` if your build may emit index.js) so the test ensures the build writes the bundled file into dist rather than the wrong path; use the existing checkFilesExist, expect and appName symbols to implement these assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@packages/nx-forge/src/generators/application/files/webpack.config.js__tmpl__`:
- Line 13: The outputPath currently appends an extra '/src' causing double
'.../src/src' because webpackPluginOptions.outputPath already contains
'dist/<app>/src'; update the webpack config line that sets outputPath (the one
referencing webpackPluginOptions.outputPath) to remove the hard-coded '/src'
suffix so it uses just '<%= offset %><%= webpackPluginOptions.outputPath %>';
this will restore the expected layout used by the tunnel flow (see run-tunnel
logic) and prevent the bundle being written to the wrong directory.
---
Nitpick comments:
In `@e2e/nx-forge-e2e/tests/application.generator.spec.ts`:
- Line 28: Current test only asserts src/main.ts is absent; add positive
assertions to verify the webpack output is produced in the correct bundle
location. After the existing expect(() =>
checkFilesExist(`apps/${appName}/src/main.ts`)).toThrow(), call expect(() =>
checkFilesExist(`dist/apps/${appName}/src/main.js`)).not.toThrow() (and
optionally also check `dist/apps/${appName}/index.js` if your build may emit
index.js) so the test ensures the build writes the bundled file into dist rather
than the wrong path; use the existing checkFilesExist, expect and appName
symbols to implement these assertions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8e53b188-14f6-419f-8ef7-8804f09c73ec
📒 Files selected for processing (3)
e2e/nx-forge-e2e/tests/application.generator.spec.tspackages/nx-forge/src/generators/application/files/webpack.config.js__tmpl__packages/nx-forge/src/generators/application/generator.spec.ts
| new NxAppWebpackPlugin({ | ||
| target: 'node', | ||
| compiler: 'tsc', | ||
| outputPath: '<%= offset %><%= webpackPluginOptions.outputPath %>/src', |
There was a problem hiding this comment.
Drop the extra src suffix from outputPath.
webpackPluginOptions.outputPath is already built as dist/<app>/src in packages/nx-forge/src/generators/application/lib/add-app-files.ts:26-38, so Line 13 turns it into dist/.../src/src. That moves the bundle out of the location expected by the tunnel flow in packages/nx-forge/src/executors/tunnel/lib/run-tunnel.ts:23-37 and breaks the generated app layout.
💡 Proposed fix
- outputPath: '<%= offset %><%= webpackPluginOptions.outputPath %>/src',
+ outputPath: '<%= offset %><%= webpackPluginOptions.outputPath %>',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| outputPath: '<%= offset %><%= webpackPluginOptions.outputPath %>/src', | |
| outputPath: '<%= offset %><%= webpackPluginOptions.outputPath %>', |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/nx-forge/src/generators/application/files/webpack.config.js__tmpl__`
at line 13, The outputPath currently appends an extra '/src' causing double
'.../src/src' because webpackPluginOptions.outputPath already contains
'dist/<app>/src'; update the webpack config line that sets outputPath (the one
referencing webpackPluginOptions.outputPath) to remove the hard-coded '/src'
suffix so it uses just '<%= offset %><%= webpackPluginOptions.outputPath %>';
this will restore the expected layout used by the tunnel flow (see run-tunnel
logic) and prevent the bundle being written to the wrong directory.
Closes #195
Summary by CodeRabbit
Tests
Chores