Skip to content

refactor: Improve handling of non-empty, non-manifest JSON files - #1668

Merged
d3xter666 merged 3 commits into
mainfrom
refactor-improve-json-handling-of-empty-non-manifest-files
Oct 22, 2026
Merged

d3xter666 merged 3 commits into
mainfrom
refactor-improve-json-handling-of-empty-non-manifest-files

Conversation

@d3xter666

Copy link
Copy Markdown
Member

JIRA: CPOUI5FOUNDATION-1046

This PR steps over and extends #1667.

The reason behind this change is that besides it's not related to manifest.json parsing, it follows the same pattern for handling empty JSON files and providing more context in the error message.
Thus, we handle this edge case of parsing empty JSON files the same.

Note: There are special cases where an empty JSON is expected and is handled explicitly. Those are not touched. i.e. https://github.com/UI5/cli/blob/main/packages/builder/lib/processors/jsdoc/lib/createIndexFiles.js#L66-L68

@d3xter666
d3xter666 requested a review from a team October 19, 2026 10:35
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch 4 times, most recently from 5202ff1 to ca50901 Compare October 20, 2026 06:40
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from 9a87056 to 15d0eb5 Compare October 20, 2026 06:40
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch from ca50901 to 957e7b7 Compare October 20, 2026 07:06
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch 2 times, most recently from 2e094a7 to 85ac842 Compare October 20, 2026 07:50
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch from 957e7b7 to 796e968 Compare October 20, 2026 07:50
Comment thread packages/builder/lib/lbt/bundle/Builder.js Outdated
Comment thread packages/project/lib/validation/validator.js Outdated
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch 2 times, most recently from 791e191 to f88b4a8 Compare October 21, 2026 05:03
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from e9b7e4e to 54980c9 Compare October 21, 2026 05:05
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch 2 times, most recently from 09d3d03 to 6fedb4f Compare October 21, 2026 05:23
@d3xter666
d3xter666 force-pushed the refactor-manifest-messages branch from 54980c9 to fca52ec Compare October 21, 2026 05:23
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch from 6fedb4f to dcba781 Compare October 21, 2026 08:13
RandomByte
RandomByte previously approved these changes Oct 21, 2026
Base automatically changed from refactor-manifest-messages to main October 21, 2026 15:04
@d3xter666
d3xter666 dismissed RandomByte’s stale review October 21, 2026 15:04

The base branch was changed.

Apply the parseJSON util to the non-manifest JSON parse sites in the
builder (lbt bundle module content and source maps, minifier source maps,
flexibility changes bundler and the .theming reader) so empty and
malformed files surface a clear, path-named error.

Also trim the redundant "Failed to parse JSON file" log in the lbt bundle
Builder: the util error (logged right after) already names the file and
the parse failure, so the catch now only states the skip action.
Apply the parseJSON util to the non-manifest JSON parse sites in the
project (build manifest, workspace package.json, ui5Framework helper,
maven/npm installers and the validation schema reader) so empty and
malformed files surface a clear, path-named error.
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch from dcba781 to a006911 Compare October 22, 2026 06:27
- Correct filenames for source maps
- Get schema path
@d3xter666
d3xter666 force-pushed the refactor-improve-json-handling-of-empty-non-manifest-files branch from a006911 to 5fd69a8 Compare October 22, 2026 06:32
@d3xter666
d3xter666 merged commit 122bbce into main Oct 22, 2026
77 checks passed
@d3xter666
d3xter666 deleted the refactor-improve-json-handling-of-empty-non-manifest-files branch October 22, 2026 07:30
d3xter666 added a commit to SAP/ui5-project that referenced this pull request Oct 23, 2026
Downport of: UI5/cli#1668
JIRA: CPOUI5FOUNDATION-1046

This PR steps over and extends
#905.

The reason behind this change is that besides it's not related to
manifest.json parsing, it follows the same pattern for handling empty
JSON files and providing more context in the error message. Thus, we
handle this edge case of parsing empty JSON files the same.
d3xter666 added a commit to SAP/ui5-builder that referenced this pull request Oct 23, 2026
)

Downport of UI5/cli#1668
JIRA: CPOUI5FOUNDATION-1046

This PR steps over and extends
#1249.

The reason behind this change is that besides it's not related to
manifest.json parsing, it follows the same pattern for handling empty
JSON files and providing more context in the error message.
Thus, we handle this edge case of parsing empty JSON files the same.

Note: There are special cases where an empty JSON is expected and is
handled explicitly. Those are not touched. i.e.
https://github.com/UI5/cli/blob/main/packages/builder/lib/processors/jsdoc/lib/createIndexFiles.js#L66-L68
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