Skip to content

Commit fa2c668

Browse files
dev: Build the extension with Parcel
1 parent bff4087 commit fa2c668

File tree

7 files changed

+3286
-45
lines changed

7 files changed

+3286
-45
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
/node_modules
1+
/dist
22
/web-ext-artifacts
3+
4+
/node_modules
5+
/.parcel-cache

.parcelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@parcel/config-webextension"
3+
}

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@
88
install: ## Install the dependencies
99
npm install
1010

11+
.PHONY: watch
12+
watch: ## Watch and build the assets
13+
rm -rf dist/dev_assets
14+
npm run start:watcher
15+
1116
.PHONY: run
1217
run: BROWSER ?= firefox
1318
run: ## Run the extension in a browser (can take a BROWSER argument)
1419
ifeq ($(BROWSER),chromium)
15-
npm run start -- --target chromium
20+
npm run start:browser -- --target chromium
1621
else
17-
npm run start -- --target firefox-desktop
22+
npm run start:browser -- --target firefox-desktop
1823
endif
1924

2025
.PHONY: build
2126
build: ## Build the web extension
22-
npm run build
27+
rm -rf dist/assets
28+
npm run build:assets
29+
npm run build:artifact
2330

2431
.PHONY: lint
2532
lint: LINTER ?= all
@@ -28,6 +35,8 @@ ifeq ($(LINTER), $(filter $(LINTER), all biome))
2835
npm run lint:biome
2936
endif
3037
ifeq ($(LINTER), $(filter $(LINTER), all webext))
38+
rm -rf dist/assets
39+
npm run build:assets
3140
npm run lint:webext
3241
endif
3342

docs/development.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Install the dependencies:
1313
$ make install
1414
```
1515

16+
Build the assets with the Parcel watcher:
17+
18+
```console
19+
$ make watch
20+
```
21+
1622
Run the extension in Firefox:
1723

1824
```console
@@ -39,3 +45,6 @@ You can run a specific linter with:
3945
$ make lint LINTER=biome
4046
$ make lint LINTER=webext
4147
```
48+
49+
Note that the webext linter runs over the `dist/assets` files and not the files under `src/`.
50+
This is to check that the final assets don't present any problems.

docs/upload.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Build the extension with:
66
$ make build
77
```
88

9+
It builds the assets under the `dist/` folder, and builds a ZIP archive under `web-ext-artifacts/`.
10+
911
## Upload to the Firefox Add-ons store
1012

1113
Go to [addons.mozilla.org/developers](https://addons.mozilla.org/fr/developers/) and login.

0 commit comments

Comments
 (0)