From 19665c4444bc7361a938424892bf59a7798832d4 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Fri, 29 Mar 2024 06:06:10 +0900 Subject: [PATCH] fix: tweak texts (#29) --- my-app/.gitignore | 10 ++++++++++ my-app/README.md | 8 ++++++++ my-app/package.json | 13 +++++++++++++ my-app/src/index.ts | 9 +++++++++ my-app/tsconfig.json | 16 ++++++++++++++++ my-app/wrangler.toml | 18 ++++++++++++++++++ src/hooks/dependencies.ts | 4 +++- src/index.ts | 9 +++++---- 8 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 my-app/.gitignore create mode 100644 my-app/README.md create mode 100644 my-app/package.json create mode 100644 my-app/src/index.ts create mode 100644 my-app/tsconfig.json create mode 100644 my-app/wrangler.toml diff --git a/my-app/.gitignore b/my-app/.gitignore new file mode 100644 index 0000000..3c0be6e --- /dev/null +++ b/my-app/.gitignore @@ -0,0 +1,10 @@ +node_modules +dist +.wrangler +.dev.vars + +# Change them to your taste: +package-lock.json +yarn.lock +pnpm-lock.yaml +bun.lockb \ No newline at end of file diff --git a/my-app/README.md b/my-app/README.md new file mode 100644 index 0000000..cc58e96 --- /dev/null +++ b/my-app/README.md @@ -0,0 +1,8 @@ +``` +npm install +npm run dev +``` + +``` +npm run deploy +``` diff --git a/my-app/package.json b/my-app/package.json new file mode 100644 index 0000000..5da6241 --- /dev/null +++ b/my-app/package.json @@ -0,0 +1,13 @@ +{ + "scripts": { + "dev": "wrangler dev src/index.ts", + "deploy": "wrangler deploy --minify src/index.ts" + }, + "dependencies": { + "hono": "^4.1.5" + }, + "devDependencies": { + "@cloudflare/workers-types": "^4.20240208.0", + "wrangler": "^3.32.0" + } +} diff --git a/my-app/src/index.ts b/my-app/src/index.ts new file mode 100644 index 0000000..3191383 --- /dev/null +++ b/my-app/src/index.ts @@ -0,0 +1,9 @@ +import { Hono } from 'hono' + +const app = new Hono() + +app.get('/', (c) => { + return c.text('Hello Hono!') +}) + +export default app diff --git a/my-app/tsconfig.json b/my-app/tsconfig.json new file mode 100644 index 0000000..33a96fd --- /dev/null +++ b/my-app/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "strict": true, + "lib": [ + "ESNext" + ], + "types": [ + "@cloudflare/workers-types" + ], + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + }, +} \ No newline at end of file diff --git a/my-app/wrangler.toml b/my-app/wrangler.toml new file mode 100644 index 0000000..e7c323d --- /dev/null +++ b/my-app/wrangler.toml @@ -0,0 +1,18 @@ +name = "my-app" +compatibility_date = "2023-12-01" + +# [vars] +# MY_VAR = "my-variable" + +# [[kv_namespaces]] +# binding = "MY_KV_NAMESPACE" +# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + +# [[r2_buckets]] +# binding = "MY_BUCKET" +# bucket_name = "my-bucket" + +# [[d1_databases]] +# binding = "DB" +# database_name = "my-database" +# database_id = "" diff --git a/src/hooks/dependencies.ts b/src/hooks/dependencies.ts index 767ab6b..0eb39c8 100644 --- a/src/hooks/dependencies.ts +++ b/src/hooks/dependencies.ts @@ -53,7 +53,9 @@ const registerInstallationHook = (template: string) => { spinner.stop().clear() if (procExit == 0) { - console.log(`${chalk.green('✔')} Installed project dependencies`) + spinner.stopAndPersist({ + symbol: chalk.green('✔'), + }) } else { console.log(`${chalk.red('×')} Failed to install project dependencies`) exit(procExit) diff --git a/src/index.ts b/src/index.ts index 129359c..3e0ff13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -48,7 +48,7 @@ function mkdirp(dir: string) { } async function main() { - console.log(chalk.gray(`\ncreate-hono version ${version}`)) + console.log(chalk.gray(`create-hono version ${version}`)) const args = yargsParser(process.argv.slice(2)) @@ -132,8 +132,9 @@ async function main() { }, ) emitter.clone(targetDirectoryPath).then(() => { - spinner.stop().clear() - console.log(`${chalk.green('✔')} Cloned the template`) + spinner.stopAndPersist({ + symbol: chalk.green('✔'), + }) res({}) }) }) @@ -159,7 +160,7 @@ async function main() { ) } - console.log(chalk.green('✔ ' + chalk.bold('Copied project files'))) + console.log(chalk.green('🎉 ' + chalk.bold('Copied project files'))) console.log(chalk.gray('Get started with:'), chalk.bold(`cd ${target}`)) }