Skip to content

Commit

Permalink
Merge pull request #67 from ufabc-next/fix/extension-on-matriculas
Browse files Browse the repository at this point in the history
Corrigindo a extensao na parte de Matricula da UFABC
  • Loading branch information
Joabesv authored Feb 23, 2024
2 parents b82ab46 + 49826a9 commit 3a26ba1
Show file tree
Hide file tree
Showing 41 changed files with 644 additions and 734 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ npm-debug.log

dist/
packages/
extension

src/components.d.ts
extension/manifest.json

*.crx
*.local
*.log
*.pem
*.xpi
*.zip
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
9 changes: 9 additions & 0 deletions extension/pages/iframe.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!doctype html>
<html>
<head>
<script src="../dist/lib/xdLocalStoragePostMessageApi.min.js"></script>
</head>
<body>
Next Storage
</body>
</html>
File renamed without changes.
10 changes: 10 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.js"],
"exclude": ["node_modules", "**/node_modules", "dist"]
}
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,29 @@
"type": "module",
"description": "Adiciona funcionalidades novas ao sistema de matricula da UFABC",
"scripts": {
"dev": "rimraf extension/dev && run-p dev:*",
"dev:prepare": "node --no-warnings=ExperimentalWarning tasks/prepare.dev.js dev",
"dev": "yarn clear && NODE_ENV=dev run-p dev:*",
"dev:prepare": "node tasks/prepare.js",
"dev:background": "yarn build:background --mode dev",
"dev:web": "vite",
"dev:js": "yarn run build:dev --watch src",
"build": "NODE_ENV=prod run-s clear build:web build:prepare build:prod",
"build:prepare": "node tasks/prepare.prod.js build",
"dev:js": "yarn run build:js --mode dev",
"dev:general": "yarn run build:general --mode dev",
"build": "NODE_ENV=prod run-s clear build:web build:prepare build:background build:js",
"build:prepare": "node tasks/prepare.js",
"build:background": "vite build --config vite.config.background.js",
"build:web": "vite build",
"build:dev": "tsup --onSuccess 'node --no-warnings=ExperimentalWarning tasks/mvsw.dev.js'",
"build:prod": "tsup --onSuccess 'node --no-warnings=ExperimentalWarning tasks/mvsw.prod.js'",
"clear": "rimraf extension/prod"
},
"standard": {
"globals": [
"chrome"
]
"build:js": "vite build --config vite.config.content.js",
"build:general": "vite build --config vite.config.files.js",
"clear": "rimraf --glob extension/dist extension/manifest.json extension.*"
},
"devDependencies": {
"@vitejs/plugin-vue2": "^2.3.1",
"chokidar": "^3.6.0",
"fs-extra": "^11.2.0",
"kolorist": "^1.8.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"tsup": "^8.0.1",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.1.1"
},
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
printWidth: 80,
tabWidth: 2,
singleQuote: false,
trailingComma: "all",
arrowParens: "always",
semi: true,
};
4 changes: 2 additions & 2 deletions src/lib/init.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { extensionUtils } from "../utils/extensionUtils";
import { extensionUtils } from "@/utils/extensionUtils";

xdLocalStorage.init({
window.xdLocalStorage.init({
/* required */
iframeUrl: extensionUtils.extensionURL("pages/iframe.html"),
//an option function to be called right after the iframe was loaded and ready for action
Expand Down
33 changes: 11 additions & 22 deletions src/manifest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pkg from "../package.json" with { type: "json" };

const isDev = process.env.NODE_ENV !== "prod";
import { isDev, PORT } from "../tasks/utils.js";

export async function getManifest() {
// update this file to update this manifest.json
Expand All @@ -11,11 +10,11 @@ export async function getManifest() {
version: pkg.version,
description: pkg.description,
icons: {
16: "./assets/icon-16.png",
128: "./assets/icon-128.png",
16: "assets/icon-16.png",
128: "assets/icon-128.png",
},
background: {
service_worker: "background.js",
service_worker: "dist/background/background.mjs",
},
permissions: ["storage"],
host_permissions: [
Expand All @@ -28,7 +27,7 @@ export async function getManifest() {
content_scripts: [
{
all_frames: true,
js: ["contentscript.js"],
js: ["dist/contentScripts/contentscript.global.js"],
matches: [
"http://*.ufabc.edu.br/*",
"https://*.ufabc.edu.br/*",
Expand All @@ -55,24 +54,20 @@ export async function getManifest() {
38: "assets/icon-38.png",
},
default_title: "Next Extension",
default_popup: "./views/Popup/index.html",
default_popup: "dist/views/Popup/index.html",
},
content_security_policy: {
extension_pages: "script-src 'self'; object-src 'self'",
extension_pages: isDev
? `script-src 'self' http://localhost:${PORT}; object-src 'self'`
: "script-src 'self'; object-src 'self'",
},
web_accessible_resources: [
{
resources: [
"components/*",
"assets/*",
"lib/*",
"pages/*",
"scripts/*",
"services/*",
"styles/*",
"utils/*",
"views/*",
"html/*",
"dist/contentScripts/style.css",
"dist/lib/*",
],
matches: [
"http://*.ufabc.edu.br/*",
Expand All @@ -85,11 +80,5 @@ export async function getManifest() {
],
};

if (isDev) {
manifest.content_security_policy = {
extension_pages: `script-src 'self' http://localhost:${5001}; object-src 'self'`,
};
}

return manifest;
}
9 changes: 0 additions & 9 deletions src/pages/iframe.html

This file was deleted.

Loading

0 comments on commit 3a26ba1

Please sign in to comment.