Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Mar 19, 2024
1 parent 7b7ccc0 commit d909b66
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 21 deletions.
53 changes: 53 additions & 0 deletions Configuration/ESBuild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @module ESBuild
*
*/
export default {
color: true,
format: "esm",
metafile: true,
minify: true,
outdir: "Target",
platform: "node",
target: "esnext",
write: true,
logLevel: "debug",
plugins: [
{
name: "Target",
setup({ onStart, initialOptions: { outdir } }) {
onStart(async () => {
try {
outdir
? await (await import("fs/promises")).rm(outdir, {
recursive: true,
})
: {};
} catch (_Error) {
console.log(_Error);
}
});
},
},
(await import("esbuild-plugin-copy")).copy({
resolveFrom: "out",
assets: [
{
from: "./Source/Stylesheet/Theme.css",
to: "./Stylesheet/",
},
],
}),
],
define: {
"process.env.VERSION_PACKAGE": `'${
(
await (
await import("../Target/Function/JSON.js")
).default("package.json")
)?.version
}'`,
},
} satisfies BuildOptions as BuildOptions;

import type { BuildOptions } from "esbuild";
1 change: 1 addition & 0 deletions Documentation/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
11 changes: 3 additions & 8 deletions Source/Function/Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ export default (async (...[File]: Parameters<Type>) => {

Pipe.reverse();

console.log(Pipe);

console.log(
Exec(
[
"typedoc",
"--commentStyle all",
// "--gitRevision Current",
"--gitRevision Current",
`--customCss ${resolve(`${Current}/../Stylesheet/Theme.css`)}`,
"--includeVersion",
"--out ./Documentation",
Expand Down Expand Up @@ -54,10 +52,7 @@ export default (async (...[File]: Parameters<Type>) => {
"--entryPointStrategy expand",
"--mergeModulesRenameDefaults",
"--mergeModulesMergeMode module",
`--entryPoints ${Pipe.map((File) => [
File.replace("Source/", "").split(".").slice(0, -1.0).join("."),
File,
]).join(" --entryPoints ")}`,
`--entryPoints ${Pipe.join(" --entryPoints ")}`,
].join(" "),
);
}) satisfies Type as Type;
Expand Down
5 changes: 4 additions & 1 deletion Source/Function/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ export default (async (
...[Command, Echo = (Return) => console.log(Return)]: Parameters<Type>
) => {
try {
const { stdout } = (await import("child_process")).exec(Command);
const { stdout, stderr } = (await import("child_process")).exec(
Command,
);

if (typeof Echo === "function") {
stdout?.on("data", (Data) => Echo(Data));
stderr?.on("data", (Data) => Echo(Data));
}
} catch (_Error) {
console.log(_Error);
Expand Down
8 changes: 4 additions & 4 deletions Source/Interface/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
export default interface Type {
/**
* The 'Exec' function is an asynchronous function that executes a command and logs the
* stdout of the child process.
* stdout and stderr of the child process.
*
* @param Command - The 'Command' parameter is a string that represents the
* command you want to execute. It can be any valid command that can be executed in a
* terminal or command prompt.
*
* @param Echo - An optional parameter that controls whether the stdout
* @param Echo - An optional parameter that controls whether the stdout and stderr
* of the child process should be logged. If set to 'false', no logging will occur. If set
* to a function, the function will be called with the stdout data as a parameter for custom
* logging. If not provided, stdout will be logged to the console by default.
* to a function, the function will be called with the stdout and stderr data as a parameter for custom
* logging. If not provided, stdout and stderr will be logged to the console by default.
*
*/
(
Expand Down
2 changes: 1 addition & 1 deletion Target/Function/Document.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/Function/Exec.js

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

8 changes: 4 additions & 4 deletions Target/Interface/Exec.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
export default interface Type {
/**
* The 'Exec' function is an asynchronous function that executes a command and logs the
* stdout of the child process.
* stdout and stderr of the child process.
*
* @param Command - The 'Command' parameter is a string that represents the
* command you want to execute. It can be any valid command that can be executed in a
* terminal or command prompt.
*
* @param Echo - An optional parameter that controls whether the stdout
* @param Echo - An optional parameter that controls whether the stdout and stderr
* of the child process should be logged. If set to 'false', no logging will occur. If set
* to a function, the function will be called with the stdout data as a parameter for custom
* logging. If not provided, stdout will be logged to the console by default.
* to a function, the function will be called with the stdout and stderr data as a parameter for custom
* logging. If not provided, stdout and stderr will be logged to the console by default.
*
*/
(Command: string, Echo?: false | ((Return: any) => void)): Promise<void>;
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"keywords": [
"documentation",
"javascript",
"typedoc",
"typescript"
],
"homepage": "https://github.com/Playform/TypeScriptDocument#readme",
Expand All @@ -30,7 +29,7 @@
"TypeScriptDocument": "Target/Class/TypeScriptDocument.js"
},
"scripts": {
"prepublishOnly": "TypeScriptESBuild 'Source/**/*.ts'"
"prepublishOnly": "TypeScriptESBuild 'Source/**/*.ts' -ES Configuration/ESBuild.ts"
},
"dependencies": {
"commander": "12.0.0",
Expand All @@ -44,6 +43,7 @@
"typedoc-plugin-zod": "1.1.2"
},
"devDependencies": {
"esbuild-plugin-copy": "2.1.1",
"typescript-esbuild": "0.4.2"
},
"publishConfig": {
Expand Down

0 comments on commit d909b66

Please sign in to comment.