Skip to content

Commit

Permalink
chore: Centraliser les prothèses.
Browse files Browse the repository at this point in the history
  • Loading branch information
regseb committed Nov 8, 2020
1 parent 6f58893 commit ed337ba
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 881 deletions.
13 changes: 4 additions & 9 deletions .metalint/metalint.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"patterns": [
"!/.git/", "!/coverage/", "!/jsdocs/", "!/node_modules/", "!/src/lib/",
"**"
"!/.git/", "!/coverage/", "!/jsdocs/", "!/node_modules/",
"!/src/polyfill/lib/", "**"
],
"checkers": [
{
Expand Down Expand Up @@ -33,15 +33,10 @@
"linters": "stylelint"
}, {
"patterns": "/src/options/*.css",
"linters": { "purgecss": { "content": "/src/options/*.html" } }
"linters": { "purgecss": "purgecss_options.json" }
}, {
"patterns": "/src/popup/*.css",
"linters": {
"purgecss": {
"content": "/src/popup/*.html",
"whitelistPatternsChildren": ["/^playlist-items$/u"]
}
}
"linters": { "purgecss": "purgecss_popup.json" }
}, {
"patterns": ["!/CHANGELOG.md", "*.md"],
"linters": "markdownlint"
Expand Down
3 changes: 3 additions & 0 deletions .metalint/purgecss_options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"content": "/src/options/*.html"
}
4 changes: 4 additions & 0 deletions .metalint/purgecss_popup.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"content": "/src/popup/*.html",
"whitelistPatternsChildren": ["/^playlist-items$/u"]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"funding": "https://www.paypal.me/sebastienregne",
"type": "module",
"scripts": {
"postinstall": "node scripts/postinstall.js",
"postinstall": "node script/sync.js",
"lint": "metalint",
"test": "npm run test:unit && npm run test:integration",
"test:unit": "c8 mocha -r test/polyfill.js test/unit/",
Expand All @@ -33,7 +33,7 @@
"start": "web-ext run -s src/",
"build": "web-ext build -s src/ -a build/ -o",
"release": "standard-version",
"clean": "rm -rf build/ coverage/ jsdocs/ node_modules/"
"clean": "node script/clean.js"
},
"dependencies": {
"dialog-polyfill": "0.5.3"
Expand Down
6 changes: 6 additions & 0 deletions script/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import fs from "fs";

fs.rmdirSync("build/", { recursive: true });
fs.rmdirSync("coverage/", { recursive: true });
fs.rmdirSync("jsdocs/", { recursive: true });
fs.rmdirSync("node_modules/", { recursive: true });
21 changes: 21 additions & 0 deletions script/sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { promises as fs } from "fs";
import path from "path";

const copy = async function (src, dest) {
await fs.mkdir(path.dirname(dest), { recursive: true });
const stats = await fs.lstat(src);
if (stats.isDirectory()) {
await fs.mkdir(dest, { recursive: true });

for await (const filename of fs.readdir(src)) {
copy(path.join(src, filename), path.join(dest, filename));
}
} else {
fs.copyFile(src, dest);
}
};

copy("node_modules/dialog-polyfill/dist/dialog-polyfill.css",
"src/polyfill/lib/dialog-polyfill/style.css");
copy("node_modules/dialog-polyfill/dist/dialog-polyfill.esm.js",
"src/polyfill/lib/dialog-polyfill/script.js");
17 changes: 0 additions & 17 deletions scripts/postinstall.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/background.html

This file was deleted.

12 changes: 12 additions & 0 deletions src/background/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Cast Kodi</title>
</head>
<body>
<script src="/polyfill/script.js" type="module"></script>
<script src="migrate.js" type="module"></script>
<script src="menu.js" type="module"></script>
</body>
</html>
5 changes: 3 additions & 2 deletions src/background/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ const handleChange = async function (changes) {
});
config["server-list"].forEach((server, index) => {
const name = (/^\s*$/u).test(server.name)
? browser.i18n.getMessage("menus_noName", index + 1)
: server.name;
? browser.i18n.getMessage("menus_noName",
(index + 1).toString())
: server.name;
browser.menus.create({
checked: config["server-active"] === index,
id: index.toString(),
Expand Down
Loading

0 comments on commit ed337ba

Please sign in to comment.