Skip to content

Commit 0ad264c

Browse files
authored
Merge pull request #20 from nobkd/refactor
mini refactor
2 parents c6ba837 + 479e55e commit 0ad264c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+834
-654
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
charset = utf-8
3+
end_of_line = lf
4+
tab_width = 2
5+
indent_size = 2
6+
indent_style = tab
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true

.github/workflows/ci.yml

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,9 @@ on:
88
branches:
99
- main
1010

11-
concurrency:
12-
group: ${{ github.ref }}
13-
cancel-in-progress: false
14-
1511
jobs:
16-
lint:
17-
name: Lint
18-
timeout-minutes: 10
19-
runs-on: ubuntu-latest
20-
21-
steps:
22-
- uses: actions/checkout@v4
23-
- uses: oven-sh/setup-bun@v1
24-
25-
- name: Install
26-
run: bun install --frozen-lockfile
27-
28-
- name: Lint
29-
run: bun run lint
30-
3112
test:
3213
name: Test
33-
timeout-minutes: 10
3414
runs-on: ubuntu-latest
3515

3616
steps:
@@ -41,4 +21,4 @@ jobs:
4121
run: bun install --frozen-lockfile
4222

4323
- name: Test
44-
run: bun run test:cov
24+
run: bun test --coverage

.github/workflows/publish.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ concurrency:
1111
jobs:
1212
publish:
1313
name: Publish to Firefox AMO
14-
timeout-minutes: 10
1514
runs-on: ubuntu-latest
1615

1716
steps:
@@ -28,14 +27,14 @@ jobs:
2827
run: bun run bundle
2928

3029
- name: Bundle source
31-
run: git archive --format=zip ${{ github.event.release.tag_name }} --output out/replace_maps_source.zip
30+
run: git archive --format=zip ${{ github.event.release.tag_name }} --output .out/replace_maps_source.zip
3231

3332
- name: Release
3433
uses: browser-actions/release-firefox-addon@latest
3534
with:
3635
37-
addon-path: out/replace_maps.zip
38-
source-path: out/replace_maps_source.zip
36+
addon-path: .out/replace_maps.zip
37+
source-path: .out/replace_maps_source.zip
3938
approval-note: Follow the instructions in AMO-README.md
4039
release-note: ${{ github.event.release.body }} # TODO: convert md to html, h1-6 not allowed... Currently ignoring this problem, as the field is needed for publishing
4140
license: MPL-2.0

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
node_modules/
2-
dist/
3-
out/
4-
coverage/
2+
.dist/
3+
.out/
4+
55
.version-update
66
.env
7-
8-
public/icons/

.prettierignore

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

.prettierrc

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

AMO-README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ This uses the `package-lock.json` file for installation to avoid package changes
1818
bun run build && bun run bundle
1919
```
2020

21-
This transpiles and minifies the TypeScript, copies static resources and bundles the output to `out/replace_maps.zip`.
21+
This minifies the JavaScript, copies static resources and bundles the output to `.out/replace_maps.zip`.

build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
# clean & create dir
4+
rm -rf '.dist'
5+
mkdir -p '.dist'
6+
7+
# copy static resources
8+
cp -r 'public/.' '.dist'
9+
cp 'node_modules/leaflet/dist/images/marker-icon-2x.png' 'node_modules/leaflet/dist/images/marker-shadow.png' '.dist'
10+
11+
# check if dev / prod, then build
12+
if [[ $1 == 'dev' ]]; then
13+
echo '--watch'
14+
else
15+
echo '--minify'
16+
fi | xargs bun build --experimental-css --experimental-html --outdir '.dist' 'src/bg.html' 'src/map.html' 'src/options.html'

bump.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { writeFileSync } from 'node:fs'
2+
import { version } from './package.json' with { type: 'json' }
3+
import manifest from './public/manifest.json' with { type: 'json' }
4+
5+
manifest.version = version
6+
writeFileSync('./public/manifest.json', JSON.stringify(manifest, null, 2))

bun.lock

Lines changed: 283 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)