Skip to content

Commit 781aa55

Browse files
committed
feat: add 'bun' to PM
1 parent 31c5845 commit 781aa55

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const STARTER_DIR = pathResolve(__dirname, `../${STARTER}/`);
1717
const RM_FILES = [".git", ".github"];
1818
const ADD_FILES = ["scripts/.gitkeep", "source/_drafts/.gitkeep"];
1919

20-
type PM = "pnpm" | "npm" | "yarn";
20+
type PM = "pnpm" | "npm" | "yarn" | "bun";
2121
interface InitOptions {
2222
blogName: string;
2323
blogPath: string;
@@ -107,7 +107,7 @@ const init = () => {
107107
"-pm, --packageManager <packageManager>",
108108
"Specify the packageManager which use to Install packages",
109109
)
110-
.choices(["auto", "npm", "pnpm", "yarn"])
110+
.choices(["auto", "npm", "pnpm", "yarn", "bun"])
111111
.default("auto"),
112112
)
113113
.version(
@@ -127,10 +127,10 @@ const init = () => {
127127

128128
const printUsage = () => {
129129
logger.group("Usage: ");
130-
logger.l(` npm exec ${packageJson.name} [blog_directory]`, "\n");
131130
logger.l(" npm init hexo [blog_directory]", "\n");
132131
logger.l(` pnpm create hexo [blog_directory]`, "\n");
133132
logger.l(" yarn create hexo [blog_directory]", "\n");
133+
logger.l(" bun create hexo [blog_directory]", "\n");
134134
logger.groupEnd();
135135
};
136136

@@ -179,6 +179,8 @@ const checkPackageManager = (): Promise<PM> => {
179179
pm = "pnpm";
180180
} else if (UA?.startsWith("yarn") || runPath.includes("yarn")) {
181181
pm = "yarn";
182+
} else if (UA?.startsWith("bun")) {
183+
pm = "bun";
182184
} else {
183185
pm = "npm";
184186
}

0 commit comments

Comments
 (0)