Skip to content

Commit

Permalink
Use tech stack vite_react_shadcn
Browse files Browse the repository at this point in the history
[skip gpt_engineer]
  • Loading branch information
lovable-dev[bot] committed Aug 27, 2024
0 parents commit c938817
Show file tree
Hide file tree
Showing 74 changed files with 11,300 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
settings: { react: { version: "18.2" } },
plugins: ["react-refresh"],
rules: {
"react/jsx-no-target-blank": "off",
"react/prop-types": "off",
},
};
24 changes: 24 additions & 0 deletions .gitignore
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?
10 changes: 10 additions & 0 deletions .gpt_engineer/get-user-snapshot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { toPng } from "html-to-image";

export const loadGetUserSnapshotEventListener = () => {
window.addEventListener("blur", () => {
toPng(document.body).then((url) => {
window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "http://localhost:3000");
window.top.postMessage({ type: "USER_SNAPSHOT", snapshot: url }, "https://gptengineer.app");
});
});
};
14 changes: 14 additions & 0 deletions .gpt_engineer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { loadGetUserSnapshotEventListener } from "./get-user-snapshot";
import { loadReportUrlChangeEventListener } from "./report-url-change";
import { loadReportErrorEventListener } from "./report-error";

const main = () => {
if (window.top === window.self) {
return;
}
loadGetUserSnapshotEventListener();
loadReportUrlChangeEventListener();
loadReportErrorEventListener();
};

main();
88 changes: 88 additions & 0 deletions .gpt_engineer/report-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
export const loadReportErrorEventListener = (() => {
let isInitialized = false;

const extractError = ({ message, lineno, colno, filename, error }) => {
return { message, lineno, colno, filename, stack: error?.stack };
};

return () => {
if (isInitialized) return;

const reportedErrors = new Set();

const generateErrorId = (event) => {
const { lineno, colno, filename, message } = event;
return `${message}|${filename}|${lineno}|${colno}`;
};

const isErrorAlreadyReported = (errorId) => {
if (reportedErrors.has(errorId)) {
return true;
}
reportedErrors.add(errorId);
// Optionally, clear the set after some time to prevent it from growing indefinitely
setTimeout(() => reportedErrors.delete(errorId), 5000);
return false;
};

const reportError = (event) => {
const errorId = generateErrorId(event);

// Prevent error being reported multiple times
if (isErrorAlreadyReported(errorId)) {
return;
}

const error = extractError(event);

console.log("GOTERR EVENT", event);
console.log("GOTERR ", error);

window.top.postMessage(
{ type: "RUNTIME_ERROR", error },
"https://gptengineer.app"
);
window.top.postMessage(
{ type: "RUNTIME_ERROR", error },
"http://localhost:3000"
);
};

// Listen to runtime errors and report them to the parent window
window.addEventListener("error", reportError);

// Listen to unhandled promise rejections
window.addEventListener("unhandledrejection", (event) => {
if (!event.reason?.stack) {
return;
}

const errorId =
event.reason?.stack || event.reason?.message || String(event.reason);

// Prevent error being reported multiple times
if (isErrorAlreadyReported(errorId)) {
return;
}

const error = {
message: event.reason?.message || "Unhandled promise rejection",
stack: event.reason?.stack || String(event.reason),
};

console.log("GOT UNHANDLED PROMISE REJECTION", event);
console.log("GOT UNHANDLED PROMISE REJECTION ", error);

window.top.postMessage(
{ type: "UNHANDLED_PROMISE_REJECTION", error },
"https://gptengineer.app"
);
window.top.postMessage(
{ type: "UNHANDLED_PROMISE_REJECTION", error },
"http://localhost:3000"
);
});

isInitialized = true;
};
})();
23 changes: 23 additions & 0 deletions .gpt_engineer/report-url-change.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const loadReportUrlChangeEventListener = () => {
/**
* Listen to URL changes and report them to the parent window
*
* See https://stackoverflow.com/a/46428962
* The Navigation API https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API seemed promising,
* but it is not supported in all major browsers.
*/
const observeUrlChange = () => {
let oldHref = document.location.href;
const body = document.querySelector("body");
const observer = new MutationObserver(() => {
if (oldHref !== document.location.href) {
oldHref = document.location.href;
window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "https://run.gptengineer.app");
window.top.postMessage({ type: "URL_CHANGED", url: document.location.href }, "http://localhost:3000");
}
});
observer.observe(body, { childList: true, subtree: true });
};

window.addEventListener("load", observeUrlChange);
};
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Welcome to your GPT Engineer project

## Project info

**Project**: hyperlink-hub-generator

**URL**: https://run.gptengineer.app/projects/1e6f15ba-e954-4d39-8745-70d397581807/improve

## How can I edit this code?

There are several ways of editing your application.

**Use GPT Engineer**

Simply visit the GPT Engineer project at [GPT Engineer](https://gptengineer.app/projects/1e6f15ba-e954-4d39-8745-70d397581807/improve) and start prompting.

Changes made via gptengineer.app will be committed automatically to this repo.

**Use your preferred IDE**

If you want to work locally using your own IDE, you can clone this repo and push changes. Pushed changes will also be reflected in the GPT Engineer UI.

The only requirement is having Node.js & npm installed - [install with nvm](https://github.com/nvm-sh/nvm#installing-and-updating)

Follow these steps:

```sh
git clone https://github.com/GPT-Engineer-App/hyperlink-hub-generator.git
cd hyperlink-hub-generator
npm i

# This will run a dev server with auto reloading and an instant preview.
npm run dev
```

**Edit a file directly in GitHub**

- Navigate to the desired file(s).
- Click the "Edit" button (pencil icon) at the top right of the file view.
- Make your changes and commit the changes.

**Use GitHub Codespaces**

- Navigate to the main page of your repository.
- Click on the "Code" button (green button) near the top right.
- Select the "Codespaces" tab.
- Click on "New codespace" to launch a new Codespace environment.
- Edit files directly within the Codespace and commit and push your changes once you're done.

## What technologies are used for this project?

This project is built with .

- Vite
- React
- shadcn-ui
- Tailwind CSS

## How can I deploy this project?

All GPT Engineer projects can be deployed directly via the GPT Engineer app.

Simply visit your project at [GPT Engineer](https://gptengineer.app/projects/1e6f15ba-e954-4d39-8745-70d397581807/improve) and click on Share -> Publish.

## I want to use a custom domain - is that possible?

We don't support custom domains (yet). If you want to deploy your project under your own domain then we recommend using Netlify or GitHub pages. Visit our docs for more details: [Custom domains](https://docs.gptengineer.app/tips-tricks/custom-domain/)
Binary file added bun.lockb
Binary file not shown.
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": false,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
5 changes: 5 additions & 0 deletions gpt-engineer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
build = "npm run build"

[gptengineer-app]
project_id = "..."
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>hyperlink-hub-generator</title>
<meta name="description" content="GPT Engineer Generated Project" />
<meta name="author" content="GPT Engineer" />
<meta property="og:image" content="/og-image.svg" />
</head>
<body>
<div id="root"></div>
<script src="/.gpt_engineer/index.js" type="module"></script>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
7 changes: 7 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading

0 comments on commit c938817

Please sign in to comment.