diff --git a/Todo.md b/Todo.md index 8bdc17e..02ad2bb 100644 --- a/Todo.md +++ b/Todo.md @@ -31,7 +31,7 @@ - [www.gunma-u.ac.jp](https://www.gunma-u.ac.jp/) - [ ] 基本的な実装 -### 開発 +### その他 - [ ] [webpack-chrome-extension-reloader](https://www.npmjs.com/package/webpack-chrome-extension-reloader)でホットリロードに対応する - [x] SCSSで直にスタイルを書き込んだ場合に無効化できない問題を修正する @@ -41,3 +41,4 @@ - [ ] ドキュメントを書く - [x] 設定を開いている間はポップアップを無効化する - [ ] ポップアップでの設定変更後に手動でリロードする必要がある問題を修正する +- [ ] 設定の初期値を変更する diff --git a/package.json b/package.json index e377e5b..9b2dae6 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "tailwindcss": "^3.3.5", "ts-loader": "^9.5.0", "ts-node": "^10.9.1", + "tsconfig-paths-webpack-plugin": "^4.1.0", "typescript": "^5.2.2", "webpack": "^5.89.0", "webpack-cli": "^5.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 038c308..34b6fa1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -160,6 +160,9 @@ devDependencies: ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@20.8.9)(typescript@5.2.2) + tsconfig-paths-webpack-plugin: + specifier: ^4.1.0 + version: 4.1.0 typescript: specifier: ^5.2.2 version: 5.2.2 @@ -4457,6 +4460,10 @@ packages: kind-of: 6.0.3 dev: true + /minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -5829,6 +5836,11 @@ packages: ansi-regex: 5.0.1 dev: true + /strip-bom@3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + dev: true + /strip-final-newline@2.0.0: resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} engines: {node: '>=6'} @@ -6202,6 +6214,24 @@ packages: v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + /tsconfig-paths-webpack-plugin@4.1.0: + resolution: {integrity: sha512-xWFISjviPydmtmgeUAuXp4N1fky+VCtfhOkDUFIv5ea7p4wuTomI4QTrXvFBX2S4jZsmyTSrStQl+E+4w+RzxA==} + engines: {node: '>=10.13.0'} + dependencies: + chalk: 4.1.2 + enhanced-resolve: 5.15.0 + tsconfig-paths: 4.2.0 + dev: true + + /tsconfig-paths@4.2.0: + resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} + engines: {node: '>=6'} + dependencies: + json5: 2.2.3 + minimist: 1.2.8 + strip-bom: 3.0.0 + dev: true + /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true diff --git a/src/options/index.tsx b/src/options/index.tsx index 060b318..f96cdcc 100644 --- a/src/options/index.tsx +++ b/src/options/index.tsx @@ -1,6 +1,6 @@ -import "/styles/popup.css"; -import "/styles/tailwind.css"; -import "/styles/gaming.scss"; +import "@/styles/popup.css"; +import "@/styles/tailwind.css"; +import "@/styles/gaming.scss"; import { createRoot } from "react-dom/client"; import { HashRouter } from "react-router-dom"; diff --git a/src/popup/index.tsx b/src/popup/index.tsx index 47f2d62..f3f83e5 100644 --- a/src/popup/index.tsx +++ b/src/popup/index.tsx @@ -1,6 +1,6 @@ -import "/styles/popup.css"; -import "/styles/tailwind.css"; -import "/styles/gaming.scss"; +import "@/styles/popup.css"; +import "@/styles/tailwind.css"; +import "@/styles/gaming.scss"; import { createRoot } from "react-dom/client"; diff --git a/src/scripts/background.ts b/src/scripts/background.ts index 5c91157..8abef47 100644 --- a/src/scripts/background.ts +++ b/src/scripts/background.ts @@ -1,6 +1,6 @@ -import StorageTool from "../class/StorageTool"; -import isTrue from "../utils/isTrue"; -import OpenOptions from "../utils/openOptions"; +import StorageTool from "@/class/StorageTool"; +import isTrue from "@/utils/isTrue"; +import OpenOptions from "@/utils/openOptions"; chrome.runtime.onInstalled.addListener(async () => { const storage = new StorageTool("other"); diff --git a/src/scripts/content_common.ts b/src/scripts/content_common.ts index a6a2534..d8988e1 100644 --- a/src/scripts/content_common.ts +++ b/src/scripts/content_common.ts @@ -1,5 +1,5 @@ -import "/styles/gaming.scss"; -import "/styles/darkmode.scss"; +import "@/styles/gaming.scss"; +import "@/styles/darkmode.scss"; chrome.runtime.onMessage.addListener((message) => { if (message === "reload") { diff --git a/src/scripts/content_kyomu.ts b/src/scripts/content_kyomu.ts index e46f5d2..ba43f80 100644 --- a/src/scripts/content_kyomu.ts +++ b/src/scripts/content_kyomu.ts @@ -1,4 +1,4 @@ -import "/styles/kyomu.css"; +import "@/styles/kyomu.css"; import { Kyomu } from "../class"; import LoadGamingWebsite from "../utils/loadGamingWebsite"; diff --git a/src/scripts/content_media.ts b/src/scripts/content_media.ts index 1f63608..4b18f6a 100644 --- a/src/scripts/content_media.ts +++ b/src/scripts/content_media.ts @@ -1,4 +1,4 @@ -import "/styles/media.css"; +import "@/styles/media.css"; import { Media } from "../class"; import loadGamingWebsite from "../utils/loadGamingWebsite"; diff --git a/src/scripts/content_moodle.ts b/src/scripts/content_moodle.ts index 7b5772d..ef77a9e 100644 --- a/src/scripts/content_moodle.ts +++ b/src/scripts/content_moodle.ts @@ -1,4 +1,4 @@ -import "/styles/moodle.scss"; +import "@/styles/moodle.scss"; import { Moodle } from "../class"; import loadGamingWebsite from "../utils/loadGamingWebsite"; diff --git a/src/scripts/content_mylib.ts b/src/scripts/content_mylib.ts index d98e109..321149c 100644 --- a/src/scripts/content_mylib.ts +++ b/src/scripts/content_mylib.ts @@ -1,4 +1,4 @@ -import "/styles/mylibrary.css"; +import "@/styles/mylibrary.css"; import { MyLibrary } from "../class"; import LoadGamingWebsite from "../utils/loadGamingWebsite"; diff --git a/src/scripts/content_sso.ts b/src/scripts/content_sso.ts index cafefe4..14809a7 100644 --- a/src/scripts/content_sso.ts +++ b/src/scripts/content_sso.ts @@ -1,4 +1,4 @@ -import "/styles/sso.css"; +import "@/styles/sso.scss"; import { SSO } from "../class"; import loadGamingWebsite from "../utils/loadGamingWebsite"; diff --git a/src/styles/sso.css b/src/styles/sso.css deleted file mode 100644 index 00c906a..0000000 --- a/src/styles/sso.css +++ /dev/null @@ -1,14 +0,0 @@ -.header_column, -.input_column, -.input_form th, -#username_id_input, -#password_input { - background: transparent !important; -} - -#username_id_input, -#password_input { - border: 1px solid #ccc !important; - border-radius: 5px !important; - padding: 5px !important; -} diff --git a/src/styles/sso.scss b/src/styles/sso.scss new file mode 100644 index 0000000..949c0d2 --- /dev/null +++ b/src/styles/sso.scss @@ -0,0 +1,16 @@ +[data-gaming_gundai="true"] { + .header_column, + .input_column, + .input_form th, + #username_id_input, + #password_input { + background: transparent !important; + } + + #username_id_input, + #password_input { + border: 1px solid #ccc !important; + border-radius: 5px !important; + padding: 5px !important; + } +} diff --git a/tsconfig.json b/tsconfig.json index 0b76c0d..3b3d7ea 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,10 @@ "outDir": "dist", "strict": true, "jsx": "react-jsx", - "esModuleInterop": true + "esModuleInterop": true, + "baseUrl": ".", + "paths": { + "@/*": ["src/*"] + } } } diff --git a/webpack.common.js b/webpack.common.js index da7c9cc..9dc6d05 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -4,6 +4,7 @@ const ESLintPlugin = require("eslint-webpack-plugin"); const fs = require("fs"); const HtmlPlugin = require("html-webpack-plugin"); const path = require("path"); +const { TsconfigPathsPlugin } = require("tsconfig-paths-webpack-plugin"); const loadFilesInScripts = function () { const dir = path.join(__dirname, "src/scripts"); @@ -31,6 +32,10 @@ module.exports = { resolve: { extensions: [".ts", ".tsx", ".js", ".jsx"], roots: [path.resolve(__dirname, "node_modules"), path.resolve(__dirname, "src")], + plugins: [new TsconfigPathsPlugin({ configFile: path.resolve(__dirname, "tsconfig.json") })], + alias: { + "@": path.resolve(__dirname, "src"), + }, }, module: {