Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Sep 22, 2023
1 parent 303ca19 commit dc36f98
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
4 changes: 1 addition & 3 deletions Source/Fn/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { exec as Exec } from "child_process";
import { deepmerge as Merge } from "deepmerge-ts";
import { build as Build } from "esbuild";

export type Pipe = string[];

/**
* The `Build` function compiles and builds TypeScript files using esbuild and TypeScript compiler.
* @param {Pattern[]} Files - An array of file patterns to be processed. Each pattern can include
Expand All @@ -21,7 +19,7 @@ export default async (
Files: Pattern[],
Option?: { ESBuild?: string; TypeScript?: string }
) => {
const Pipe: Pipe = [];
const Pipe: string[] = [];

for (const File of Files) {
for (const _File of await Glob(
Expand Down
3 changes: 2 additions & 1 deletion Source/Fn/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { pathToFileURL as URL } from "url";
export default async (Path: string) => {
if (Path.split(".").pop() === "ts") {
const { options } = TypeScript.convertCompilerOptionsFromJson(
(await _JSON("../Notation/TypeScript.json"))?.compilerOptions,
(await _JSON("../Notation/TypeScript.json", import.meta.url))
?.compilerOptions,
"."
);

Expand Down
13 changes: 11 additions & 2 deletions Source/Fn/JSON.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { readFile as _File } from "fs/promises";
import { dirname as Dir } from "path";
import { fileURLToPath as Path } from "url";

/**
* The function `JSON` is a TypeScript function that reads a JSON file and returns its parsed content.
Expand All @@ -8,5 +10,12 @@ import { readFile as _File } from "fs/promises";
* from which the JSON file will be loaded. It is set to `import.meta.url` by default, which refers to
* the URL of the current module. However, if a different source URL or file path is provided,
*/
export default async (File: string) =>
JSON.parse((await _File(`${File}`, "utf-8")).toString());
export default async (File: string, From?: string) =>
JSON.parse(
(
await _File(
`${From ? Dir(Path(From ?? import.meta.url)) : "."}/${File}`,
"utf-8"
)
).toString()
);
1 change: 0 additions & 1 deletion Target/Fn/Build.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Pattern } from "fast-glob";
export type Pipe = string[];
/**
* The `Build` function compiles and builds TypeScript files using esbuild and TypeScript compiler.
* @param {Pattern[]} Files - An array of file patterns to be processed. Each pattern can include
Expand Down
2 changes: 1 addition & 1 deletion Target/Fn/Build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Target/Fn/File.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Target/Fn/JSON.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* from which the JSON file will be loaded. It is set to `import.meta.url` by default, which refers to
* the URL of the current module. However, if a different source URL or file path is provided,
*/
declare const _default: (File: string) => Promise<any>;
declare const _default: (File: string, From?: string) => Promise<any>;
export default _default;
2 changes: 1 addition & 1 deletion Target/Fn/JSON.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc36f98

Please sign in to comment.