Skip to content

Commit 7db1159

Browse files
committed
Port to TypeScript with a few fixes
1 parent 0916586 commit 7db1159

28 files changed

+6250
-4468
lines changed

.eslintrc.json

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

.prettierignore

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

.prettierrc.json

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

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,7 @@ WebExtension which adds an option to the context menu to search with an image on
2323
1. `git clone ...`
2424
2. `npm ci`
2525
3. `npm run dev`
26-
4. `npm run start:chrome`
27-
28-
## Thanks to
29-
30-
- [FlandreDaisuki](https://github.com/Brawl345/Image-Reverse-Search-WebExtension/issues?q=is%3Apr+author%3AFlandreDaisuki)
31-
- [yfdyh000](https://github.com/Brawl345/Image-Reverse-Search-WebExtension/issues?q=is%3Apr+author%3Ayfdyh000)
32-
- All translators and other contributors
26+
4. `npm run start:chrome` or `npm run start:firefox`
3327

3428
## Screenshots
3529

biome.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"files": {
4+
"ignore": ["public/build"]
5+
},
6+
"formatter": {
7+
"indentStyle": "space"
8+
},
9+
"javascript": {
10+
"formatter": {
11+
"quoteStyle": "single"
12+
}
13+
},
14+
"json": {
15+
"formatter": {
16+
"indentStyle": "space"
17+
}
18+
},
19+
"overrides": [
20+
{
21+
"include": ["*.svelte"],
22+
"formatter": {
23+
"enabled": false
24+
},
25+
"linter": {
26+
"rules": {
27+
"style": {
28+
"useConst": "off",
29+
"useImportType": "off"
30+
}
31+
}
32+
}
33+
}
34+
]
35+
}

build.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env node
2+
import { rmSync } from 'node:fs';
3+
import path from 'node:path';
4+
import { fileURLToPath } from 'node:url';
5+
import * as esbuild from 'esbuild';
6+
import { sassPlugin } from 'esbuild-sass-plugin';
7+
import sveltePlugin from 'esbuild-svelte';
8+
import { sveltePreprocess } from 'svelte-preprocess';
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const isProduction = process.env.NODE_ENV === 'production';
13+
14+
try {
15+
rmSync(path.resolve('public', 'build'), { recursive: true });
16+
rmSync(path.resolve('public', '_metadata'), { recursive: true });
17+
} catch {
18+
//
19+
}
20+
21+
const context = await esbuild.context({
22+
entryPoints: [
23+
path.resolve(__dirname, 'source', 'service-worker', 'service-worker.ts'),
24+
path.resolve(__dirname, 'source', 'options', 'options.ts'),
25+
],
26+
bundle: true,
27+
minify: false,
28+
format: 'esm',
29+
splitting: true,
30+
sourcemap: isProduction ? false : 'inline',
31+
target: ['chrome120', 'firefox120'],
32+
outdir: path.resolve(__dirname, 'public', 'build'),
33+
logLevel: 'info',
34+
legalComments: 'none',
35+
plugins: [
36+
sassPlugin({ quietDeps: true }),
37+
sveltePlugin({
38+
preprocess: sveltePreprocess(),
39+
}),
40+
],
41+
});
42+
43+
if (isProduction) {
44+
await context.rebuild();
45+
await context.dispose();
46+
} else {
47+
await context.watch();
48+
}

esbuild.js

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

0 commit comments

Comments
 (0)