-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Ignore adapter build files #1924
Changes from 1 commit
9d0911e
b5e2f86
81994dd
9c96539
1443779
cb1d390
7ef9b75
c436c63
572b1a2
9ce434e
7ad5add
0440983
f2571e1
62d4ba5
7d77989
b9ebbc0
fe432a7
34c65eb
e511a18
a75f5ae
5817df0
fc0b94b
b4f3a1b
ebd3df6
8d6a883
1b8bee2
191e9c3
ff76519
517b254
235e608
99fac63
14561a1
5e57aae
57ddbbb
f581003
bd9613d
d74eeee
4403cb9
e587a92
4e9c146
cf903e5
50cb7d8
445b992
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,6 +2,7 @@ import { SVELTE_KIT } from '../constants.js'; | |||
import { copy, rimraf, mkdirp } from '../filesystem/index.js'; | ||||
import { prerender } from './prerender.js'; | ||||
import fs from 'fs'; | ||||
import { EOL } from 'os'; | ||||
|
||||
/** | ||||
* | ||||
|
@@ -59,14 +60,13 @@ export function get_utils({ cwd, config, build_data, log }) { | |||
const file = fs.readFileSync(target, { encoding: 'utf-8' }); | ||||
const lines = file.split(/\r?\n/); | ||||
const new_lines = new Set(patterns); | ||||
|
||||
// remove repeated lines | ||||
for (const line of lines) { | ||||
// this will prevent commented ignores to be reinserted | ||||
new_lines.delete(line.replace(/#\s*/, '')); | ||||
} | ||||
if (new_lines.size === 0) continue; | ||||
fs.writeFileSync(target, [...lines, ...new_lines].join('\n')); | ||||
fs.writeFileSync(target, [...lines, ...new_lines].join(EOL)); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this detect what type of line endings are used in the file and preserve that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, its the end of line of the platform the code is being executed on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly, but it is possible that the native EOL is different from the style thats used in the file. sveltekit itself for example forces LF: Line 4 in f360a9f
prefering the native EOL vs the existing eol in the file itself also leads to a bigger diff and may cause problems if checked in and then checked out on other platforms. |
||||
if (log) this.log.success(`Updated ${target}`); | ||||
} | ||||
} | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is a lot simpler. I like it.