mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-28 22:14:21 -04:00
🔧 pass object
This commit is contained in:
parent
24aaa0a993
commit
7a73fec48a
1 changed files with 12 additions and 5 deletions
|
@ -1,12 +1,19 @@
|
|||
import { exists, mkdir, writeFile } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { exists, mkdirSync, writeFileSync } from "fs";
|
||||
|
||||
const writeSchemaData = (location: string, content: string) => {
|
||||
exists(location, (exists) => {
|
||||
interface WriteSchemaData {
|
||||
path: string;
|
||||
content: string;
|
||||
fileName: string;
|
||||
}
|
||||
|
||||
const writeSchemaData = ({ path, content, fileName }: WriteSchemaData) => {
|
||||
exists(path, (exists) => {
|
||||
if (!exists) {
|
||||
mkdir(location, { recursive: true }, () => {});
|
||||
mkdirSync(path, { recursive: true });
|
||||
}
|
||||
});
|
||||
writeFile(location, content, "utf-8", () => {});
|
||||
writeFileSync(resolve(path, fileName), content);
|
||||
};
|
||||
|
||||
export { writeSchemaData };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue