chore: update examples (#101)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* chore: fixed serve-static example * chore: update mustache example * chore: remove unnecessary fields * chore: update durable objects example
authored by Yusuke Wada · committed by GitHub · parent 298a3e8 · Browse files · 12 files·+46 added−131 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
12 files+46 added−131 removed
- other:+46 added−131 removed
Provenance
- Commit
9db4f6f- Tree
d1ec3ff- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
298a3e8
12 files changed+46 added−131 removed
modified:examples/durable-objects/package.json+6 added-8 removed
123455677891091112131314151614151619171819{ "private": true, "name": "hono-example-durable-objects", "version": "0.0.1", "main": "dist/worker.mjs", "main": "dist/index.js", "scripts": { "build": "webpack" "test": "echo \"Error: no test specified\" && exit 1", "dev": "wrangler dev src/index.ts", "publish": "wrangler publish src/index.ts" }, "author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)", "license": "MIT", "devDependencies": { "@cloudflare/workers-types": "^3.0", "ts-loader": "^9.2.6", "typescript": "^4.4.4", "webpack": "^5.65.0", "webpack-cli": "^4.9.1" "wrangler": "^0.0.16" }, "dependencies": { "hono": "*" "hono": "^0.3.7" }}No newline at end of fileNo newline at end of filedeleted:examples/durable-objects/tsconfig.json-28 removed
12345678910111213141516171819202122232425262728{ "compilerOptions": { "outDir": "./dist", "target": "esnext", "module": "esnext", "lib": [ "esnext", "webworker" ], "declaration": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true, "strictPropertyInitialization": false, "strictNullChecks": false, "types": [ "@cloudflare/workers-types", ] }, "include": [ "src" ], "exclude": [ "node_modules", "dist" ]}No newline at end of filedeleted:examples/durable-objects/webpack.config.js-30 removed
123456789101112131415161718192021222324252627282930const path = require('path')
module.exports = { entry: './src/index.ts', output: { filename: 'worker.mjs', libraryTarget: 'module', path: path.join(__dirname, 'dist'), }, devtool: 'cheap-module-source-map', mode: 'development', resolve: { extensions: ['.ts', '.tsx', '.js'], }, module: { rules: [ { test: /\.tsx?$/, loader: 'ts-loader', options: { // transpileOnly is useful to skip typescript checks occasionally: transpileOnly: true, }, }, ], }, experiments: { outputModule: true, },}modified:examples/durable-objects/wrangler.toml+1 added-14 removed
1224567834101112131415161756782 unmodified linesname = "durable-objects-counter"# type = "javascript" is required to use the `[build]` sectiontype = "javascript"account_id = ""workers_dev = trueroute = ""zone_id = ""compatibility_date = "2022-01-11"compatibility_date = "2022-02-12"
[build]command = "yarn build"[build.upload]# The "modules" upload format is required for all projects that export a Durable Objects classformat = "modules"dir = "dist"main = "worker.mjs"
[durable_objects]bindings = [{name = "COUNTER", class_name = "Counter"}]
[[migrations]]2 unmodified linesmodified:examples/jsx-ssr/package.json-9 removed
6 unmodified lines7891011121314151117181920121314156 unmodified lines6 unmodified lines "build": "esbuild --bundle --sourcemap --outdir=dist ./src/index.tsx", "dev": "miniflare --live-reload --debug", "publish": "wrangler publish dist/index.js" }, "repository": { "type": "git", "url": "git+https://github.com/yusukebe/hono.git" }, "author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)", "license": "MIT", "bugs": { "url": "https://github.com/yusukebe/hono/issues" }, "homepage": "https://github.com/yusukebe/hono#readme", "dependencies": { "hono": "^0.3.7", "nano-jsx": "^0.0.29" },6 unmodified linesadded:examples/mustache/src/index.js+16 added
12345678910111213141516import { Hono } from 'hono'import { mustache } from 'hono/mustache'
const app = new Hono()
app.use('*', mustache())
app.get('/', (c) => { return c.render( 'index', { name: 'Hono[炎]', title: 'Hono mustache exaple' }, // Parameters { footer: 'footer', header: 'header' } // Partials )})
app.fire()deleted:examples/mustache/index.js-16 removed
12345678910111213141516import { Hono } from '../../dist'import { mustache } from '../../src/middleware/mustache/mustache'
const app = new Hono()
app.use('*', mustache())
app.get('/', (c) => { return c.render( 'index', { name: 'Hono[炎]', title: 'Hono mustache exaple' }, // Parameters { footer: 'footer', header: 'header' } // Partials )})
app.fire()modified:examples/mustache/package.json+11 added-2 removed
12344567891011121314151617918{ "name": "hono-example-mustache", "version": "0.0.1", "main": "index.js", "main": "src/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "dev": "wrangler dev src/index.js", "publish": "wrangler publish src/index.js" }, "license": "MIT", "dependencies": { "hono": "^0.3.7", "mustache": "^4.2.0" }, "devDependencies": { "wrangler": "^0.0.16" }}}No newline at end of filemodified:examples/mustache/wrangler.toml+1 added-8 removed
1 name = "hono-example-mustache"2-type = "webpack"3-route = ''4-zone_id = ''5-usage_model = ''6-compatibility_flags = []7-workers_dev = true8-compatibility_date = "2022-01-28"2+compatibility_date = "2022-02-12"3 4 [site]5 bucket = "./view"12-entry-point = "."modified:examples/serve-static/src/index.js+3 added-3 removed
1-import { Hono } from '../../../dist'2-import { serveStatic } from '../../../src/middleware/serve-static/serve-static'1+import { Hono } from 'hono'2+import { serveStatic } from 'hono/serve-static'3 4 const hono = new Hono()5 6-hono.use('/static/*', serveStatic({ root: './assets' }))6+hono.use('/static/*', serveStatic({ root: './' }))7 hono.get('/', (c) => c.text('This is Home! You can access: /static/hello.txt'))8 9 hono.fire()modified:examples/serve-static/package.json+6 added-4 removed
3 unmodified lines4 "description": "",5 "main": "src/index.js",6 "scripts": {7 "test": "echo \"Error: no test specified\" && exit 1",8- "dev": "wrangler dev",9- "publish": "wrangler publish"8+ "dev": "wrangler dev src/index.js",9+ "publish": "wrangler publish src/index.js"10 },11- "author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)",11 "license": "MIT",12 "dependencies": {14- "hono": "*"13+ "hono": "^0.3.7"14+ },15+ "devDependencies": {16+ "wrangler": "^0.0.16"17 }18 }modified:examples/serve-static/wrangler.toml+2 added-9 removed
1 name = "hono-example-serve-static"2-type = "webpack"3-route = ''4-zone_id = ''5-usage_model = ''6-compatibility_flags = []7-workers_dev = true8-compatibility_date = "2022-01-09"2+compatibility_date = "2022-02-12"3 4 [site]11-bucket = "./"12-entry-point = "./"5+bucket = "./assets"