Skip to content

Commit

Permalink
Merge branch 'Current' of ssh://github.com/PlayForm/Build into Current
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Jun 23, 2024
2 parents 428af25 + bcd9cef commit 6c138ac
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 15 deletions.
7 changes: 3 additions & 4 deletions Source/Class/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
*/
export default new (await import("commander")).Command()
.name("Build")
// biome-ignore lint/complexity/useLiteralKeys:
.version(process.env["VERSION_PACKAGE"] ?? "0.0.1")
.description("🌀 Build —")
.argument("<File...>", "📂 File —")
.option("-ES, --ESBuild <File>", "👷🏻‍♀️ ESBuild —")
.option("-TS, --TypeScript <File>", "👨🏻‍💻 TypeScript —", "tsconfig.json")
.argument("<File...>", "📝 File —")
.option("-ES, --ESBuild <File>", "📜 ESBuild —")
.option("-TS, --TypeScript <File>", "📜 TypeScript —", "tsconfig.json")
.action((await import("../Function/Build.js")).default)
.parse();
4 changes: 3 additions & 1 deletion Source/Function/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export default (async (
...[Command, Echo = (Return) => console.log(Return)]: Parameters<Interface>
) => {
try {
const { stdout, stderr } = (await import("node:child_process")).exec(Command);
const { stdout, stderr } = (await import("node:child_process")).exec(
Command,
);

if (typeof Echo === "function") {
stdout?.on("data", (Data) => Echo(Data));
Expand Down
17 changes: 14 additions & 3 deletions Source/Function/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export default (async (...[Path]: Parameters<Interface>) => {
"../../tsconfig.json",
(
await import("node:path")
).dirname((await import("node:url")).fileURLToPath(import.meta.url)),
).dirname(
(
await import("node:url")
).fileURLToPath(import.meta.url),
),
)
)?.compilerOptions,
".",
Expand All @@ -32,7 +36,9 @@ export default (async (...[Path]: Parameters<Interface>) => {
Path.replace(".ts", ".js"),
(await import("typescript")).default.transpile(
(
await (await import("node:fs/promises")).readFile(Path, "utf-8")
await (
await import("node:fs/promises")
).readFile(Path, "utf-8")
).toString(),
Option,
),
Expand All @@ -41,7 +47,12 @@ export default (async (...[Path]: Parameters<Interface>) => {

return (
await import(
(await import("node:url")).pathToFileURL(Path).toString().replace(".ts", ".js")
(
await import("node:url")
)
.pathToFileURL(Path)
.toString()
.replace(".ts", ".js")
)
).default;
}) satisfies Interface as Interface;
Expand Down
16 changes: 11 additions & 5 deletions Source/Variable/ESBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ export default {
onStart(async () => {
try {
outdir
? await (await import("node:fs/promises")).rm(outdir, {
recursive: true,
})
? await (await import("node:fs/promises")).rm(
outdir,
{
recursive: true,
},
)
: {};
} catch (_Error) {
console.log(_Error);
Expand All @@ -33,8 +36,11 @@ export default {
],
define: {
"process.env.VERSION_PACKAGE": `'${
(await (await import("../Function/JSON.js")).default("package.json"))
?.version
(
await (
await import("../Function/JSON.js")
).default("package.json")
)?.version
}'`,
},
} satisfies BuildOptions as BuildOptions;
Expand Down
2 changes: 1 addition & 1 deletion Target/Class/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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"prepublishOnly": "node --no-warnings --loader ts-node/esm Source/Class/Build.ts 'Source/**/*.ts'"
},
"dependencies": {
"@types/node": "20.14.7",
"@types/node": "20.14.8",
"commander": "12.1.0",
"deepmerge-ts": "7.0.3",
"esbuild": "0.21.5",
Expand Down

0 comments on commit 6c138ac

Please sign in to comment.