Fix Angular#10532
Conversation
…sal_maker_upgrade
There was a problem hiding this comment.
Code Review
This pull request updates the local build process to support frameworks like Angular that do not provide an outputFiles block in their bundle.yaml. It modifies the parsing logic to default to an empty array instead of throwing an error and updates the deployment preparation to handle cases with zero output files. The review identified a type safety issue regarding the use of 'any' in the test suite and highlighted a regression where multiple output files are now silently ignored instead of triggering an error.
| it("returns empty outputFiles and succeeds if bundle.yaml has no outputFiles block (e.g., Angular)", async () => { | ||
| const rfs = fsExtra.readFileSync as sinon.SinonStub; | ||
| rfs.restore(); // Restore and stub specifically for this test case | ||
| sinon.stub(fsExtra, "readFileSync").callsFake((pathStr: any) => { |
There was a problem hiding this comment.
Avoid using any as an escape hatch, as per the repository style guide. Since the stubbed function is only expected to handle string paths in this test context, you should use a more specific type like string.
| sinon.stub(fsExtra, "readFileSync").callsFake((pathStr: any) => { | |
| sinon.stub(fsExtra, "readFileSync").callsFake((pathStr: string) => { |
References
- Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
… readFileSync stub
Description
The local builds code was hard-expecting this field to exist. However, that's only the case for nextjs apps (and only standalone ones). This PR makes the code gracefully handle missing values for this.
Scenarios Tested
Successfully deployed an angular app