Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"env": {
"browser": true,
"es2022": true,
"node": true,
"webextensions": true
},
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"rules": {
"no-console": ["warn", { "allow": ["warn", "error"] }],
"no-debugger": "error",
"no-eval": "error",
"no-implied-eval": "error",
"no-new-func": "error",
"prefer-const": "error",
"no-var": "error",
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
},
"ignorePatterns": [
"dist/**",
"build/**",
"node_modules/**",
"coverage/**"
]
}
185 changes: 185 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, feature/* ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Run tests
run: npm run test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

build:
runs-on: ubuntu-latest
needs: test

steps:
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build extension
run: npm run build:extension

- name: Build web demo
run: npm run build:web

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-files
path: |
dist/
web/
manifest.json

e2e-test:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Install Playwright browsers
run: npx playwright install

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-files

- name: Run E2E tests
run: npm run test:e2e

deploy:
runs-on: ubuntu-latest
needs: [test, build, e2e-test]
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4

- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
vercel-args: '--prod'
working-directory: ./

release:
runs-on: ubuntu-latest
needs: [test, build, e2e-test]
if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'release:')

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build extension
run: npm run build:extension

- name: Create extension package
run: |
mkdir -p release
cp -r dist/* release/
cp manifest.json release/
cp -r assets release/ || true
cd release
zip -r ../genai-browser-tool-extension.zip *

- name: Extract version from commit message
id: version
run: echo "version=$(echo '${{ github.event.head_commit.message }}' | grep -oP 'release: v\K[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: GenAI Browser Tool v${{ steps.version.outputs.version }}
body: |
## What's New

- Modern architecture with improved performance
- Enhanced AI provider support
- Better error handling and validation
- Improved user interface

## Installation

1. Download the extension zip file
2. Extract to a folder
3. Open Chrome extensions (chrome://extensions)
4. Enable Developer Mode
5. Click "Load unpacked" and select the extracted folder
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./genai-browser-tool-extension.zip
asset_name: genai-browser-tool-extension.zip
asset_content_type: application/zip
16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf",
"quoteProps": "as-needed",
"jsxSingleQuote": true,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css"
}
Loading