diff --git a/package.json b/package.json index b121b8f..bc89cad 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,9 @@ "dependencies": { "web-ext": "^7.11.0" }, + "type": "module", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "node validate_addon.js", "build:firefox": "web-ext build --source-dir firefox --overwrite-dest --ignore-files \"*.zip\" --artifacts-dir firefox/web-ext-artifacts", "run:firefox": "web-ext run --source-dir firefox --overwrite-dest --ignore-files \"*.zip\" --artifacts-dir firefox/web-ext-artifacts", "sign:firefox": "web-ext sign --source-dir firefox --overwrite-dest --ignore-files \"*.zip\" --artifacts-dir firefox/web-ext-artifacts", -- 2.51.2 From 64b96526597c85e4e5275d7ab417da39aa14f068 Mon Sep 17 00:00:00 2001 From: Rooki <34943569+Pdzly@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:30:35 +0200 Subject: [PATCH 2/3] Create validate_addon.js --- validate_addon.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 validate_addon.js diff --git a/validate_addon.js b/validate_addon.js new file mode 100644 index 0000000..27d0469 --- /dev/null +++ b/validate_addon.js @@ -0,0 +1,29 @@ +import webExt from "web-ext"; + +async function validate() { + console.log("Validating the firefox extension."); + const result = await webExt.cmd.lint({ + sourceDir: "firefox", + output: "json", + }, { + shouldExitProgram: false, + }); + const { count } = result; + + if (count > 0) { + console.error( + "Errors found in the extension. Please fix them before proceeding." + ); + console.error("==============================================="); + console.error(JSON.stringify(result, null, 2)); + console.error("==============================================="); + console.error("Exiting the process..."); + process.exit(1); + } + console.log("No errors found in the firefox extension. Proceeding..."); + + console.log("No validation available for the chrome extension."); + process.exit(0); +} + +validate(); -- 2.51.2 From 19498613a899f9c2c3c479c0adeb43e9b0662ee3 Mon Sep 17 00:00:00 2001 From: Rooki <34943569+Pdzly@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:43:28 +0200 Subject: [PATCH 3/3] Create webext.yml --- .github/workflows/webext.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/webext.yml diff --git a/.github/workflows/webext.yml b/.github/workflows/webext.yml new file mode 100644 index 0000000..9bb0cf5 --- /dev/null +++ b/.github/workflows/webext.yml @@ -0,0 +1,24 @@ +name: Web Extension CI/CD Pipeline + +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: "14" + - name: Install dependencies + run: npm install + - name: Test + run: npm run test