BrowserExtensionTemplate/tools/v2.ts
JonasPfalzgraf 482151f980 feat: Implement ErrorBoundary class for global error handling
feat: Refactor Session class to use LocalStorageService for session management

feat: Enhance BasicButton component with configuration options and event handling

style: Update SASS variables to CSS custom properties for better theming support

style: Modify app.sass to include Bootstrap with legacy import

chore: Update settings.ts to handle session initialization and error notifications

fix: Improve buttonType definition for better readability

chore: Refactor parse.ts for cleaner file handling and keyword replacement

chore: Enhance syncConfig.ts with TypeScript interfaces and async file operations

chore: Update v2.ts to modify manifest.json for compatibility with manifest version 2

chore: Revise tsconfig.json for stricter type checking and improved module resolution

chore: Refactor vite.config.ts for better build configuration and asset management
2025-07-11 16:53:48 +02:00

46 lines
1.3 KiB
TypeScript

// @ts-ignore
const fs = require('fs');
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
manifest.manifest_version = 2;
manifest.background.scripts = [];
manifest.background.scripts.push(manifest.background.service_worker);
delete manifest.background.type;
delete manifest.background.service_worker;
manifest.background.persistent = true;
if (manifest.host_permissions) {
manifest.permissions.push(manifest.host_permissions);
}
if (manifest.optional_host_permissions) {
manifest.permissions.push(manifest.optional_host_permissions);
}
delete manifest.host_permissions;
delete manifest.optional_host_permissions;
let newContentSecurityPolicy = '';
try {
for (const policy of manifest.content_security_policy) {
newContentSecurityPolicy += policy.key + "'" + policy.value + "'" + ' ';
}
} catch (e) {
newContentSecurityPolicy = "default-src 'self'";
}
manifest.content_security_policy = newContentSecurityPolicy;
try {
manifest.web_accessible_resources = manifest.web_accessible_resources.resources;
} catch (e) {
manifest.web_accessible_resources = [];
}
if (manifest.action) {
manifest.browser_action = manifest.action;
}
delete manifest.action;
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));