npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wext-manifest

v2.2.0

Published

Webextension Manifest Generator

Downloads

84

Readme

wext-manifest npm version

Webextension Manifest Generator

Generate browser tailored manifest.json for Web Extensions

Browser Support

| Chrome | Firefox | Opera | Edge | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ✔ | ✔ | ✔ | ✔ |

This module will take a definition input for the manifest, and return you filename and content for the specified browser.

Looking for Web Extension starter?

Checkout web-extension-starter that uses this package

Installation

npm install --save wext-manifest

Usage

const wextManifest = require("wext-manifest");

const input = {
	manifest_version: 2,
	name: "Sample WebExtension",
	version: "0.0.1",

	icons: {
		"16": "assets/icons/favicon-16.png",
		"32": "assets/icons/favicon-32.png",
		"48": "assets/icons/favicon-48.png",
		"128": "assets/icons/favicon-128.png"
	},

	description: "Sample description",
	homepage_url: "https://github.com/abhijithvijayan/web-extension-starter",
	short_name: "Sample Name",

	permissions: ["tabs", "storage", "http://*/*", "https://*/*"],
	content_security_policy: "script-src 'self' 'unsafe-eval'; object-src 'self'",

	"__chrome|firefox__author": "abhijithvijayan",
	__opera__developer: {
		name: "abhijithvijayan"
	},

	__firefox__applications: {
		gecko: { id: "{754FB1AD-CC3B-4856-B6A0-7786F8CA9D17}" }
	},

	__chrome__minimum_chrome_version: "49",
	__opera__minimum_opera_version: "36",

	browser_action: {
		default_popup: "popup.html",
		default_icon: {
			"16": "assets/icons/favicon-16.png",
			"32": "assets/icons/favicon-32.png",
			"48": "assets/icons/favicon-48.png",
			"128": "assets/icons/favicon-128.png"
		},
		default_title: "tiny title",
		"__chrome|opera__chrome_style": false,
		__firefox__browser_style: false
	},

	"__chrome|opera__options_page": "options.html",

	options_ui: {
		page: "options.html",
		open_in_tab: true,
		__chrome__chrome_style: false
	}
};

console.log(wextManifest.firefox(input));
// => { name: 'manifest.json', content: '{"manifest_version":2...' }

What are vendor prefixed manifest keys?

Vendor prefixed manifest keys allow you to write one manifest.json for multiple vendors.

{
  "__chrome__name": "AwesomeChrome",
  "__firefox__name": "AwesomeFox",
  "__edge__name": "AwesomeEdge",
  "__opera__name": "AwesomeOpera"
}

if the vendor is chrome this compiles to:

{
  "name": "AwesomeChrome",
}

Add keys to multiple vendors by seperating them with | in the prefix

{
  __chrome|opera__name: "AwesomeExtension"
}

if the vendor is chrome or opera, this compiles to:

{
  "name": "AwesomeExtension"
}

With Webpack

You can easily use this module together with the write-webpack-plugin to output the manifest file as part of your build process.

The following example will create extension/firefox/manifest.json when TARGET_BROWSER=firefox.

const path = require("path");
const wextManifest = require("wext-manifest");
const WriteWebpackPlugin = require("write-webpack-plugin");

const targetBrowser = process.env.TARGET_BROWSER;

const manifest = wextManifest[targetBrowser]({
	// Manifest input
});

module.exports = {
	// ...

	output: {
		path: path.join(__dirname, "extension", targetBrowser),
		filename: "[name].js"
	},

	plugins: [
		// ...

		new WriteWebpackPlugin([
			{ name: manifest.name, data: Buffer.from(manifest.content) }
		])
	]
};

Show your support

Give a ⭐️ if this project helped you!

License

MIT © Abhijith Vijayan