-
Notifications
You must be signed in to change notification settings - Fork 0
creating vite template & trying to get it to work #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,20 +1,38 @@ | ||||||||||
// lib/prompts.ts | ||||||||||
|
||||||||||
export const VUE_APP_SYSTEM_PROMPT = `You are an expert Vue.js and Tailwind CSS developer. | ||||||||||
You will be generating a complete Vue 3 application based on the provided description. | ||||||||||
export const REACT_APP_SYSTEM_PROMPT = `You are an expert React, TypeScript, and Tailwind CSS developer. | ||||||||||
You will be generating React application code based on the provided description. | ||||||||||
This code will be inserted into an existing Vite + React + TypeScript template. | ||||||||||
|
||||||||||
Follow these guidelines: | ||||||||||
- Use Vue 3 Composition API with <script setup> syntax | ||||||||||
- Use Tailwind CSS for styling | ||||||||||
- Include the package.json file in the response | ||||||||||
- The following files are provided and should not be modified: nuxt.config.ts, postcss.config.ts, tailwind.config.ts, vite.config.ts | ||||||||||
- Follow Vue.js best practices and conventions | ||||||||||
- Use React 19 with TypeScript | ||||||||||
- Use Tailwind CSS v4 for styling | ||||||||||
- DO NOT use component libraries like shadcn/ui or Material UI | ||||||||||
- Build all UI components from scratch using Tailwind CSS | ||||||||||
- Use the hooks pattern and follow React best practices | ||||||||||
- Create a well-structured application with proper component organization | ||||||||||
- Include proper TypeScript types | ||||||||||
- Ensure proper TypeScript typing | ||||||||||
- Add comments explaining complex logic | ||||||||||
- Handle loading states and errors appropriately | ||||||||||
- Ensure responsive design | ||||||||||
- Use port 5173 for the Vite server | ||||||||||
- Always remember to write an index.css file and import it in the main app file | ||||||||||
- Import CSS in main.tsx as: import './index.css' | ||||||||||
- Use relative imports (not path aliases): import App from './App.tsx' | ||||||||||
- IMPORTANT: Always generate ALL components that you reference or import | ||||||||||
|
||||||||||
IMPORTANT: Only generate these application files: | ||||||||||
- src/main.tsx (entry point) | ||||||||||
- src/App.tsx (main app component) | ||||||||||
- src/index.css (with Tailwind imports) | ||||||||||
- src/components/* (your React components) | ||||||||||
- package.json (only for additional dependencies you need) | ||||||||||
|
||||||||||
DO NOT generate configuration files like: | ||||||||||
- vite.config.ts | ||||||||||
- tsconfig files | ||||||||||
- eslint configs | ||||||||||
- index.html | ||||||||||
|
||||||||||
These configuration files are already part of the template. | ||||||||||
|
||||||||||
RESPONSE FORMAT: | ||||||||||
You must return a valid JSON array of file objects. Each file object must have exactly this structure: | ||||||||||
|
@@ -25,8 +43,8 @@ You must return a valid JSON array of file objects. Each file object must have e | |||||||||
|
||||||||||
Do not include any markdown formatting, code blocks, or explanatory text. The response must be pure JSON.`; | ||||||||||
|
||||||||||
export const VUE_APP_USER_PROMPT = (description: string) => ` | ||||||||||
Create a Vue.js application with the following requirements: | ||||||||||
export const REACT_APP_USER_PROMPT = (description: string) => ` | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ Description Must Be a StringThe function should accept only string inputs for the 'description' parameter.
view all inputs Unit Tests// Unit Test for "Description Must Be a String": The function should accept only string inputs for the 'description' parameter.
function benchify_description(description) {
const result = REACT_APP_USER_PROMPT(description);
expect(result).toBeDefined();
}
it('benchify_description_exec_test_passing_0', () => {
const args = superjson.parse('{"json":[["]xE"]]}');
benchify_description(...args);
}); |
||||||||||
Create a React application with the following requirements: | ||||||||||
${description}`; | ||||||||||
|
||||||||||
export const TEMPERATURE = 0.7; | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# You can use most Debian-based base images | ||
FROM ubuntu:22.04 | ||
|
||
# Install dependencies and customize sandbox | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
git \ | ||
bash \ | ||
ca-certificates \ | ||
gnupg \ | ||
build-essential \ | ||
sudo \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Node.js 18.x LTS (more stable for this purpose) | ||
RUN mkdir -p /etc/apt/keyrings && \ | ||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ | ||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \ | ||
apt-get update && \ | ||
apt-get install -y nodejs && \ | ||
npm install -g [email protected] | ||
|
||
# Create app user | ||
RUN useradd -m -s /bin/bash viteuser && \ | ||
echo "viteuser ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/viteuser | ||
|
||
# Create app directory | ||
WORKDIR /app | ||
|
||
# Install Vite globally | ||
RUN npm install -g vite create-vite | ||
|
||
# Create basic Vite project structure | ||
COPY ./template /app | ||
|
||
# Set proper ownership and permissions | ||
RUN chown -R viteuser:viteuser /app && \ | ||
chmod -R 775 /app | ||
|
||
# Install dependencies as the viteuser | ||
USER viteuser | ||
RUN cd /app && npm install | ||
|
||
# Create Vite cache directories with proper permissions | ||
RUN mkdir -p /app/node_modules/.vite && \ | ||
mkdir -p /app/node_modules/.vite-temp && \ | ||
chmod -R 777 /app/node_modules/.vite && \ | ||
chmod -R 777 /app/node_modules/.vite-temp | ||
|
||
# Expose port | ||
EXPOSE 5173 | ||
|
||
# Set entrypoint | ||
CMD ["npm", "run", "dev"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This is a config for E2B sandbox template. | ||
# You can use template ID (0szqhsrgikxynzgu09xv) or template name (vite-template) to create a sandbox: | ||
|
||
# Python SDK | ||
# from e2b import Sandbox, AsyncSandbox | ||
# sandbox = Sandbox("vite-template") # Sync sandbox | ||
# sandbox = await AsyncSandbox.create("vite-template") # Async sandbox | ||
|
||
# JS SDK | ||
# import { Sandbox } from 'e2b' | ||
# const sandbox = await Sandbox.create('vite-template') | ||
|
||
team_id = "35f2ed91-a6af-4e6c-a693-9e9e244fcdbd" | ||
dockerfile = "e2b.Dockerfile" | ||
template_name = "vite-template" | ||
template_id = "0szqhsrgikxynzgu09xv" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# React + TypeScript + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh | ||
|
||
## Expanding the ESLint configuration | ||
|
||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules: | ||
|
||
```js | ||
export default tseslint.config({ | ||
extends: [ | ||
// Remove ...tseslint.configs.recommended and replace with this | ||
...tseslint.configs.recommendedTypeChecked, | ||
// Alternatively, use this for stricter rules | ||
...tseslint.configs.strictTypeChecked, | ||
// Optionally, add this for stylistic rules | ||
...tseslint.configs.stylisticTypeChecked, | ||
], | ||
languageOptions: { | ||
// other options... | ||
parserOptions: { | ||
project: ['./tsconfig.node.json', './tsconfig.app.json'], | ||
tsconfigRootDir: import.meta.dirname, | ||
}, | ||
}, | ||
}) | ||
``` | ||
|
||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: | ||
|
||
```js | ||
// eslint.config.js | ||
import reactX from 'eslint-plugin-react-x' | ||
import reactDom from 'eslint-plugin-react-dom' | ||
|
||
export default tseslint.config({ | ||
plugins: { | ||
// Add the react-x and react-dom plugins | ||
'react-x': reactX, | ||
'react-dom': reactDom, | ||
}, | ||
rules: { | ||
// other rules... | ||
// Enable its recommended typescript rules | ||
...reactX.configs['recommended-typescript'].rules, | ||
...reactDom.configs.recommended.rules, | ||
}, | ||
}) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Output String Format Validation
The output string must start with 'Create a React application with the following requirements:'.
superjson.parse('{"json":[["MaFa"]]}')...
view full inputview all inputs
The property-based test failed because the generated string did not start with the expected prefix 'Create a React application with the following requirements:'. The input argument was "{"json":[["MaFa"]]}" and the actual output string started with a newline character, causing the assertion to fail.
Stack Trace
Unit Tests