Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonalling/webextension-manifest
Type declarations for WebExtension manifest.json
https://github.com/simonalling/webextension-manifest
Last synced: 3 months ago
JSON representation
Type declarations for WebExtension manifest.json
- Host: GitHub
- URL: https://github.com/simonalling/webextension-manifest
- Owner: SimonAlling
- License: mit
- Created: 2020-01-26T11:59:40.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T13:08:40.000Z (over 1 year ago)
- Last Synced: 2024-10-04T22:45:56.348Z (4 months ago)
- Language: TypeScript
- Size: 473 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webextension-manifest
TypeScript type declarations for [`manifest.json`](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json), part of the [WebExtension API](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions).
## Installation
```
npm install --save-dev webextension-manifest
```## Usage
The type of `manifest.json` is default-exported and can be used like this:
```ts
// docs/examples/default-export.tsimport Manifest from "webextension-manifest";
const manifest: Manifest = {
manifest_version: 2,
name: "Awesome Extension",
version: "1.0.0",
};```
The type of each individual manifest key is also exported:
```ts
// docs/examples/individual-keys.tsimport Manifest, * as M from "webextension-manifest";
const content_scripts: M.ContentScripts = [
{
js: [ "do-cool-stuff.js" ],
matches: [ "*://*.example.com/*" ],
},
];const manifest: Manifest = {
content_scripts,
manifest_version: 2,
name: "Awesome Extension",
version: "1.0.0",
};```
## Contribute
Clone, build and test:
```
git clone https://github.com/SimonAlling/webextension-manifest
cd webextension-manifest
npm install
npm run build
npm test
```### Code examples
We use [`embedme`](https://www.npmjs.com/package/embedme) for DRY, typechecked code examples in the readme.
Here's how to add one:1. Create a file containing the example in `docs/examples`, e.g. `embedme-example.ts`.
1. Add a code block referencing your new file in `README.md`:
```ts
// docs/examples/embedme-example.ts
```
1. The example code will be automatically inserted (or updated) on `npm run build`.