Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 17 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
fi

build-and-test:
name: Test and Build ${{ needs.compute-matrix.outputs.name_suffix }}
name: Test and Build (${{ matrix.os }}, Node ${{ matrix.node }}) ${{ needs.compute-matrix.outputs.name_suffix }}
needs: compute-matrix
runs-on: ${{ matrix.os }}
permissions:
Expand All @@ -54,14 +54,30 @@ jobs:
node-version: ${{ matrix.node }}
cache: npm

- name: Set up Chrome
if: matrix.os == 'ubuntu-latest'
id: chrome
uses: browser-actions/setup-chrome@v2
with:
chrome-version: stable

- name: Install dependencies
run: npm ci

- name: Typecheck
run: npm run typecheck

- name: Test
if: matrix.os == 'ubuntu-latest'
run: npm run test:ci
env:
ADNBN_CHROME_BIN: ${{ steps.chrome.outputs.chrome-path }}

# The CDP extension-loading scenario is verified on Chrome's Linux runner.
# The rest of the test suite remains part of the full OS x Node matrix.
- name: Test (non-browser)
if: matrix.os != 'ubuntu-latest'
run: npm run test:ci:non-browser

- name: Build
run: npm run build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ TODOs.md
stats.html
.tool-versions
.cache
/tests/integration/browser/offscreen-service/.adnbn/
*-stats.txt
.npmrc
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Releases and versioning:
3. Make changes and ensure commits follow Conventional Commits.
4. Before opening a PR, run local checks:
- Formatting: `npm run format`
- Tests: `npm test`
- Tests: `npm test` (the full suite includes a Chrome MV3 integration test; use `ADNBN_CHROME_BIN=/path/to/chrome` to override automatic Chrome discovery)
- By area (if needed):
- `npm run test:relay`
- `npm run test:service`
Expand Down
74 changes: 27 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,40 @@
# adnbn
# Addon Bone

[![npm version](https://img.shields.io/npm/v/adnbn.svg)](https://www.npmjs.com/package/adnbn)
[![npm downloads](https://img.shields.io/npm/dm/adnbn.svg)](https://www.npmjs.com/package/adnbn)
> **🚧 Active development** — the public API and documentation may change between releases. Full guides and API reference are being prepared at [addonbone.com](https://addonbone.com).

## Addon Bone - Cross-Browser Web Extension Framework with shared code base
[![npm version](https://img.shields.io/npm/v/adnbn.svg?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/adnbn)
[![npm downloads](https://img.shields.io/npm/dm/adnbn.svg?style=for-the-badge&color=blue)](https://www.npmjs.com/package/adnbn)
[![CI](https://img.shields.io/github/actions/workflow/status/addon-stack/addon-bone/ci.yml?style=for-the-badge)](https://github.com/addon-stack/addon-bone/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge)](LICENSE.md)

**Cross-browser framework** for developing extensions on a single code base. Enables creating multiple production-grade extensions with different localizations, icons, and designs while maintaining identical core functionality.
A TypeScript framework for building browser extensions from a shared codebase.
Define extension entrypoints in source files; Addon Bone discovers them and creates
the browser-specific build and manifest.

### Core Concept
## Install

- **Single code base**: maintain one set of source files for all extensions.
- **Flexibility**: supports both multi-package setups (multiple extensions in one repository) and standalone projects.
- **Modern workflow**: automatic merging of styles, scripts, content scripts, and background scripts.
```bash
npm i -D adnbn
```

### Supported Platforms & Manifests
## Get started

- **Browsers**: Chrome, Firefox, Opera, Safari, Edge.
- **Manifest Versions**: Manifest V2 and V3.
Create a project, then build it for production:

### Entry Points
```bash
npx adnbn init
npx adnbn build
```

- **Background Page**
- **Content Scripts**
- **Commands**
- **Localization**
- **Icons**
- **Messages**
- **Services**
- **Relay**
- **Offscreen**
- **Popup**
- **Sidebar**
For project structure, entrypoint guides, and the API reference, visit
[addonbone.com](https://addonbone.com).

### Plugins
## Links

- **Extensibility via Plugins**: write modules for background pages, content scripts, and any supported entry points.
- **Automatic Integration**: plugins are automatically included in the build process and update the manifest.
- [Documentation](https://addonbone.com)
- [Contributing](CONTRIBUTING.md)
- [Issues](https://github.com/addon-stack/addon-bone/issues)

### Services & Relay
## License

- **Services**: class-based layer for background interactions without boilerplate. Service methods are available across all extension layers via simple calls.
- **Relay**: similar mechanism for content pages, bypassing CSP and getUserGesture restrictions by leveraging scripting contexts.

### Offscreen

- **Manifest V2**: offscreen support via `<iframe>` within the Background Page.
- **Manifest V3**: native Offscreen API.

### Benefits

- 🔌 **Plugin Architecture**: easily extend functionality and add features without modifying the core framework.
- 🔧 **Faster Development**: minimal configuration and boilerplate.
- 🌐 **Cross-Platform**: write code once; run everywhere regardless of browser or manifest version.
- 🔄 **Scalable**: seamlessly add new layers and entry points.
- 🚀 **Modern Design**: cutting-edge architecture following best practices for extension publishing.

---

> _This framework is under active development. Detailed documentation and usage examples will be available soon on the official website._
[MIT](LICENSE.md)
96 changes: 88 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@
"format": "prettier --write .",
"typecheck": "tsc -p tsconfig.json --noEmit",
"check:node-version": "node ./scripts/check-node-version.js",
"test": "jest",
"test:ci": "jest --ci --passWithNoTests --coverage",
"test:watch": "jest --watch",
"test": "npm run build && jest",
"test:ci": "npm run test -- --ci --passWithNoTests --coverage",
"test:ci:non-browser": "npm run test -- --ci --passWithNoTests --coverage --testPathIgnorePatterns=tests/integration/browser",
"test:watch": "jest --watch --testPathIgnorePatterns=tests/integration/browser",
"test:offscreen": "jest --testPathPatterns=Offscreen",
"test:chrome": "npm run test -- --testPathPatterns=tests/integration/browser --runInBand",
"test:message": "jest --testPathPatterns=src/message",
"test:service": "jest --testPathPatterns=Service",
"test:relay": "jest --testPathPatterns=Relay",
Expand All @@ -124,9 +126,9 @@
"release:preview": "release-it --no-github.release --no-npm.publish --no-git.tag --ci"
},
"dependencies": {
"@addon-core/browser": "^0.6.0",
"@addon-core/browser": "^0.7.1",
"@addon-core/inject-script": "^0.3.1",
"@addon-core/storage": "^0.6.0",
"@addon-core/storage": "^0.7.0",
"@rsdoctor/rspack-plugin": "^1.5.1",
"@rspack/cli": "^1.7.5",
"@rspack/core": "^1.7.5",
Expand Down Expand Up @@ -177,6 +179,7 @@
"@types/react": "^19.1.10",
"@types/react-dom": "^19.1.7",
"@types/semver": "^7.7.1",
"chrome-launcher": "^1.2.1",
"cross-env": "^7.0.3",
"dotenv": "^16.4.7",
"esbuild": "^0.25.10",
Expand Down
Loading
Loading