Skip to content

Commit 0566083

Browse files
Spring cleaning and small features (#22)
* style: apply biome linter fixes and unify code formatting * Clean up little bit * fix the button again. * basic adds * clean up the wording * auto releaseing tools --------- Co-authored-by: Caner Çalışkaner <caner.caliskaner@kindly.ai>
1 parent 7666fb4 commit 0566083

35 files changed

+1746
-700
lines changed

.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
WEB_EXT_JWT_ISSUER="user:19771023:972"
2+
WEB_EXT_JWT_SECRET="19c847366b5bbb336e86a1d318f22ca721415e47b634fe3bb4364c5fd2a28a0b"
3+
CLIENT_ID=""
4+
CLIENT_SECRET=""
5+
REFRESH_TOKEN=""
6+
EXTENSION_ID="hbfegpidbpnljliidgjhbhbfcbhcfmpl"

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
.DS_Store
33
*.local
44
*.log*
5+
.firefox
56

6-
# Dist
7+
# Build output
78
node_modules
8-
dist/
9+
output/
910
build/
1011

1112
# IDE

biome.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"vcs": {
7-
"enabled": true,
8-
"clientKind": "git",
9-
"useIgnoreFile": true
10-
},
11-
"formatter": {
12-
"enabled": true,
13-
"indentStyle": "tab"
14-
},
15-
"javascript": {
16-
"formatter": {
17-
"quoteStyle": "single"
18-
}
19-
},
20-
"css": {
21-
"parser": {
22-
"cssModules": true
23-
}
24-
},
25-
"linter": {
26-
"enabled": true,
27-
"rules": {
28-
"recommended": true
29-
}
30-
}
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"organizeImports": {
4+
"enabled": true
5+
},
6+
"vcs": {
7+
"enabled": true,
8+
"clientKind": "git",
9+
"useIgnoreFile": true
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "tab"
14+
},
15+
"javascript": {
16+
"formatter": {
17+
"quoteStyle": "single"
18+
}
19+
},
20+
"css": {
21+
"parser": {
22+
"cssModules": true
23+
}
24+
},
25+
"linter": {
26+
"enabled": true,
27+
"rules": {
28+
"recommended": true
29+
}
30+
}
3131
}

build.mjs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { execSync } from 'node:child_process';
2+
import {
3+
copyFileSync,
4+
readFileSync,
5+
readdirSync,
6+
writeFileSync,
7+
} from 'node:fs';
8+
import { dirname, resolve } from 'node:path';
9+
import { fileURLToPath } from 'node:url';
10+
11+
const __dirname = dirname(fileURLToPath(import.meta.url));
12+
const outputDir = resolve(__dirname, 'output');
13+
const manifestPath = resolve(__dirname, 'manifest.base.json');
14+
const packageJsonPath = resolve(__dirname, 'package.json');
15+
const iconPath = resolve(__dirname, '128.png');
16+
17+
const FIREFOX_ID =
18+
'"gecko": {"id": "pasrs-helper@malaow3.com","strict_min_version": "109.0"}';
19+
20+
function build(target = 'chrome') {
21+
console.log(`Building for ${target}...`);
22+
23+
execSync('rsbuild build', { cwd: __dirname, stdio: 'inherit' });
24+
25+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
26+
const { version } = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
27+
manifest.version = version;
28+
29+
copyFileSync(iconPath, resolve(outputDir, '128.png'));
30+
31+
if (target === 'firefox') {
32+
manifest.browser_specific_settings = JSON.parse(`{${FIREFOX_ID}}`);
33+
} else {
34+
manifest.browser_specific_settings = undefined;
35+
}
36+
37+
writeFileSync(
38+
resolve(outputDir, 'manifest.json'),
39+
JSON.stringify(manifest, null, '\t'),
40+
);
41+
42+
console.log(`Built for ${target} successfully!`);
43+
}
44+
45+
const target = process.argv[2] || 'chrome';
46+
build(target);

build.sh

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

bun.lock

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

dev_server.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import chokidar from 'chokidar';
2-
const { exec } = require('child_process');
2+
const { exec } = require('node:child_process');
33

4-
chokidar.watch(['src', 'manifest.json', 'firefox_manifest.json']).on('all', (event, path) => {
5-
console.log(event, path);
6-
// Trigger a rebuild or other action here
7-
exec('rsbuild build', (error, stdout, stderr) => {
8-
if (error) {
9-
console.error(`Error: ${error.message}`);
10-
return;
11-
}
12-
if (stderr) {
13-
console.error(`stderr: ${stderr}`);
14-
return;
15-
}
16-
console.log(`stdout: ${stdout}`);
17-
});
18-
});
4+
const target = process.argv[2] || 'chrome';
5+
6+
console.log(`Starting dev server for ${target}...`);
7+
8+
chokidar.watch(['src', 'manifest.json']).on('all', (event, path) => {
9+
console.log(event, path);
10+
exec(`node build.mjs ${target}`, (error, stdout, stderr) => {
11+
if (error) {
12+
console.error(`Error: ${error.message}`);
13+
return;
14+
}
15+
if (stderr) {
16+
console.error(`stderr: ${stderr}`);
17+
return;
18+
}
19+
console.log(`stdout: ${stdout}`);
20+
});
21+
});

firefox_manifest.json

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

manifest.base.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "PASRS Helper",
3+
"description": "Automatically uploads the replay of your last battle in PSD.",
4+
"version": "1.1.0",
5+
"manifest_version": 3,
6+
"icons": {
7+
"128": "128.png"
8+
},
9+
"permissions": ["storage"],
10+
"host_permissions": ["*://*.pokemonshowdown.com/*", "*://*.psim.us/*"],
11+
"content_scripts": [
12+
{
13+
"matches": ["*://play.pokemonshowdown.com/*", "*://*.psim.us/*"],
14+
"js": ["dist/extension.js"]
15+
}
16+
],
17+
"web_accessible_resources": [
18+
{
19+
"resources": [
20+
"dist/showdown.js",
21+
"dist/lib-react.js",
22+
"dist/react.js",
23+
"dist/react.css"
24+
],
25+
"matches": ["*://play.pokemonshowdown.com/*", "*://*.psim.us/*"]
26+
}
27+
]
28+
}

manifest.json

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

0 commit comments

Comments
 (0)