From 202131cd7bf8829b962ae4027545afbdfe79e688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1lmi=20=C3=9E=C3=B3r=20Valgeirsson?= Date: Tue, 11 Feb 2025 08:46:53 +0000 Subject: [PATCH] chore(deps): Upgrade `@antfu/ni` to v23.2.0 (#6414) * chore(deps): Upgrade @antfu/ni to v23.2.0 * chore: changeset * test(shadcn): add bun.lock --------- Co-authored-by: shadcn --- .changeset/cool-mails-bake.md | 5 +++++ packages/cli/package.json | 2 +- packages/cli/src/utils/get-package-manager.ts | 3 ++- packages/shadcn/package.json | 2 +- .../shadcn/src/utils/get-package-manager.ts | 4 ++-- .../test/fixtures/project-bun-lock/bun.lock | Bin 0 -> 1280 bytes .../fixtures/project-bun-lock/package.json | 7 +++++++ .../test/utils/get-package-manager.test.ts | 6 ++++++ pnpm-lock.yaml | 18 +++++++++--------- 9 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 .changeset/cool-mails-bake.md create mode 100644 packages/shadcn/test/fixtures/project-bun-lock/bun.lock create mode 100644 packages/shadcn/test/fixtures/project-bun-lock/package.json diff --git a/.changeset/cool-mails-bake.md b/.changeset/cool-mails-bake.md new file mode 100644 index 0000000000..085f768e35 --- /dev/null +++ b/.changeset/cool-mails-bake.md @@ -0,0 +1,5 @@ +--- +"shadcn": patch +--- + +upgrade @antfu/ni diff --git a/packages/cli/package.json b/packages/cli/package.json index 45ed44ee08..99126d57e3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/packages/cli/src/utils/get-package-manager.ts b/packages/cli/src/utils/get-package-manager.ts index 91efb416ee..010d627735 100644 --- a/packages/cli/src/utils/get-package-manager.ts +++ b/packages/cli/src/utils/get-package-manager.ts @@ -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" } diff --git a/packages/shadcn/package.json b/packages/shadcn/package.json index 6630fe4c20..f38388a006 100644 --- a/packages/shadcn/package.json +++ b/packages/shadcn/package.json @@ -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", diff --git a/packages/shadcn/src/utils/get-package-manager.ts b/packages/shadcn/src/utils/get-package-manager.ts index db9632b826..63b155ad0b 100644 --- a/packages/shadcn/src/utils/get-package-manager.ts +++ b/packages/shadcn/src/utils/get-package-manager.ts @@ -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" } diff --git a/packages/shadcn/test/fixtures/project-bun-lock/bun.lock b/packages/shadcn/test/fixtures/project-bun-lock/bun.lock new file mode 100644 index 0000000000000000000000000000000000000000..fea2ca25b5d492ec1231f9903fca7afecce18975 GIT binary patch literal 1280 zcmY#Z)GsYA(of3F(@)JSQ%EY!;{sycoc!eMw9K4T-L(9o+{6;yG6OCq1_lPRv&=iD zH2v?CXT0^rv9jOy@jT)7>QijpN&Pnu&TfDGxPS$y2naxGL4X57!RZDlzY3-R%;#oc zXb=UmIDzz<`A%J5ueI!~ev^K-L+G^so_nvQ~r zLSjy4dR~4S7tEf2{~-Xx2fKqABEtfuxok>}jqHFLu^0hTZva(iL4^8MKmgK{0aZH( zt|!{aEVk4F=u|VfJ%$LU0@FAH(7_G!RU34)TT_z+7~@R!4D<{jp$$s;uoTb17-yho z29kLOH5*2whEQ>8Zdq!Po@+%(YEfQdPH;(4W?s6Tf+50s3%KFXDzre_wH6jkcw735|W>*W`v Y>%-OP>mt~?AfH(3m84feVr1}<0Ba1_WdHyG literal 0 HcmV?d00001 diff --git a/packages/shadcn/test/fixtures/project-bun-lock/package.json b/packages/shadcn/test/fixtures/project-bun-lock/package.json new file mode 100644 index 0000000000..b8cfd201f6 --- /dev/null +++ b/packages/shadcn/test/fixtures/project-bun-lock/package.json @@ -0,0 +1,7 @@ +{ + "name": "test-cli-project-bun", + "version": "1.0.0", + "main": "index.js", + "author": "shadcn", + "license": "MIT" +} diff --git a/packages/shadcn/test/utils/get-package-manager.test.ts b/packages/shadcn/test/utils/get-package-manager.test.ts index 3858f68384..c373b804af 100644 --- a/packages/shadcn/test/utils/get-package-manager.test.ts +++ b/packages/shadcn/test/utils/get-package-manager.test.ts @@ -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") diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc0250c07b..b74f3f3928 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -606,8 +606,8 @@ importers: packages/cli: dependencies: '@antfu/ni': - specifier: ^0.21.4 - version: 0.21.12 + specifier: ^23.2.0 + version: 23.3.1 '@babel/core': specifier: ^7.22.1 version: 7.26.7 @@ -697,8 +697,8 @@ importers: packages/shadcn: dependencies: '@antfu/ni': - specifier: ^0.21.4 - version: 0.21.12 + specifier: ^23.2.0 + version: 23.3.1 '@babel/core': specifier: ^7.22.1 version: 7.26.7 @@ -801,8 +801,8 @@ packages: resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} - '@antfu/ni@0.21.12': - resolution: {integrity: sha512-2aDL3WUv8hMJb2L3r/PIQWsTLyq7RQr3v9xD16fiz6O8ys1xEyLhhTOv8gxtZvJiTzjTF5pHoArvRdesGL1DMQ==} + '@antfu/ni@23.3.1': + resolution: {integrity: sha512-C90iyzm/jLV7Lomv2UzwWUzRv9WZr1oRsFRKsX5HjQL4EXrbi9H/RtBkjCP+NF+ABZXUKpAa4F1dkoTaea4zHg==} hasBin: true '@babel/code-frame@7.26.2': @@ -8108,7 +8108,7 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@antfu/ni@0.21.12': {} + '@antfu/ni@23.3.1': {} '@babel/code-frame@7.26.2': dependencies: @@ -8509,7 +8509,7 @@ snapshots: '@types/node': 20.5.1 chalk: 4.1.2 cosmiconfig: 8.3.6(typescript@5.7.3) - cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.3))(ts-node@10.9.2(@types/node@20.17.16)(typescript@5.7.3))(typescript@5.7.3) + cosmiconfig-typescript-loader: 4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.3))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.3))(typescript@5.7.3) lodash.isplainobject: 4.0.6 lodash.merge: 4.6.2 lodash.uniq: 4.5.0 @@ -12055,7 +12055,7 @@ snapshots: core-util-is@1.0.3: {} - cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.3))(ts-node@10.9.2(@types/node@20.17.16)(typescript@5.7.3))(typescript@5.7.3): + cosmiconfig-typescript-loader@4.4.0(@types/node@20.5.1)(cosmiconfig@8.3.6(typescript@5.7.3))(ts-node@10.9.2(@types/node@20.5.1)(typescript@5.7.3))(typescript@5.7.3): dependencies: '@types/node': 20.5.1 cosmiconfig: 8.3.6(typescript@5.7.3)