Skip to content

Commit

Permalink
chore(deps): Upgrade @antfu/ni to v23.2.0 (#6414)
Browse files Browse the repository at this point in the history
* chore(deps): Upgrade @antfu/ni to v23.2.0

* chore: changeset

* test(shadcn): add bun.lock

---------

Co-authored-by: shadcn <[email protected]>
  • Loading branch information
palmithor and shadcn authored Feb 11, 2025
1 parent 7977975 commit 202131c
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-mails-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"shadcn": patch
---

upgrade @antfu/ni
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"test:dev": "REGISTRY_URL=http://localhost:3333 vitest run"
},
"dependencies": {
"@antfu/ni": "^0.21.4",
"@antfu/ni": "^23.2.0",
"@babel/core": "^7.22.1",
"@babel/parser": "^7.22.6",
"@babel/plugin-transform-typescript": "^7.22.5",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/utils/get-package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { detect } from "@antfu/ni"

export async function getPackageManager(
targetDir: string
): Promise<"yarn" | "pnpm" | "bun" | "npm"> {
): Promise<"yarn" | "pnpm" | "bun" | "npm" | "deno"> {
const packageManager = await detect({ programmatic: true, cwd: targetDir })

if (packageManager === "yarn@berry") return "yarn"
if (packageManager === "pnpm@6") return "pnpm"
if (packageManager === "bun") return "bun"
if (packageManager === "deno") return "deno"

return packageManager ?? "npm"
}
2 changes: 1 addition & 1 deletion packages/shadcn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"test:dev": "REGISTRY_URL=http://localhost:3333/r vitest run"
},
"dependencies": {
"@antfu/ni": "^0.21.4",
"@antfu/ni": "^23.2.0",
"@babel/core": "^7.22.1",
"@babel/parser": "^7.22.6",
"@babel/plugin-transform-typescript": "^7.22.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/shadcn/src/utils/get-package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export async function getPackageManager(
{ withFallback }: { withFallback?: boolean } = {
withFallback: false,
}
): Promise<"yarn" | "pnpm" | "bun" | "npm"> {
): Promise<"yarn" | "pnpm" | "bun" | "npm" | "deno"> {
const packageManager = await detect({ programmatic: true, cwd: targetDir })

if (packageManager === "yarn@berry") return "yarn"
if (packageManager === "pnpm@6") return "pnpm"
if (packageManager === "bun") return "bun"

if (packageManager === "deno") return "deno"
if (!withFallback) {
return packageManager ?? "npm"
}
Expand Down
Binary file not shown.
7 changes: 7 additions & 0 deletions packages/shadcn/test/fixtures/project-bun-lock/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "test-cli-project-bun",
"version": "1.0.0",
"main": "index.js",
"author": "shadcn",
"license": "MIT"
}
6 changes: 6 additions & 0 deletions packages/shadcn/test/utils/get-package-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ test("get package manager", async () => {
await getPackageManager(path.resolve(__dirname, "../fixtures/project-bun"))
).toBe("bun")

expect(
await getPackageManager(
path.resolve(__dirname, "../fixtures/project-bun-lock")
)
).toBe("bun")

expect(
await getPackageManager(path.resolve(__dirname, "../fixtures/next"))
).toBe("pnpm")
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

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

0 comments on commit 202131c

Please sign in to comment.