Skip to content

Commit

Permalink
feat: add 'bun' to PM
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Jan 3, 2024
1 parent 31c5845 commit 781aa55
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const STARTER_DIR = pathResolve(__dirname, `../${STARTER}/`);
const RM_FILES = [".git", ".github"];
const ADD_FILES = ["scripts/.gitkeep", "source/_drafts/.gitkeep"];

type PM = "pnpm" | "npm" | "yarn";
type PM = "pnpm" | "npm" | "yarn" | "bun";
interface InitOptions {
blogName: string;
blogPath: string;
Expand Down Expand Up @@ -107,7 +107,7 @@ const init = () => {
"-pm, --packageManager <packageManager>",
"Specify the packageManager which use to Install packages",
)
.choices(["auto", "npm", "pnpm", "yarn"])
.choices(["auto", "npm", "pnpm", "yarn", "bun"])
.default("auto"),
)
.version(
Expand All @@ -127,10 +127,10 @@ const init = () => {

const printUsage = () => {
logger.group("Usage: ");
logger.l(` npm exec ${packageJson.name} [blog_directory]`, "\n");
logger.l(" npm init hexo [blog_directory]", "\n");
logger.l(` pnpm create hexo [blog_directory]`, "\n");
logger.l(" yarn create hexo [blog_directory]", "\n");
logger.l(" bun create hexo [blog_directory]", "\n");
logger.groupEnd();
};

Expand Down Expand Up @@ -179,6 +179,8 @@ const checkPackageManager = (): Promise<PM> => {
pm = "pnpm";
} else if (UA?.startsWith("yarn") || runPath.includes("yarn")) {
pm = "yarn";
} else if (UA?.startsWith("bun")) {
pm = "bun";
} else {
pm = "npm";
}
Expand Down

0 comments on commit 781aa55

Please sign in to comment.