Merge pull request #311 from leonbubova/feature/implement-webpack

Implement webpack to use ES6 modules
This commit is contained in:
Dmitrii Selivanov authored and GitHub committed 2021-12-16 02:05:31 +03:00
commit c745a3566d
12 files changed
+3819 -70

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
+3 -1
View File
@@ -26,4 +26,6 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln
*.sw*
*.sw*
node_modules
+29
View File
@@ -4,6 +4,35 @@ Thank you for investing your time in contributing to our project! All your chang
## Getting Started
Please use Prettier with default settings for formatting.
#### Prerequisites
You need to have node and npm installed to create the bundled version of the source.
Versions used when setting up:
- node: 12.18.4
- npm: 6.14.6
To create the `bundled-content-script.js` that contains most of the business logic of this extension you have to install all dependencies first.
1. Go to the root of the repo and run:
```
npm install
```
2. Run the following command to create `bundled-content-script.js` which is used in `manifest.json`
```
npm run bundle
```
This will also start a watcher that re-bundles automatically once you save a file inside the source.
Congratulations, You are now ready to develop!
### Issues
#### Opening a new issue
If you have any issues with the extension, please search to make sure the issue isn't already reported. If it isn't, open an issue, using the issue form is highly recommended but not mandatory.
-1
View File
@@ -1 +0,0 @@
RYD.getInstance().init();
+10 -24
View File
@@ -2,40 +2,26 @@
"name": "Return YouTube Dislike",
"description": "Returns ability to see dislikes",
"version": "2.0.0.2",
"manifest_version": 3,
"manifest_version": 2,
"background": {
"service_worker": "ryd.background.js"
"scripts": ["ryd.background.js"]
},
"icons": {
"48": "icons/icon48.png",
"128": "icons/icon128.png"
"128": "icons/icon128.png"
},
"host_permissions": ["*://*.youtube.com/*"],
"permissions": [
"storage"
],
"action": {
"permissions": ["activeTab", "*://*.youtube.com/*", "storage"],
"browser_action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": [
"*://youtube.com/*",
"*://www.youtube.com/*",
"*://m.youtube.com/*"
],
"matches": ["*://*.youtube.com/*"],
"exclude_matches": ["*://*.music.youtube.com/*"],
"js": ["ryd.content-script.js", "ryd.tools.js", "/init/init.js"],
"css": ["content-style.css"]
}
],
"externally_connectable": {
"matches": ["*://*.youtube.com/*"]
},
"web_accessible_resources": [
{
"resources": ["ryd.script.js"],
"matches": ["*://*.youtube.com/*"]
"run_at": "document_idle",
"css": ["content-style.css"],
"js": ["bundled-content-script.js"]
}
]
}
-27
View File
@@ -1,27 +0,0 @@
{
"name": "Return YouTube Dislike",
"description": "Returns ability to see dislikes",
"version": "2.0.0.2",
"manifest_version": 2,
"background": {
"scripts": ["ryd.background.js"]
},
"icons": {
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"permissions": ["activeTab", "*://*.youtube.com/*", "storage"],
"browser_action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": ["*://*.youtube.com/*"],
"exclude_matches": ["*://*.music.youtube.com/*"],
"run_at": "document_idle",
"css": ["content-style.css"],
"js": ["ryd.content-script.js", "ryd.tools.js", "/init/init.js"]
}
]
}
+41
View File
@@ -0,0 +1,41 @@
{
"name": "Return YouTube Dislike",
"description": "Returns ability to see dislikes",
"version": "2.0.0.2",
"manifest_version": 3,
"background": {
"service_worker": "ryd.background.js"
},
"icons": {
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"host_permissions": ["*://*.youtube.com/*"],
"permissions": [
"storage"
],
"action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": [
"*://youtube.com/*",
"*://www.youtube.com/*",
"*://m.youtube.com/*"
],
"exclude_matches": ["*://*.music.youtube.com/*"],
"js": ["bundled-content-script.js"],
"css": ["content-style.css"]
}
],
"externally_connectable": {
"matches": ["*://*.youtube.com/*"]
},
"web_accessible_resources": [
{
"resources": ["ryd.script.js"],
"matches": ["*://*.youtube.com/*"]
}
]
}
+18
View File
@@ -367,3 +367,21 @@ RYD.getInstance = function () {
if (typeof RYD.instance == "undefined") RYD.instance = new RYD();
return RYD.instance;
};
RYDTools = {};
RYDTools.getBrowser = function () {
if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") {
return chrome;
} else if (
typeof browser !== "undefined" &&
typeof browser.runtime !== "undefined"
) {
return browser;
} else {
console.log("browser is not supported");
return false;
}
};
RYD.getInstance().init();
-17
View File
@@ -1,17 +0,0 @@
RYDTools = {};
RYDTools.getBrowser = function () {
if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") {
return chrome;
} else if (
typeof browser !== "undefined" &&
typeof browser.runtime !== "undefined"
) {
return browser;
} else {
console.log("browser is not supported");
return false;
}
};
+3668
View File
File diff suppressed because it is too large. Load diff
+33
View File
@@ -0,0 +1,33 @@
{
"name": "return-youtube-dislike",
"version": "2.0.0",
"description": "Chrome extension to return youtube dislikes",
"main": "ryd.content-script.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"bundle": "node_modules/.bin/webpack \"./Extensions/combined/ryd.content-script.js\" -o \"./Extensions/combined\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/Anarios/return-youtube-dislike.git"
},
"keywords": [
"youtube",
"dislike",
"return",
"extension"
],
"author": "Anarios",
"bugs": {
"url": "https://github.com/Anarios/return-youtube-dislike/issues"
},
"homepage": "https://github.com/Anarios/return-youtube-dislike#readme",
"devDependencies": {
"babel-loader": "^8.2.3",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.26.0",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.6.0"
}
}
+14
View File
@@ -0,0 +1,14 @@
const path = require("path");
module.exports = {
entry: path.join(__dirname, "./Extensions/combined/ryd.content-script.js"),
output: {
filename: "bundled-content-script.js",
path: path.resolve(__dirname, "Extensions/combined"),
},
externals: {
ramda: "R",
},
module: {},
watch: true
};