diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/discord-interactions/README.md | 6 | ||||
-rw-r--r-- | examples/discord-interactions/gitignore | 88 | ||||
-rw-r--r-- | examples/discord-interactions/package.json | 2 | ||||
-rw-r--r-- | examples/next/README.md | 20 | ||||
-rw-r--r-- | examples/next/package.json | 8 | ||||
-rw-r--r-- | examples/next/pages/index.tsx | 6 | ||||
-rw-r--r-- | examples/next/pages/second.tsx | 22 | ||||
-rw-r--r-- | examples/react/README.md | 74 | ||||
-rw-r--r-- | examples/react/package.json | 2 |
9 files changed, 119 insertions, 109 deletions
diff --git a/examples/discord-interactions/README.md b/examples/discord-interactions/README.md index d620cacd1..84e69d9b2 100644 --- a/examples/discord-interactions/README.md +++ b/examples/discord-interactions/README.md @@ -10,12 +10,6 @@ A [slash-create](https://npm.im/slash-create) template, using [Bun runtime](http bun create discord-interactions interactions-bot ``` -After that, make sure to install dependencies using bun or any other npm compatible package manager: - -```sh -bun install -``` - ### Development To run this locally, rename `.env.example` to `.env` and fill in the variables, then you can run `bun run.js` to start a local dev environment and use something like ngrok/cloudflare to tunnel it to a URL. diff --git a/examples/discord-interactions/gitignore b/examples/discord-interactions/gitignore new file mode 100644 index 000000000..1c22d540a --- /dev/null +++ b/examples/discord-interactions/gitignore @@ -0,0 +1,88 @@ +/data + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +#config file +config.json + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# TernJS port file +.tern-port + +# pm2 +.pm2 +.pm2.bak diff --git a/examples/discord-interactions/package.json b/examples/discord-interactions/package.json index d31709aa2..5f5213622 100644 --- a/examples/discord-interactions/package.json +++ b/examples/discord-interactions/package.json @@ -1,5 +1,5 @@ { - "version": "0.0.3", + "version": "0.0.5", "name": "@bun-examples/discord-interactions", "dependencies": { "slash-create": "^5.7.0" diff --git a/examples/next/README.md b/examples/next/README.md index b12f3e33e..cd0b17310 100644 --- a/examples/next/README.md +++ b/examples/next/README.md @@ -1,22 +1,24 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +# Next.js with Bun runtime + +This is a [Next.js](https://nextjs.org/) project bootstrapped with Bun. ## Getting Started +### Cloning the repo + +```sh +bun create next ./app +``` + First, run the development server: ```bash -npm run dev -# or -yarn dev +bun dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. -You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. - -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. - -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. +You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. ## Learn More diff --git a/examples/next/package.json b/examples/next/package.json index 3963ff5cc..870dc2c34 100644 --- a/examples/next/package.json +++ b/examples/next/package.json @@ -1,15 +1,15 @@ { "name": "@bun-examples/next", - "version": "0.0.51", + "version": "0.0.53", "main": "index.js", "dependencies": { "next": "^12.1.0", - "react": "^17", - "react-dom": "^17", + "react": "^18", + "react-dom": "^18", "react-is": "^17.0.2" }, "devDependencies": { - "@types/react": "latest", + "@types/react": "^18", "bun-framework-next": "^12", "typescript": "latest" }, diff --git a/examples/next/pages/index.tsx b/examples/next/pages/index.tsx index 90b988011..fc078404d 100644 --- a/examples/next/pages/index.tsx +++ b/examples/next/pages/index.tsx @@ -1,13 +1,7 @@ import Head from "next/head"; -import Link from "next/link"; import React from "react"; import styles from "../styles/Home.module.css"; import nextPackage from "next/package.json"; -export async function getStaticProps(ctx) { - return { - props: {}, - }; -} export default function Home({}) { return ( diff --git a/examples/next/pages/second.tsx b/examples/next/pages/second.tsx deleted file mode 100644 index 0e7b5a5cf..000000000 --- a/examples/next/pages/second.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Link from "next/link"; - -export default function Second({}) { - return ( - <div style={{ padding: 16 }}> - <h1>Second</h1> - - <ul> - <li> - <Link href="/"> - <a>Root page</a> - </Link> - </li> - <li> - <Link href="/foo/bar/third"> - <a>Third! page</a> - </Link> - </li> - </ul> - </div> - ); -} diff --git a/examples/react/README.md b/examples/react/README.md index 02aac3f6e..a857d896c 100644 --- a/examples/react/README.md +++ b/examples/react/README.md @@ -1,70 +1,24 @@ -# Getting Started with Create React App +# React with Bun runtime -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +This is a React project boostrapped with bun. -## Available Scripts +## Getting Started -In the project directory, you can run: +### Cloning the repo -### `yarn start` +```sh +bun create react ./app +``` -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. +### Development -The page will reload if you make edits.\ -You will also see any lint errors in the console. +First, run the development server. -### `yarn test` +``` +bun dev +``` -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. +Open http://localhost:3000 with your browser to see the result. -### `yarn build` +You can start editing the page by modifying src/App.jsx. The page auto-updates as you edit the file. -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `yarn eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `yarn build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/examples/react/package.json b/examples/react/package.json index 8e180116e..e3e8e39b3 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -1,6 +1,6 @@ { "name": "@bun-examples/react", - "version": "0.0.42", + "version": "0.0.47", "dependencies": { "react": "^17.0.2", "react-dom": "^17.0.2", |