Skip to content

[WIP] Fix empty lines added to beginning of ssjs files during deployment#2532

Draft
Copilot wants to merge 1 commit intodevelopfrom
copilot/fix-empty-lines-ssjs-files-again
Draft

[WIP] Fix empty lines added to beginning of ssjs files during deployment#2532
Copilot wants to merge 1 commit intodevelopfrom
copilot/fix-empty-lines-ssjs-files-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

  • Fix getSsjs() in lib/util/util.js to trim leading \n from extracted SSJS content (root cause of empty lines bug)
  • Fix _beautify_prettier() in lib/util/file.js to use per-call parser config instead of shared state (prevents html parser from being incorrectly reused for ssjs/json/xml files)
  • Add xml, rss, jsonc cases to the prettier parser switch with correct parsers
  • Add GET response mock for codesnippetblock asset (test resource)
  • Add expected test resource files for codesnippetblock retrieve/template/build (JSON + SSJS)
  • Add new test for asset-other (codesnippetblock) buildTemplate+buildDefinition verifying no leading empty lines in ssjs output
  • Update all affected test count assertions across type.asset.test.js, type.automation.test.js, general.test.js
  • Fix script/patch-expected.ssjs to remove previously expected leading newline (confirms the bug was present)
  • Full test suite passes: 303 tests passing, 0 failing
Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] empty lines added to beginning of ssjs files during build or deploy</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

basically, when deploying to multiple BUs each copy gets a different amount of empty lines added to the beginning for some reason

Image Image

Expected Behavior

not empty lines should be added. instead, the file should start with the first actual line of code.

Steps To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Run '...'
  4. See error...

Version

8.1.0

Environment

  • OS:
  • Node:
  • npm:

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response</issue_description>

<agent_instructions>this seems to happen after build command was run for metadata type "asset", subtype "other" which happens to have an extracted ssjs file. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

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