Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Sep 23, 2023
1 parent 8ff38c8 commit f9481e6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
14 changes: 11 additions & 3 deletions Source/Fn/Build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import type { Pattern } from "fast-glob";
import File from "../Fn/File.js";
import Default from "../Object/Option.js";

import Glob from "fast-glob";
import { exec as Exec } from "child_process";
import { deepmerge as Merge } from "deepmerge-ts";
import { build as Build } from "esbuild";
import { build as Build, analyzeMetafile } from "esbuild";
import Glob from "fast-glob";

/**
* The `Build` function compiles and builds TypeScript files using esbuild and TypeScript compiler.
Expand Down Expand Up @@ -40,12 +40,20 @@ export default async (
),
} satisfies Option) as Option;

await Build(
const Result = await Build(
Option?.ESBuild
? Merge(_Configuration, await File(Option?.ESBuild))
: _Configuration
);

console.log(
Result.metafile
? await analyzeMetafile(Result.metafile, {
verbose: true,
})
: {}
);

if (Option?.TypeScript) {
Exec(`tsc -p ${Option?.TypeScript}`);
} else {
Expand Down
4 changes: 3 additions & 1 deletion Source/Object/Option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import _JSON from "../Fn/JSON.js";
const Out = "Target";

export default {
color: true,
format: "esm",
metafile: true,
minify: true,
outdir: Out,
platform: "node",
target: "esnext",
write: true,
metafile: true,
logLevel: "debug",
plugins: [
{
name: "Target",
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/Object/Option.js

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

0 comments on commit f9481e6

Please sign in to comment.