From 7248252cb7fb003aa1bf6d84870c460dc467cf2b Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:13:18 +0100 Subject: [PATCH 1/4] feat: add Deno package manager support to only-allow Add 'deno' to the availablePMList and implement Deno-specific case in the switch statement that provides clear error messages and installation instructions when non-Deno package managers are used in a Deno-enforced project. The error message guides users to use 'deno install' and provides a link to official Deno installation documentation. --- bin.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin.js b/bin.js index 6273b26..49c51a0 100644 --- a/bin.js +++ b/bin.js @@ -1,6 +1,6 @@ #!/usr/bin/env node const whichPMRuns = require('which-pm-runs') -const availablePMList = ['npm', 'cnpm', 'pnpm', 'yarn', 'bun'] +const availablePMList = ['npm', 'cnpm', 'pnpm', 'yarn', 'bun', 'deno'] function box(s) { const lines = s.trim().split("\n") @@ -53,6 +53,12 @@ For more details, go to https://yarnpkg.com/`)) If you don't have Bun, go to https://bun.sh/docs/installation and find installation method that suits your environment.`)) break + + case 'deno': + console.log(box(`Use "deno install" for installation in this project. + +If you don't have Deno, go to https://deno.land/#installation and follow the installation instructions.`)) + break } process.exit(1) } From a1d63f5a325d30d66c86ac8bbfd6b74de4dc7f61 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:13:24 +0100 Subject: [PATCH 2/4] feat: add 'deno' keyword to package.json Include 'deno' in the keywords array to improve discoverability for users searching for Deno-related package management tools on npm. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 50e0ae8..e510cf2 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ "cnpm", "npm", "yarn", - "bun" + "bun", + "deno" ], "author": "Zoltan Kochan ", "license": "MIT", From fdc5b31e0fdc8dbdd62f3ab9149b8df39cacaaaa Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:13:30 +0100 Subject: [PATCH 3/4] docs: add Deno usage example to README Add documentation showing how to configure package.json to enforce Deno as the package manager using the preinstall script. This follows the same pattern as other package managers documented in the README. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 9ad2d40..cea8a7b 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ If you want to force [bun](https://bun.sh/), add: } ``` +If you want to force [deno](https://deno.land/), add: + +```json +{ + "scripts": { + "preinstall": "npx only-allow deno" + } +} +``` + ## License [MIT](LICENSE) From 9a070e1a20e57887ec70bbebaf0b22ce9508b6ba Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Mon, 22 Sep 2025 12:13:35 +0100 Subject: [PATCH 4/4] test: add Deno test fixtures Add test fixtures for Deno package manager enforcement testing, including package.json configuration that references the only-allow binary for preinstall script validation. --- __fixtures__/deno/package.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 __fixtures__/deno/package.json diff --git a/__fixtures__/deno/package.json b/__fixtures__/deno/package.json new file mode 100644 index 0000000..74ff7ec --- /dev/null +++ b/__fixtures__/deno/package.json @@ -0,0 +1,5 @@ +{ + "scripts": { + "preinstall": "node ../../bin.js deno" + } +} \ No newline at end of file