-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as fs from "node:fs/promises"; | ||
import * as prettier from "prettier"; | ||
import makeSynchronized from "make-synchronized"; | ||
|
||
export default makeSynchronized(import.meta, async function formatFile(file) { | ||
const config = await prettier.resolveConfig(file); | ||
const content = await fs.readFile(file, "utf8"); | ||
const formatted = await prettier.format(content, {...config,filepath: file}); | ||
await fs.writeFile(file, formatted); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as url from "node:url"; | ||
import formatFile from './format-file.js' | ||
|
||
console.log( | ||
formatFile( | ||
url.fileURLToPath(new URL('../readme.md', import.meta.url)) | ||
|
||
) | ||
) |
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
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 |
---|---|---|
|
@@ -44,20 +44,20 @@ | |
] | ||
}, | ||
"peerDependencies": { | ||
"prettier": "^3.0.0" | ||
"prettier": "*" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "20.4.1", | ||
"c8": "8.0.0", | ||
"@types/node": "20.11.5", | ||
"c8": "9.1.0", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "3.0.0" | ||
"prettier": "3.2.4" | ||
}, | ||
"packageManager": "[email protected]", | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
"dependencies": { | ||
"make-synchronized": "^0.0.3" | ||
"make-synchronized": "^0.2.1" | ||
} | ||
} |
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
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