Load extension name from manifest file

This commit is contained in:
Martin Kleinschrodt 2021-10-13 16:22:15 +02:00
parent 835b9d2d65
commit 0593fc4f1c
3 changed files with 22 additions and 8 deletions

5
assets/manifest.json Normal file
View File

@ -0,0 +1,5 @@
{
"name": "Padloc",
"background_color": "#ffffff",
"description": "A modern password manager for indviduals and teams"
}

View File

@ -1,21 +1,25 @@
{
"name": "Padloc",
"version": "1.0.0",
"description": "Padloc Browser Extension",
"manifest_version": 2,
"icons": {
"128": "icon.png"
},
"background": {
"scripts": ["background.js"],
"scripts": [
"background.js"
],
"persistent": true
},
"browser_action": {
"default_popup": "popup.html",
"default_icon": "icon.png"
},
"web_accessible_resources": ["icon.png", "Nunito-Regular.ttf", "Nunito-SemiBold.ttf", "fontawesome-webfont.ttf"],
"permissions": ["storage", "unlimitedStorage", "tabs", "activeTab", "contextMenus"],
"permissions": [
"storage",
"unlimitedStorage",
"tabs",
"activeTab",
"contextMenus"
],
"commands": {
"_execute_browser_action": {
"suggested_key": {
@ -38,4 +42,4 @@
"description": "Open Previous Vault Item"
}
}
}
}

View File

@ -9,6 +9,8 @@ const sharp = require("sharp");
const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_SERVER_PORT || 3000}`;
const assetsDir = process.env.PL_ASSETS_DIR || "../../assets";
const { name } = require(path.join(assetsDir, "manifest.json"));
module.exports = {
entry: {
popup: path.resolve(__dirname, "src/popup.ts"),
@ -51,6 +53,7 @@ module.exports = {
},
plugins: [
new EnvironmentPlugin({
PL_APP_NAME: name,
PL_SERVER_URL: serverUrl,
PL_BILLING_ENABLED: null,
PL_BILLING_DISABLE_PAYMENT: null,
@ -61,7 +64,7 @@ module.exports = {
}),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: "Padloc",
title: name,
template: path.resolve(__dirname, "src/popup.html"),
chunks: ["popup"],
filename: "popup.html",
@ -79,6 +82,8 @@ module.exports = {
{
...manifest,
version,
name,
description: `${name} Browser Extension`,
},
null,
4