From d93436ba683935924ca11327fb90b3ab46535700 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:14:14 +0900 Subject: [PATCH 1/4] feat: support for `deno install` --- src/hooks/dependencies.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/hooks/dependencies.ts b/src/hooks/dependencies.ts index 6141aeb..ebe892a 100644 --- a/src/hooks/dependencies.ts +++ b/src/hooks/dependencies.ts @@ -8,11 +8,12 @@ import { execa } from 'execa' import { createSpinner } from 'nanospinner' import { projectDependenciesHook } from '../hook' -type PackageManager = 'npm' | 'bun' | 'pnpm' | 'yarn' +type PackageManager = 'npm' | 'bun' | 'deno' | 'pnpm' | 'yarn' const knownPackageManagers: { [key: string]: string } = { npm: 'npm install', bun: 'bun install', + deno: 'deno install', pnpm: 'pnpm install', yarn: 'yarn', } @@ -44,6 +45,16 @@ const registerInstallationHook = ( // hide install dependencies option if no package manager is installed if (!installedPackageManagerNames.length) return + // If Deno is installed, it will not be displayed because there is no 'deno install' in version 1. + if (installedPackageManagerNames.includes('deno')) { + const { stdout } = await execa('deno', ['-v']) + if (stdout.split(' ')[1].split('.')[0] == '1') { + installedPackageManagerNames.splice( + installedPackageManagerNames.indexOf('deno'), + 1, + ) + } + } if (typeof installArg === 'boolean') { installDeps = installArg From b88a91fe00215e3b6e93838f23dacee695e97091 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:35:58 +0900 Subject: [PATCH 2/4] docs: add deno --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9152e75..aae6c97 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Install dependencies after cloning template. npm create hono@latest ./my-app -- --install ``` -### `-p, --pm ` +### `-p, --pm ` Allows you to specify which package manager to use. From 7323a5529b63ea0059c08b307e10c66f59a9347c Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:36:39 +0900 Subject: [PATCH 3/4] chore: add Deno to current package manager candidates --- src/hooks/dependencies.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hooks/dependencies.ts b/src/hooks/dependencies.ts index ebe892a..ef4cd92 100644 --- a/src/hooks/dependencies.ts +++ b/src/hooks/dependencies.ts @@ -117,6 +117,7 @@ function getCurrentPackageManager(): PackageManager { const agent = process.env.npm_config_user_agent || 'npm' // Types say it might be undefined, just being cautious; if (agent.startsWith('bun')) return 'bun' + if (agent.startsWith('deno')) return 'deno' if (agent.startsWith('pnpm')) return 'pnpm' if (agent.startsWith('yarn')) return 'yarn' From f63e0fec774963a51ad7d32a07773653fb88d8a3 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:52:28 +0900 Subject: [PATCH 4/4] chore: clarify a comment --- src/hooks/dependencies.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/dependencies.ts b/src/hooks/dependencies.ts index ef4cd92..3f9aab1 100644 --- a/src/hooks/dependencies.ts +++ b/src/hooks/dependencies.ts @@ -45,7 +45,7 @@ const registerInstallationHook = ( // hide install dependencies option if no package manager is installed if (!installedPackageManagerNames.length) return - // If Deno is installed, it will not be displayed because there is no 'deno install' in version 1. + // If version 1 of Deno is installed, it will not be suggested because it doesn't have "deno install". if (installedPackageManagerNames.includes('deno')) { const { stdout } = await execa('deno', ['-v']) if (stdout.split(' ')[1].split('.')[0] == '1') {