From 57b5121f555e4d98caf9db7df6b8dd3aff8458d0 Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Wed, 3 Jan 2024 00:16:31 +0800 Subject: [PATCH] fix: adjust the entrance --- scripts/esb.mjs | 2 +- src/index.ts | 5 +++++ src/main.ts | 4 +--- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 src/index.ts diff --git a/scripts/esb.mjs b/scripts/esb.mjs index 3a200c0..1070ac1 100644 --- a/scripts/esb.mjs +++ b/scripts/esb.mjs @@ -13,7 +13,7 @@ const formatMetafile = (metafile, verbose = true) => { }; const result = await esbuild.build({ - entryPoints: ["src/main.ts"], + entryPoints: ["src/index.ts"], bundle: true, outfile: "bin/index.mjs", minify: true, diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..3376991 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,5 @@ +#!/usr/bin/env node + +import { main } from "./main.js"; + +main(); diff --git a/src/main.ts b/src/main.ts index a60afc4..af71c2c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,3 @@ -#!/usr/bin/env node - import { dirname, sep, resolve as pathResolve } from "node:path"; import { fileURLToPath } from "node:url"; @@ -247,4 +245,4 @@ const end = async () => { logger.timeEnd("create-hexo"); }; -main(); +export { main };