Skip to content

Commit

Permalink
Merge pull request #1 from Jonghakseo/dev
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
Jonghakseo authored Mar 4, 2023
2 parents b70d5a4 + dd5e1ec commit 1a57e2d
Show file tree
Hide file tree
Showing 52 changed files with 2,310 additions and 422 deletions.
19 changes: 16 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react", "@typescript-eslint"],
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"react/react-in-jsx-scope": "off"
"react/react-in-jsx-scope": "off",
"react/jsx-curly-brace-presence": [
"warn",
{
"props": "never",
"children": "never"
}
]
},
"globals": {
"chrome": "readonly"
},
"ignorePatterns": ["watch.js", "dist/**"]
"ignorePatterns": [
"watch.js",
"dist/**"
]
}
90 changes: 2 additions & 88 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,3 @@
<div align="center">
<img src="public/icon-128.png" alt="logo"/>
<h1> Chrome Extension Boilerplate with<br/>React + Vite + TypeScript</h1>
# DragGPT

![](https://img.shields.io/badge/React-61DAFB?style=flat-square&logo=react&logoColor=black)
![](https://img.shields.io/badge/Typescript-3178C6?style=flat-square&logo=typescript&logoColor=white)
![](https://badges.aleen42.com/src/vitejs.svg)
![GitHub action badge](https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/actions/workflows/build.yml/badge.svg)
<img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https://github.com/Jonghakseo/chrome-extension-boilerplate-react-viteFactions&count_bg=%23#222222&title_bg=%23#454545&title=😀&edge_flat=true" alt="hits"/>


> This project is listed in the [Awesome Vite](https://github.com/vitejs/awesome-vite)
</div>

## Table of Contents

- [Intro](#intro)
- [Features](#features)
- [Installation](#installation)
- [Procedures](#procedures)
- [Screenshots](#screenshots)
- [NewTab](#newtab)
- [Popup](#popup)
- [Documents](#documents)


## Intro <a name="intro"></a>
This boilerplate is made for creating chrome extensions using React and Typescript.
> The focus was on improving the build speed and development experience with Vite.
## Features <a name="features"></a>
- [React 18](https://reactjs.org/)
- [TypeScript](https://www.typescriptlang.org/)
- [Jest](https://jestjs.io/)
- [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)
- [Vite](https://vitejs.dev/)
- [SASS](https://sass-lang.com/)
- [ESLint](https://eslint.org/)
- [Prettier](https://prettier.io/)
- [Chrome Extension Manifest Version 3](https://developer.chrome.com/docs/extensions/mv3/intro/)
- HMR(incomplete)
- [Refresh PR](https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite/pull/25)

## Installation <a name="installation"></a>

### Procedures <a name="procedures"></a>
1. Clone this repository.
2. Change `name` and `description` in package.json => **Auto synchronize with manifest**
3. Run `yarn install` or `npm i` (check your node version >= 16.6, recommended >= 18)
4. Run `yarn dev` or `npm run dev`
5. Load Extension on Chrome
1. Open - Chrome browser
2. Access - chrome://extensions
3. Check - Developer mode
4. Find - Load unpacked extension
5. Select - `dist` folder in this project (after dev or build)
6. If you want to build in production, Just run `yarn build` or `npm run build`.

## Screenshots <a name="screenshots"></a>

### New Tab <a name="newtab"></a>

<img width="971" src="https://user-images.githubusercontent.com/53500778/162631646-cd40976b-b737-43d0-8e6a-6ac090a2e2d4.png">

### Popup <a name="popup"></a>

<img width="314" alt="popup" src="https://user-images.githubusercontent.com/53500778/203561728-23517d46-12e3-4139-8a4f-e0b2f22a6ab3.png">


## Documents <a name="documents"></a>
- [Vite Plugin](https://vitejs.dev/guide/api-plugin.html)
- [ChromeExtension](https://developer.chrome.com/docs/extensions/mv3/)
- [Rollup](https://rollupjs.org/guide/en/)
- [Rollup-plugin-chrome-extension](https://www.extend-chrome.dev/rollup-plugin)



---
## Thanks To

| [Jetbrains](https://jb.gg/OpenSourceSupport) | [Jackson Hong](https://www.linkedin.com/in/j-acks0n/) |
|--------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| <img width="100" src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" alt="JetBrains Logo (Main) logo."> | <img width="100" src='https://avatars.githubusercontent.com/u/23139754?v=4' alt='Jackson Hong'/> |


---

[Jonghakseo](https://nookpi.tistory.com/)
made by [chrome-extension-boilerplate-react-vite](https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite)
10 changes: 5 additions & 5 deletions manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ const manifest: chrome.runtime.ManifestV3 = {
version: packageJson.version,
description: packageJson.description,
options_page: "src/pages/options/index.html",
background: { service_worker: "src/pages/background/index.js" },
background: {
service_worker: "src/pages/background/index.js",
type: "module",
},
action: {
default_popup: "src/pages/popup/index.html",
default_icon: "icon-34.png",
},
chrome_url_overrides: {
newtab: "src/pages/newtab/index.html",
},
permissions: ["tabs", "storage"],
icons: {
"128": "icon-128.png",
},
Expand All @@ -27,7 +28,6 @@ const manifest: chrome.runtime.ManifestV3 = {
css: ["assets/css/contentStyle.chunk.css"],
},
],
devtools_page: "src/pages/devtools/index.html",
web_accessible_resources: [
{
resources: [
Expand Down
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chrome-extension-boilerplate-react-vite",
"version": "0.0.1",
"description": "chrome extension boilerplate",
"name": "drag-gpt",
"version": "0.1.0",
"description": "DragGPT chrome extension",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -17,8 +17,17 @@
},
"type": "module",
"dependencies": {
"@chakra-ui/react": "^2.5.1",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@vespaiach/axios-fetch-adapter": "^0.3.1",
"axios": "0.26.0",
"framer-motion": "^10.0.1",
"openai": "^3.2.1",
"react": "18.2.0",
"react-dom": "18.2.0"
"react-dom": "18.2.0",
"regenerator-runtime": "^0.13.11"
},
"devDependencies": {
"@rollup/plugin-typescript": "^8.5.0",
Expand Down
Binary file modified public/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icon-34.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"manifest_version": 3,
"name": "chrome-extension-boilerplate-react-vite",
"version": "0.0.1",
"description": "chrome extension boilerplate",
"name": "drag-gpt",
"version": "0.1.0",
"description": "DragGPT chrome extension",
"options_page": "src/pages/options/index.html",
"background": {
"service_worker": "src/pages/background/index.js"
"service_worker": "src/pages/background/index.js",
"type": "module"
},
"action": {
"default_popup": "src/pages/popup/index.html",
"default_icon": "icon-34.png"
},
"chrome_url_overrides": {
"newtab": "src/pages/newtab/index.html"
},
"permissions": [
"tabs",
"storage"
],
"icons": {
"128": "icon-128.png"
},
Expand All @@ -32,7 +34,6 @@
]
}
],
"devtools_page": "src/pages/devtools/index.html",
"web_accessible_resources": [
{
"resources": [
Expand Down
7 changes: 0 additions & 7 deletions src/assets/img/logo.svg

This file was deleted.

24 changes: 24 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,27 @@ declare module "*.json" {
const content: string;
export default content;
}

declare global {
type ErrorMessageType = "GPTResponseError" | "Error";
type CommonMessageType =
| "RequestSelectionMessage"
| "GPTResponse"
| "SaveAPIKey"
| "SetAssistantPrompt"
| "SetRole"
| "Response";

type ActionMessageType =
| "LoadAPIKey"
| "ResetAPIKey"
| "GetAssistantPrompt"
| "GetRole";

type MessageType = ErrorMessageType | CommonMessageType | ActionMessageType;

type Message =
| { type: CommonMessageType; data: string }
| { type: ActionMessageType; data?: null }
| { type: ErrorMessageType; data: Error };
}
Loading

0 comments on commit 1a57e2d

Please sign in to comment.