diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e11723..65d9032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - updated upload and download artifacts actions to v4 ### Fixed +- do not break long file content lines - source TF_WORKING_DIR from env helper instead of process.env in locals helper - fixed how terraform state is accessed before it the initial synchronization - links to supported resources in HOWTOs diff --git a/scripts/__tests__/yaml/config.test.ts b/scripts/__tests__/yaml/config.test.ts index 2f01d1b..cdd0bf8 100644 --- a/scripts/__tests__/yaml/config.test.ts +++ b/scripts/__tests__/yaml/config.test.ts @@ -477,4 +477,25 @@ repositories: assert.equal(previouslyUnarchivedRepository.archived, true) assert.equal(previouslyUnarchivedRepository.visibility, undefined) }) + + it("doesn't break long lines on format or toString", async () => { + const lines = [ + '# 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', + 'repositories:', + ' test:', + ' files:', + ' test:', + ' content: >', + ' 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', + '' + ] + const source = lines.join('\n') + const config = new Config(source) + + assert.equal(config.toString(), source) + + config.format() + + assert.equal(config.toString(), source) + }) }) diff --git a/scripts/package.json b/scripts/package.json index 961b336..163245d 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -11,6 +11,7 @@ "lint": "eslint \"src/**/*.ts\" \"__tests__/**/*.ts\"", "lint:fix": "eslint --fix \"src/**/*.ts\" \"__tests__/**/*.ts\"", "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\"", + "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\"", "all": "npm run build && npm run format && npm run lint && npm test", "schema": "ts-json-schema-generator --tsconfig tsconfig.json --path src/yaml/schema.ts --type ConfigSchema --out ../github/.schema.json", "main": "node lib/main.js" diff --git a/scripts/src/yaml/config.ts b/scripts/src/yaml/config.ts index 07d1617..d43bfd3 100644 --- a/scripts/src/yaml/config.ts +++ b/scripts/src/yaml/config.ts @@ -86,7 +86,8 @@ export class Config { toString(): string { return this._document.toString({ collectionStyle: 'block', - singleQuote: false + singleQuote: false, + lineWidth: 0 }) }