Skip to content

Commit

Permalink
fix(#2628): generate eol LF config
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-crouzet committed Dec 19, 2024
1 parent 21efca9 commit b4f1a2f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
"search.exclude": {
"**/*.code-search": true,
"**/.yarn/**": true,
"**/github-actions/*/packaged-action/**": true
"**/github-actions/*/packaged-action/**": true,
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.tsdk": ".yarn/sdks/typescript/lib"
Expand Down
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ packageExtensions:
"@swc/types": "*"
"@typescript-eslint/rule-tester@*":
dependencies:
"@typescript-eslint/parser": ~8.17.0
"@typescript-eslint/parser": ~8.18.0
"@angular-eslint/eslint-plugin-template@*":
dependencies:
"@typescript-eslint/types": "^8.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@ama-sdk/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"@swc/helpers": "~0.5.0",
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@typescript-eslint/eslint-plugin": "~8.17.0",
"@typescript-eslint/eslint-plugin": "~8.18.0",
"jest-junit": "~16.0.0",
"lint-staged": "^15.0.0",
"minimist": "^1.2.6",
Expand Down
6 changes: 3 additions & 3 deletions packages/@o3r/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
"@o3r/store-sync": "workspace:^",
"@stylistic/eslint-plugin": "~2.7.0",
"@types/jest": "~29.5.2",
"@typescript-eslint/eslint-plugin": "~8.17.0",
"@typescript-eslint/parser": "~8.17.0",
"@typescript-eslint/eslint-plugin": "~8.18.0",
"@typescript-eslint/parser": "~8.18.0",
"angular-eslint": "~18.4.0",
"cpy-cli": "^5.0.0",
"eslint": "~9.14.0",
Expand All @@ -176,7 +176,7 @@
"jest-preset-angular": "~14.2.0",
"jsonc-eslint-parser": "~2.4.0",
"nx": "~19.8.0",
"typescript-eslint": "~8.17.0",
"typescript-eslint": "~8.18.0",
"zone.js": "~0.14.2"
},
"engines": {
Expand Down
16 changes: 16 additions & 0 deletions packages/@o3r/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type SpawnSyncOptionsWithBufferEncoding,
} from 'node:child_process';
import {
existsSync,
readFileSync,
writeFileSync,
} from 'node:fs';
Expand Down Expand Up @@ -265,6 +266,21 @@ const prepareWorkspace = (relativeDirectory = '.', projectPackageManager = 'npm'
}
}

if (argv.minimal) {
const editorconfigPath = resolve(cwd, '.editorconfig');
const editorconfig = existsSync(editorconfigPath) ? readFileSync(editorconfigPath, { encoding: 'utf8' }) : '';
const newEditorconfig = /\[[*]\]/.test(editorconfig)
? editorconfig.replace(/(\[[*]\])/, '$1\nend_of_line = lf')
: editorconfig.concat('[*]\nend_of_line = lf');
writeFileSync(editorconfigPath, newEditorconfig);
}
const gitAttributesPath = resolve(cwd, '.gitattributes');
writeFileSync(
gitAttributesPath,
(existsSync(gitAttributesPath) ? readFileSync(gitAttributesPath, { encoding: 'utf8' }) : '')
.concat('* text eol=lf')
);

exitProcessIfErrorInSpawnSync(INSTALL_PROCESS_ERROR_CODE, spawnSync(runner, ['install'], spawnSyncOpts));
};

Expand Down
6 changes: 3 additions & 3 deletions packages/@o3r/eslint-config-otter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
"typescript": "^5.5.4"
},
"generatorDependencies": {
"@typescript-eslint/eslint-plugin": "~8.17.0",
"@typescript-eslint/parser": "~8.17.0",
"@typescript-eslint/utils": "~8.17.0",
"@typescript-eslint/eslint-plugin": "~8.18.0",
"@typescript-eslint/parser": "~8.18.0",
"@typescript-eslint/utils": "~8.18.0",
"eslint": "~9.14.0",
"eslint-plugin-jsdoc": "~50.2.0",
"eslint-plugin-unicorn": "^56.0.0"
Expand Down

0 comments on commit b4f1a2f

Please sign in to comment.