Skip to content

Commit

Permalink
#16 Create webpack config file for development and production env
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoud Skafi committed May 2, 2022
1 parent d731d59 commit 7a06393
Show file tree
Hide file tree
Showing 26 changed files with 5,167 additions and 993 deletions.
5,716 changes: 4,994 additions & 722 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 21 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "A chrome extension to watch movies together",
"main": "index.js",
"scripts": {
"build": "webpack --config webpack.config.js",
"watch": "watch 'npm run build'"
"build": "webpack --config webpack.prod.js",
"dev": "webpack --progress --config webpack.dev.js"
},
"repository": {
"type": "git",
Expand All @@ -19,12 +19,30 @@
},
"homepage": "https://github.com/abozanona/luca#readme",
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@babel/preset-react": "^7.16.7",
"@types/chrome": "0.0.183",
"babel-loader": "^8.2.5",
"copy-webpack-plugin": "^9.1.0",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^3.4.1",
"cssnano": "^5.1.7",
"file-loader": "^6.2.0",
"html-loader": "^3.1.0",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^2.6.0",
"node-sass": "^7.0.1",
"sass-loader": "^12.6.0",
"ts-loader": "^9.2.9",
"typescript": "^4.6.4",
"watch": "^1.0.2",
"webpack": "^5.72.0",
"webpack-cli": "^4.9.2"
"webpack-cli": "^4.9.2",
"webpack-merge": "^5.8.0"
},
"dependencies": {
"react": "^18.1.0",
"react-dom": "^18.1.0"
}
}
126 changes: 0 additions & 126 deletions public/css/page-style.css

This file was deleted.

19 changes: 0 additions & 19 deletions public/css/popup.css

This file was deleted.

Binary file removed public/icon128.png
Binary file not shown.
Binary file removed public/img/avatars/avatar-1.png
Binary file not shown.
Binary file removed public/img/avatars/avatar-2.png
Binary file not shown.
Binary file removed public/img/avatars/avatar-3.png
Binary file not shown.
Binary file removed public/img/reactions/angry.gif
Binary file not shown.
Binary file removed public/img/reactions/haha.gif
Binary file not shown.
Binary file removed public/img/reactions/like.gif
Binary file not shown.
Binary file removed public/img/reactions/love.gif
Binary file not shown.
Binary file removed public/img/reactions/sad.gif
Binary file not shown.
Binary file removed public/img/reactions/wow.gif
Binary file not shown.
4 changes: 0 additions & 4 deletions public/js/jquery.min.js

This file was deleted.

3 changes: 0 additions & 3 deletions public/js/socket.io.js

This file was deleted.

38 changes: 3 additions & 35 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,16 @@
"description": "This extension gives you the ability to create rooms and watch online videos with your friends.",
"version": "1.0.1",
"action": {
"default_icon": "icon128.png",
"default_popup": "popup.html",
"default_popup": "index.html",
"default_title": "Luca - Watch movies with friends"
},
"icons": {
"128": "icon128.png"
},
"background": {
"service_worker": "js/background.js"
},
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"js/socket.io.js",
"js/jquery.min.js",
"js/content.js"
],
"run_at": "document_idle",
"all_frames": true
}
],

"host_permissions": [
"*://*/*"
],
"permissions": [
"tabs",
"storage"
],
"manifest_version": 3,
"web_accessible_resources": [
{
"resources": [
"js/*",
"css/page-style.css",
"img/reactions/*"
],
"matches": [
"<all_urls>"
]
}
]
"manifest_version": 3
}
44 changes: 0 additions & 44 deletions public/popup.html

This file was deleted.

14 changes: 14 additions & 0 deletions src/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import { render } from "react-dom";
import './style/index.scss';

function Popup() {
return (
<div>
<h1>Hello World</h1>
<p>This is a very simple example</p>
</div>
);
}

render(<Popup />, document.getElementById("react-target"));
5 changes: 1 addition & 4 deletions src/js/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Array.from(document.getElementsByClassName("img-avatar")).forEach(element => {
(el.target as HTMLElement).classList.add('img-avatar-selected');
let avatarName = (el.target as HTMLElement).dataset.name;
chrome.storage.sync.set({ userAvatar: avatarName }, function () {

});
});
});
Expand All @@ -50,7 +49,6 @@ chrome.storage.sync.get('userAvatar', function (items) {
if (!userAvatar) {
userAvatar = 'avatar-1';
chrome.storage.sync.set({ userAvatar: userAvatar }, function () {

});
}
document.querySelector("[data-name=\"" + userAvatar + "\"]").classList.add("img-avatar-selected");
Expand All @@ -66,10 +64,8 @@ chrome.storage.sync.get('userName', function (items) {
let userName = items.userName;
if (!userName) {
var randomNames = ['Luca Paguro', 'Alberto Scorfano', 'Giulia Marcovaldo', 'Ercole Visconti', 'Daniela Paguro', 'Massimo Marcovaldo', 'Lorenzo Paguro', 'Ciccio', 'Guido', 'Signora Marsigliese', 'Tommaso', 'Grandma Paguro', 'Giacomo', 'Concetta Aragosta', 'Pinuccia Aragosta', 'Uncle Ugo', 'Maggiore'];

userName = randomNames[Math.floor(Math.random() * randomNames.length)];
chrome.storage.sync.set({ userName: userName }, function () {

});
}
(document.getElementById("txt-user-name") as HTMLInputElement).value = userName;
Expand All @@ -82,6 +78,7 @@ var actionsOrder = [
'ROOM_SETUP_COMPLETED',
];
var currentAction = 'NOTHING';

function getCurrentPageStatus() {
currentAction = 'NOTHING';
renderPopupScreen(currentAction);
Expand Down
3 changes: 3 additions & 0 deletions src/style/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body{
background-color: teal;
}
13 changes: 13 additions & 0 deletions src/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>skafi</h1>
<div id="react-target"></div>
</body>
</html>
Loading

0 comments on commit 7a06393

Please sign in to comment.