From 08165927e687d7cc0f31a422bf4989d1de57db87 Mon Sep 17 00:00:00 2001 From: Ads Dawson <104169244+GangGreenTemperTatum@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:46:33 -0500 Subject: [PATCH] chore: init basic ci workflow file (#11) * chore: init basic ci workflow file * chore: test workflow on this pr * fix: simplify on trigger * fix: missing workflow dir * fix: node lts dependency bug * fix: logger import and debug * chore: additional debug * fix: lowercase logger * chore: rm tests for now * fix: eslint error * fix: manifest ts files * chore: rm linting for now * fix: manifest double digits * fix: update active manifest perms * chore: rm test branch --- .github/workflows/build.yml | 85 +++++++++++++++++++++++++++++++++++++ manifest.json | 6 +-- src/popup/Popup.svelte | 2 +- src/popup/popup.ts | 2 +- 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1016c0b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,85 @@ +name: PR Build Check + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 + + - name: Use Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af #v4.1.0 + with: + node-version: "20.11.1" + cache: "npm" + + - name: Debug files + run: | + echo "Current directory structure:" + tree src/ + echo "Content of logger.ts:" + cat src/lib/logger.ts + echo "Content of popup.ts:" + cat src/popup/popup.ts + + - name: Verify imports + run: | + if [ ! -f "src/lib/logger.ts" ]; then + echo "Error: logger.ts not found" + exit 1 + fi + + - name: Clean install + run: | + rm -rf node_modules + rm -f package-lock.json + npm install + + - name: Install platform specific dependencies + run: | + npm install @rollup/rollup-linux-x64-gnu + + - name: Build project + run: npm run build + + - name: Show build artifacts + if: failure() + run: | + ls -la dist/ + cat dist/popup.js || true + + - name: Check manifest version + run: | + VERSION=$(node -p "require('./manifest.json').version") + if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Manifest version is valid: $VERSION" + else + echo "Invalid manifest version: $VERSION" + exit 1 + fi + + - name: Validate manifest permissions + run: | + PERMISSIONS=$(node -p "JSON.stringify(require('./manifest.json').permissions)") + EXPECTED_PERMISSIONS='["activeTab","scripting","storage","downloads"]' + if [ "$PERMISSIONS" = "$EXPECTED_PERMISSIONS" ]; then + echo "Manifest permissions are valid" + else + echo "Unexpected manifest permissions: $PERMISSIONS" + exit 1 + fi + + - name: Check Vite config + run: | + if grep -q "svelte({" vite.config.ts && grep -q "build: {" vite.config.ts; then + echo "Vite config seems to be properly set up" + else + echo "Vite config might be missing important configurations" + exit 1 + fi diff --git a/manifest.json b/manifest.json index b982094..93c8022 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "DOMspy", - "version": "1.0", + "version": "1.0.0", "description": "Web security tool to help developers and security professionals understand the DOM and how it can be manipulated.", "icons": { "48": "images/DOMspy48.png", @@ -22,11 +22,11 @@ ], "content_scripts": [{ "matches": ["http://*/*", "https://*/*"], - "js": ["content.js"], + "js": ["content.ts"], "run_at": "document_idle" }], "web_accessible_resources": [{ - "resources": ["content.js"], + "resources": ["content.ts"], "matches": ["http://*/*", "https://*/*"] }], "background": { diff --git a/src/popup/Popup.svelte b/src/popup/Popup.svelte index e809ee6..6993f3c 100644 --- a/src/popup/Popup.svelte +++ b/src/popup/Popup.svelte @@ -1,6 +1,6 @@