Skip to content

Commit 0d91c2b

Browse files
committed
fix: do not break long content lines
1 parent cd89de3 commit 0d91c2b

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4949
- updated upload and download artifacts actions to v4
5050

5151
### Fixed
52+
- do not break long file content lines
5253
- source TF_WORKING_DIR from env helper instead of process.env in locals helper
5354
- fixed how terraform state is accessed before it the initial synchronization
5455
- links to supported resources in HOWTOs

scripts/__tests__/yaml/config.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,25 @@ repositories:
477477
assert.equal(previouslyUnarchivedRepository.archived, true)
478478
assert.equal(previouslyUnarchivedRepository.visibility, undefined)
479479
})
480+
481+
it("doesn't break long lines on format or toString", async () => {
482+
const lines = [
483+
'# This is a very long comment that should NOT be broken down - this is a very long comment that should NOT be broken down - this is a very long comment that should NOT be broken down',
484+
'repositories:',
485+
' test:',
486+
' files:',
487+
' test:',
488+
' content: >',
489+
' This is a very long content that should NOT be broken down - this is a very long content that should NOT be broken down - this is a very long content that should NOT be broken down',
490+
''
491+
]
492+
const source = lines.join('\n')
493+
const config = new Config(source)
494+
495+
assert.equal(config.toString(), source)
496+
497+
config.format()
498+
499+
assert.equal(config.toString(), source)
500+
})
480501
})

scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"lint": "eslint \"src/**/*.ts\" \"__tests__/**/*.ts\"",
1212
"lint:fix": "eslint --fix \"src/**/*.ts\" \"__tests__/**/*.ts\"",
1313
"test": "TF_EXEC=false TF_LOCK=false TF_WORKING_DIR=__tests__/__resources__/terraform GITHUB_DIR=__tests__/__resources__/github FILES_DIR=__tests__/__resources__/files GITHUB_ORG=default node --import tsx/esm --test --experimental-test-module-mocks \"__tests__/**/*.test.ts\"",
14+
"test:only": "TF_EXEC=false TF_LOCK=false TF_WORKING_DIR=__tests__/__resources__/terraform GITHUB_DIR=__tests__/__resources__/github FILES_DIR=__tests__/__resources__/files GITHUB_ORG=default node --import tsx/esm --test --test-only --experimental-test-module-mocks \"__tests__/**/*.test.ts\"",
1415
"all": "npm run build && npm run format && npm run lint && npm test",
1516
"schema": "ts-json-schema-generator --tsconfig tsconfig.json --path src/yaml/schema.ts --type ConfigSchema --out ../github/.schema.json",
1617
"main": "node lib/main.js"

scripts/src/yaml/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ export class Config {
8686
toString(): string {
8787
return this._document.toString({
8888
collectionStyle: 'block',
89-
singleQuote: false
89+
singleQuote: false,
90+
lineWidth: 0
9091
})
9192
}
9293

0 commit comments

Comments
 (0)