Skip to content

Commit 2b1bfca

Browse files
authored
🔖 chore(version): Update project version (#75)
1 parent 2b5b331 commit 2b1bfca

10 files changed

Lines changed: 83 additions & 61 deletions

bin/build-extension.mjs

Lines changed: 46 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,54 @@
1-
import fs from 'fs-extra';
2-
import path from 'path';
3-
import { fileURLToPath } from 'url';
4-
import webExt from 'web-ext';
1+
import fs from "node:fs";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
4+
import webExt from "web-ext";
55

66
const args = process.argv.slice(2);
77
const f = fileURLToPath(import.meta.url);
88
const dirname = path.dirname(f);
99

10-
1110
args.forEach((browser) => {
12-
if (['firefox', 'chrome'].includes(browser)) {
13-
fs.rmSync(`${dirname}/../dist/${browser}`,{ recursive: true, force: true });
14-
fs.mkdirSync(`${dirname}/../dist/${browser}`, { recursive: true });
15-
fs.copySync(`${dirname}/../src/manifest-${browser}.json`, `${dirname}/../dist/${browser}/manifest.json`);
16-
fs.copySync(`${dirname}/../src/popup`, `${dirname}/../dist/${browser}/popup`);
17-
fs.copySync(`${dirname}/../src/images`, `${dirname}/../dist/${browser}/images`);
18-
fs.copySync(`${dirname}/../src/background`, `${dirname}/../dist/${browser}/background`);
19-
fs.copySync(`${dirname}/../src/common.js`, `${dirname}/../dist/${browser}/common.js`);
11+
if (["firefox", "chrome"].includes(browser)) {
12+
fs.rmSync(`${dirname}/../dist/${browser}`, {
13+
recursive: true,
14+
force: true,
15+
});
16+
fs.mkdirSync(`${dirname}/../dist/${browser}`, { recursive: true });
17+
fs.copySync(
18+
`${dirname}/../src/manifest-${browser}.json`,
19+
`${dirname}/../dist/${browser}/manifest.json`,
20+
);
21+
fs.copySync(
22+
`${dirname}/../src/popup`,
23+
`${dirname}/../dist/${browser}/popup`,
24+
);
25+
fs.copySync(
26+
`${dirname}/../src/images`,
27+
`${dirname}/../dist/${browser}/images`,
28+
);
29+
fs.copySync(
30+
`${dirname}/../src/background`,
31+
`${dirname}/../dist/${browser}/background`,
32+
);
33+
fs.copySync(
34+
`${dirname}/../src/common.js`,
35+
`${dirname}/../dist/${browser}/common.js`,
36+
);
2037

21-
webExt.cmd.build({
22-
sourceDir: `${dirname}/../dist/${browser}`,
23-
artifactsDir: `${dirname}/../web-ext-artifacts`,
24-
overwriteDest: true,
25-
filename: `ecoindex.fr-${browser}.zip`,
26-
}, {
27-
shouldExitProgram: false,
28-
}).then(() => {
29-
// eslint-disable-next-line no-console
30-
console.log('Build complete');
31-
});
32-
}
38+
webExt.cmd
39+
.build(
40+
{
41+
sourceDir: `${dirname}/../dist/${browser}`,
42+
artifactsDir: `${dirname}/../web-ext-artifacts`,
43+
overwriteDest: true,
44+
filename: `ecoindex.fr-${browser}.zip`,
45+
},
46+
{
47+
shouldExitProgram: false,
48+
},
49+
)
50+
.then(() => {
51+
console.log("Build complete");
52+
});
53+
}
3354
});

bin/temp-manifest.mjs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
import { fileURLToPath } from 'url';
2-
import path from 'path';
3-
import { access, link, F_OK } from 'fs';
1+
import { access, link, F_OK } from "node:fs";
2+
import { fileURLToPath } from "node:url";
3+
import path from "node:path";
44

55
const f = fileURLToPath(import.meta.url);
66
const dirname = path.dirname(f);
77

88
const manifest = `${dirname}/../src/manifest.json`;
99

1010
access(manifest, F_OK, (err) => {
11-
if (err) {
12-
link(`${dirname}/../src/manifest-firefox.json`, manifest, (e) => {
13-
if (e) {
14-
// eslint-disable-next-line no-console
15-
console.log(e);
16-
}
17-
});
18-
}
11+
if (err) {
12+
link(`${dirname}/../src/manifest-firefox.json`, manifest, (e) => {
13+
if (e) {
14+
console.log(e);
15+
}
16+
});
17+
}
1918
});

bin/update-manifest.mjs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { readFileSync, writeFileSync } from 'fs';
2-
import path from 'path';
3-
import { fileURLToPath } from 'url';
1+
import { readFileSync, writeFileSync } from "node:fs";
2+
import path from "node:path";
3+
import { fileURLToPath } from "node:url";
44

55
const f = fileURLToPath(import.meta.url);
66
const dirname = path.dirname(f);
77

88
function updateManifest(browser) {
9-
const filename = `${dirname}/../src/manifest-${browser}.json`;
10-
const manifest = readFileSync(filename, 'utf8');
11-
const data = {
12-
...JSON.parse(manifest),
13-
version: process.env.npm_package_version,
14-
};
9+
const filename = `${dirname}/../src/manifest-${browser}.json`;
10+
const manifest = readFileSync(filename, "utf8");
11+
const data = {
12+
...JSON.parse(manifest),
13+
version: process.env.npm_package_version,
14+
};
1515

16-
writeFileSync(filename, JSON.stringify(data, null, 2), 'utf8');
16+
writeFileSync(filename, JSON.stringify(data, null, 2), "utf8");
1717
}
1818

19-
['firefox', 'chrome'].forEach((browser) => updateManifest(browser));
19+
["firefox", "chrome"].forEach((browser) => updateManifest(browser));

biome.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"ignoreUnknown": false,
1010
"includes": [
1111
"src/**/*.js",
12+
"bin/**/*.mjs",
13+
"web-ext-config.mjs",
1214
"!node_modules/**",
1315
"!dist/**",
1416
"!build/**",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ecoindex-browser-plugin",
3-
"version": "2.7.0",
3+
"version": "2.8.0",
44
"description": "This is the source code of the Ecoindex browser plugin. This simple plugin allows you to check the Ecoindex of any website you visit.",
55
"scripts": {
66
"manifest:tmp": "node bin/temp-manifest.mjs",

src/manifest-chrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.7.0",
2+
"version": "2.8.0",
33
"manifest_version": 3,
44
"homepage_url": "https://www.ecoindex.fr",
55
"name": "EcoIndex.fr",

src/manifest-firefox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2.7.0",
2+
"version": "2.8.0",
33
"manifest_version": 2,
44
"homepage_url": "https://www.ecoindex.fr",
55
"name": "EcoIndex.fr",

web-ext-config.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

web-ext-config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export default {
2+
sourceDir: "src",
3+
build: {
4+
overwriteDest: true,
5+
},
6+
run: {
7+
startUrl: ["https://www.ecoindex.fr/"],
8+
},
9+
};

0 commit comments

Comments
 (0)