Add native package manifest
This commit is contained in:
parent
62f1fc1236
commit
733ab6f964
5 changed files with 48 additions and 4 deletions
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -5,9 +5,22 @@
|
|||
"packages": {
|
||||
"": {
|
||||
"devDependencies": {
|
||||
"json5": "^2.2.3",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/json5": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
|
||||
"integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"json5": "lib/cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"json5": "^2.2.3",
|
||||
"typescript": "^5.0.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
{
|
||||
"name": "Parasite",
|
||||
|
||||
"background": {
|
||||
"scripts": ["background.bundle.js"]
|
||||
"scripts": ["background.bundle.js"],
|
||||
},
|
||||
|
||||
"browser_action": {
|
||||
"default_popup": "popup.html",
|
||||
"default_icon": "icon-34.png"
|
||||
},
|
||||
|
||||
"icons": {},
|
||||
"manifest_version": 2,
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
|
||||
"permissions": ["nativeMessaging", "tabs"]
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "ping_pong@example.org",
|
||||
}
|
||||
},
|
||||
|
||||
"permissions": ["nativeMessaging", "tabs"],
|
||||
}
|
20
parasite/src/native-manifest.json5
Normal file
20
parasite/src/native-manifest.json5
Normal file
|
@ -0,0 +1,20 @@
|
|||
// This is a file that describes how browsers should call the native messenger.
|
||||
//
|
||||
// On firefox, we just need to put this file in
|
||||
// ~/.mozilla/native-messaging-hosts/[name].json
|
||||
// See this[1] page for more details.
|
||||
//
|
||||
// On chrome, we need to put it in
|
||||
// ~/.config/google-chrome/NativeMessagingHosts/[name].json
|
||||
// See this[2] page for more details.
|
||||
//
|
||||
// [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_manifests#linux
|
||||
// [2]: https://developer.chrome.com/docs/apps/nativeMessaging/#native-messaging-host-location
|
||||
|
||||
{
|
||||
"name": "io.mzhang.navigation_tools.parasite_messenger",
|
||||
"description": "Example host for native messaging",
|
||||
"path": "/path/to/native-messaging/app/ping_pong.py",
|
||||
"type": "stdio",
|
||||
"allowed_extensions": ["ping_pong@example.org"],
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
import path from "path";
|
||||
import webpack from "webpack";
|
||||
import json5 from "json5";
|
||||
|
||||
import CopyWebpackPlugin from "copy-webpack-plugin";
|
||||
|
||||
|
@ -46,9 +47,9 @@ const options: webpack.Configuration = {
|
|||
// Copy the manifest, adding in the version and the description from the
|
||||
// package.json file.
|
||||
{
|
||||
from: "src/manifest.json",
|
||||
from: "src/manifest.json5",
|
||||
transform: (content, _) => {
|
||||
const oldContent = JSON.parse(content.toString());
|
||||
const oldContent = json5.parse(content.toString());
|
||||
const newContent = {
|
||||
description: process.env.npm_package_description,
|
||||
version: process.env.npm_package_version,
|
||||
|
|
Loading…
Reference in a new issue