-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix
f.path
sometimes being undefined (#533)
* fix: Append `.gitattributes` file as well * fix: Fix `f.path` sometimes being undefined * Update createGitAttributes.ts
- Loading branch information
Showing
2 changed files
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import fs from 'fs/promises' | ||
import path from 'path' | ||
|
||
const GIT_ATTRIBUTES_CONTENT = ` | ||
* linguist-generated | ||
` | ||
|
||
export async function createGitAttributes(folder: string): Promise<string> { | ||
const file = path.join(folder, '.gitattributes') | ||
// Marks all files in this current folder as "generated" | ||
await fs.writeFile(file, `* linguist-generated`) | ||
await fs.writeFile(file, GIT_ATTRIBUTES_CONTENT.trim() + '\n', 'utf-8') | ||
return file | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters