generated from custom-cards/boilerplate-card
-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
4,227 additions
and
22,582 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,16 +1,13 @@ | ||
import { InputConfig } from "./types"; | ||
|
||
type Whitespace = " " | "\t" | "\n" | "\r"; | ||
|
||
type With$fn<T> = { | ||
[K in keyof T]: | ||
| (T[K] extends (infer U)[] | ||
? With$fn<U>[] // handle arrays recursively | ||
: T[K] extends object | ||
? With$fn<T[K]> // handle objects recursively | ||
: T[K]) // retain original type | ||
| `${Whitespace | ""}$ex${Whitespace}${string}` | ||
| `${Whitespace | ""}$fn${Whitespace}${string}`; // allow string starting with $ex or $fn with optional whitespace | ||
| `${string}$ex$fn_REPLACER`; | ||
}; | ||
|
||
export type JsonSchemaRoot = With$fn<InputConfig>; |
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
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,18 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { fileURLToPath } from "url"; | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const file = path.join(__dirname, "src/schema.json"); // Create relative path for reading | ||
|
||
const patched = fs | ||
.readFileSync(file) | ||
.toString() | ||
.replaceAll( | ||
"^.*\\\\$ex\\\\$fn_REPLACER$", | ||
"^[\\\\s]*\\\\$(ex|fn)\\\\s[\\\\s\\\\S]+$", | ||
); | ||
|
||
fs.writeFileSync(file, patched); | ||
|
||
console.log("Patch completed."); |
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
Oops, something went wrong.