diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e569dca5..b5a963f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,10 @@ [![Bolt Open Source Codebase](./public/social_preview_index.jpg)](https://bolt.new) -> Welcome to the **Bolt** open-source codebase! This repo cpontains a simple example app using the core components from bolt.new to help you get started building **AI-powered software development tools** powered by StackBlitz’s **WebContainer API**. +> Welcome to the **Bolt** open-source codebase! This repo contains a simple example app using the core components from bolt.new to help you get started building **AI-powered software development tools** powered by StackBlitz’s **WebContainer API**. ### Why Build with Bolt + WebContainer API -By building with the Bolt + WebContainer API you can create browser-based applications that let users **prompt, run, edit, and deploy** full-stack web apps directly in the browser, without the need for virtual machines. With WebContainer API, you can build apps that give AI direct access and full control over a **Node.js server**, **filesystem**, **package manager** and **dev terminal** inside your users browser tab. This powerful combination allows you to create a new class of development tools that support all major javascript libraries and node packages right out of the box, all without remote environments or local installs. +By building with the Bolt + WebContainer API you can create browser-based applications that let users **prompt, run, edit, and deploy** full-stack web apps directly in the browser, without the need for virtual machines. With WebContainer API, you can build apps that give AI direct access and full control over a **Node.js server**, **filesystem**, **package manager** and **dev terminal** inside your users browser tab. This powerful combination allows you to create a new class of development tools that support all major JavaScript libraries and Node packages right out of the box, all without remote environments or local installs. ### What’s the Difference Between Bolt (This Repo) and [Bolt.new](https://bolt.new)? @@ -76,7 +76,7 @@ VITE_LOG_LEVEL=debug - `pnpm run build`: Builds the project. - `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables. - `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`. -- `pnpm test:` Runs the test suite using Vitest. +- `pnpm test`: Runs the test suite using Vitest. - `pnpm run typecheck`: Runs TypeScript type checking. - `pnpm run typegen`: Generates TypeScript types using Wrangler. - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages. diff --git a/README.md b/README.md index 9eb81822..f4ca2f74 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Bolt.new: AI-Powered Full-Stack Web Development in the Browser -Bolt.new is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md) +Bolt.new is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI-powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md) ## What Makes Bolt.new Different @@ -11,7 +11,7 @@ Claude, v0, etc are incredible- but you can't install packages, run backends or - **Full-Stack in the Browser**: Bolt.new integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to: - Install and run npm tools and libraries (like Vite, Next.js, and more) - Run Node.js servers - - Interact with 3rd party APIs + - Interact with third-party APIs - Deploy to production from chat - Share your work via a URL @@ -25,7 +25,7 @@ For developers interested in building their own AI-powered development tools wit Here are some tips to get the most out of Bolt.new: -- **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular Javacsript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly. +- **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly. - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting. @@ -35,8 +35,8 @@ Here are some tips to get the most out of Bolt.new: ## FAQs -**Where do sign up for a paid plan?** -Bolt.new is free to get started. If you need more AI tokens or want private projects, you can purchase a paid subscription in your [Bolt.new](https://bolt.new) settings, in the lower left hand corner of the application. +**Where do I sign up for a paid plan?** +Bolt.new is free to get started. If you need more AI tokens or want private projects, you can purchase a paid subscription in your [Bolt.new](https://bolt.new) settings, in the lower-left hand corner of the application. **What happens if I hit the free usage limit?** Once your free daily token limit is reached, AI interactions are paused until the next day or until you upgrade your plan. @@ -48,7 +48,7 @@ Yes, Bolt.new is in beta, and we are actively improving it based on feedback. Check out the [Issues section](https://github.com/bolt.new/issues) to report an issue or request a new feature. Please use the search feature to check if someone else has already submitted the same issue/request. **What frameworks/libraries currently work on Bolt?** -Bolt.new supports most popular javascript frameworks and libraries. If it runs on StackBlitz, it will run on Bolt.new as well. +Bolt.new supports most popular JavaScript frameworks and libraries. If it runs on StackBlitz, it will run on Bolt.new as well. **How can I add make sure my framework/project works well in bolt?** -We are excited to work with the javascript ecosystem to improve functionality in Bolt. Reach out to us via [hello@stackblitz.com](mailto:hello@stackblitz.com) to discuss how we can partner! +We are excited to work with the JavaScript ecosystem to improve functionality in Bolt. Reach out to us via [hello@stackblitz.com](mailto:hello@stackblitz.com) to discuss how we can partner! diff --git a/app/lib/runtime/action-runner.ts b/app/lib/runtime/action-runner.ts index cb65f87f..e2ea6a22 100644 --- a/app/lib/runtime/action-runner.ts +++ b/app/lib/runtime/action-runner.ts @@ -128,7 +128,9 @@ export class ActionRunner { const webcontainer = await this.#webcontainer; - const process = await webcontainer.spawn('jsh', ['-c', action.content]); + const process = await webcontainer.spawn('jsh', ['-c', action.content], { + env: { npm_config_yes: true }, + }); action.abortSignal.addEventListener('abort', () => { process.kill(); diff --git a/package.json b/package.json index 4f0061f1..55834556 100644 --- a/package.json +++ b/package.json @@ -71,9 +71,9 @@ "rehype-raw": "^7.0.0", "rehype-sanitize": "^6.0.0", "remark-gfm": "^4.0.0", + "remix-island": "^0.2.0", "remix-utils": "^7.6.0", "shiki": "^1.9.1", - "remix-island": "^0.2.0", "unist-util-visit": "^5.0.0" }, "devDependencies": { diff --git a/vite.config.ts b/vite.config.ts index 15cd0357..58e76cde 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,6 +1,6 @@ import { cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, vitePlugin as remixVitePlugin } from '@remix-run/dev'; import UnoCSS from 'unocss/vite'; -import { defineConfig } from 'vite'; +import { defineConfig, type ViteDevServer } from 'vite'; import { nodePolyfills } from 'vite-plugin-node-polyfills'; import { optimizeCssModules } from 'vite-plugin-optimize-css-modules'; import tsconfigPaths from 'vite-tsconfig-paths'; @@ -24,7 +24,34 @@ export default defineConfig((config) => { }), UnoCSS(), tsconfigPaths(), + chrome129IssuePlugin(), config.mode === 'production' && optimizeCssModules({ apply: 'build' }), ], }; }); + +function chrome129IssuePlugin() { + return { + name: 'chrome129IssuePlugin', + configureServer(server: ViteDevServer) { + server.middlewares.use((req, res, next) => { + const raw = req.headers['user-agent']?.match(/Chrom(e|ium)\/([0-9]+)\./); + + if (raw) { + const version = parseInt(raw[2], 10); + + if (version === 129) { + res.setHeader('content-type', 'text/html'); + res.end( + '

Please use Chrome Canary for testing.

Chrome 129 has an issue with JavaScript modules & Vite local development, see for more information.

Note: This only impacts local development. `pnpm run build` and `pnpm run start` will work fine in this browser.

', + ); + + return; + } + } + + next(); + }); + }, + }; +}