Skip to content

Commit

Permalink
Merge pull request #5 from Jonghakseo/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jonghakseo authored Apr 18, 2022
2 parents dd95e3d + 7556334 commit 62adc2e
Show file tree
Hide file tree
Showing 50 changed files with 109 additions and 485 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
"globals": {
"chrome": "readonly"
},
"ignorePatterns": ["watch.js"]
"ignorePatterns": ["watch.js", "dist/**"]
}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@
.idea

#generated manifest
public/manifest.json
public/manifest.json

#copied contentStyle
public/contentStyle.css
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
- [Features](#features)
- [Installation](#installation)
- [Procedures](#procedures)
- [Attention](#attention)
- [Screenshots](#screenshots)
- [NewTab](#newtab)
- [Popup](#popup)
Expand Down Expand Up @@ -54,9 +53,6 @@ This boilerplate is made for creating chrome extensions using React and Typescri
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`.

## Attention <a name="attention"></a>
- Html files in the public folder are automatically copied from inside the `src/pages` folder. So, if you want to edit the html template file, edit index.html in each page folder.

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

### New Tab <a name="newtab"></a>
Expand Down
5 changes: 2 additions & 3 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"watch": [
"src"
"src", "utils", "vite.config.ts"
],
"ext": "tsx,css,html,ts",
"ignore": [
"src/**/*.spec.ts"
],
"exec": "vite build",
"delay": 300
"exec": "vite build"
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"ts-loader": "^9.2.6",
"ts-node": "^10.7.0",
"typescript": "^4.5.5",
"vite": "^2.9.1",
"vite-plugin-html": "^3.2.0"
"vite": "^2.9.1"
}
}
33 changes: 0 additions & 33 deletions plugins/copy-template.ts

This file was deleted.

15 changes: 0 additions & 15 deletions plugins/utils/check-called.ts

This file was deleted.

9 changes: 0 additions & 9 deletions public/devtools.html

This file was deleted.

11 changes: 0 additions & 11 deletions public/newtab.html

This file was deleted.

11 changes: 0 additions & 11 deletions public/options.html

This file was deleted.

11 changes: 0 additions & 11 deletions public/panel.html

This file was deleted.

11 changes: 0 additions & 11 deletions public/popup.html

This file was deleted.

6 changes: 0 additions & 6 deletions src/chrome.d.ts

This file was deleted.

6 changes: 6 additions & 0 deletions src/assets/index.d.ts → src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import Chrome from "chrome";

declare namespace chrome {
export default Chrome;
}

declare module "*.svg" {
import React = require("react");
export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
Expand Down
16 changes: 8 additions & 8 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ const manifest: ManifestType = {
name: packageJson.name,
version: packageJson.version,
description: packageJson.description,
options_page: "options.html",
background: { service_worker: "background.js" },
options_page: "src/pages/options/index.html",
background: { service_worker: "src/pages/background/index.js" },
action: {
default_popup: "popup.html",
default_popup: "src/pages/popup/index.html",
default_icon: "icon-34.png",
},
chrome_url_overrides: {
newtab: "newtab.html",
newtab: "src/pages/newtab/index.html",
},
icons: {
"128": "icon-128.png",
},
content_scripts: [
{
matches: ["http://*/*", "https://*/*", "<all_urls>"],
js: ["content.js"],
css: ["content.styles.css"],
js: ["src/pages/content/index.js"],
css: ["contentStyle.css"],
},
],
devtools_page: "devtools.html",
devtools_page: "src/pages/devtools/index.html",
web_accessible_resources: [
{
resources: ["content.styles.css", "icon-128.png", "icon-34.png"],
resources: ["contentStyle.css", "icon-128.png", "icon-34.png"],
matches: [],
},
],
Expand Down
1 change: 0 additions & 1 deletion src/pages/Content/index.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/pages/Devtools/index.html

This file was deleted.

5 changes: 0 additions & 5 deletions src/pages/Devtools/index.ts

This file was deleted.

File renamed without changes.
5 changes: 5 additions & 0 deletions src/pages/content/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
try {
console.log("content loaded");
} catch (e) {
console.error(e);
}
File renamed without changes.
10 changes: 10 additions & 0 deletions src/pages/devtools/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<title>Devtools</title>
</head>
<body>
<script type="module" src="./index.ts"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions src/pages/devtools/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
try {
chrome.devtools.panels.create(
"Dev Tools",
"icon-34.png",
"src/pages/panel/index.html"
);
} catch (e) {
console.error(e);
}
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/pages/Newtab/Newtab.tsx → src/pages/newtab/Newtab.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from "react";
import logo from "@assets/img/logo.svg";
import "@pages/Newtab/Newtab.css";
import "@pages/Newtab/Newtab.scss";
import "@pages/newtab/Newtab.css";
import "@pages/newtab/Newtab.scss";

const Newtab = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/pages/Newtab/Newtab.tsx</code> and save to reload.
Edit <code>src/pages/newtab/Newtab.tsx</code> and save to reload.
</p>
<a
className="App-link"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

<body>
<div id="app-container"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/Newtab/index.tsx → src/pages/newtab/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { createRoot } from "react-dom/client";
import Newtab from "@pages/Newtab/Newtab";
import "@pages/Newtab/index.css";
import Newtab from "@pages/newtab/Newtab";
import "@pages/newtab/index.css";

function init() {
const appContainer = document.querySelector("#app-container");
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import "@pages/Options/Options.css";
import "@pages/options/Options.css";

const Options: React.FC = () => {
return <div className="OptionsContainer">Options</div>;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

<body>
<div id="app-container"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/Options/index.tsx → src/pages/options/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { createRoot } from "react-dom/client";
import Options from "@pages/Options/Options";
import "@pages/Options/index.css";
import Options from "@pages/options/Options";
import "@pages/options/index.css";

function init() {
const appContainer = document.querySelector("#app-container");
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/Panel/Panel.tsx → src/pages/panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import "@pages/Panel/Panel.css";
import "@pages/panel/Panel.css";

const Panel: React.FC = () => {
return (
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Panel/index.html → src/pages/panel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

<body>
<div id="app-container"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/Panel/index.tsx → src/pages/panel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { createRoot } from "react-dom/client";
import Panel from "@pages/Panel/Panel";
import "@pages/Panel/index.css";
import Panel from "@pages/panel/Panel";
import "@pages/panel/index.css";

function init() {
const appContainer = document.querySelector("#app-container");
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/pages/Popup/Popup.tsx → src/pages/popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from "react";
import logo from "@assets/img/logo.svg";
import "@pages/Popup/Popup.css";
import "@pages/popup/Popup.css";

const Popup = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/pages/Popup/Popup.jsx</code> and save to reload.
Edit <code>src/pages/popup/Popup.jsx</code> and save to reload.
</p>
<a
className="App-link"
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/pages/Popup/index.html → src/pages/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@

<body>
<div id="app-container"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>
4 changes: 2 additions & 2 deletions src/pages/Popup/index.tsx → src/pages/popup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { createRoot } from "react-dom/client";
import "@pages/Popup/index.css";
import Popup from "@pages/Popup/Popup";
import "@pages/popup/index.css";
import Popup from "@pages/popup/Popup";

function init() {
const appContainer = document.querySelector("#app-container");
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"@pages/*": ["src/pages/*"]
}
},
"include": ["src", "plugins", "vite.config.ts"],
"include": ["src",
"utils", "vite.config.ts"],
}
File renamed without changes.
Loading

0 comments on commit 62adc2e

Please sign in to comment.