mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-10-14 16:10:10 +00:00
🚸 Updating and optimizing
This commit is contained in:
parent
66fd16659f
commit
741de12320
8 changed files with 24 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as fs from "fs";
|
||||
// @ts-ignore
|
||||
const fs = require("fs");
|
||||
|
||||
function removeExport(file: string) {
|
||||
let content = fs.readFileSync(file, "utf8");
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
const appConfig = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||
const path = require('path');
|
||||
// @ts-ignore
|
||||
const fs = require('fs');
|
||||
|
||||
const appConfigJson = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||
const DEPLOY_ENTRY = "./public/";
|
||||
const DEPLOY_TARGET = "./dist/";
|
||||
|
||||
|
@ -37,7 +39,7 @@ function findHtmlFilesRecursive(source: string): string[] {
|
|||
|
||||
function replaceKeywordsInHtmlFile(file: string) {
|
||||
let content = fs.readFileSync(file, 'utf8');
|
||||
const pairs = appConfig.htmlTemplatePairs;
|
||||
const pairs = appConfigJson.htmlTemplatePairs;
|
||||
pairs.forEach(function (pair: object) {
|
||||
// @ts-ignore
|
||||
content = content.replaceAll(pair.key, pair.value);
|
||||
|
@ -81,4 +83,4 @@ mkdirSync(DEPLOY_TARGET);
|
|||
copyFiles(DEPLOY_ENTRY, DEPLOY_TARGET);
|
||||
buildHtmlFiles(DEPLOY_ENTRY);
|
||||
|
||||
console.log("Deployed to " + DEPLOY_TARGET);
|
||||
console.log("Deployed to " + DEPLOY_TARGET);
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import * as fs from 'fs';
|
||||
// @ts-ignore
|
||||
const fs = require('fs');
|
||||
|
||||
const appConfig = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||
const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||
const manifest = JSON.parse(fs.readFileSync('./public/manifest.json', 'utf8'));
|
||||
const manifestJson = JSON.parse(fs.readFileSync('./public/manifest.json', 'utf8'));
|
||||
|
||||
pkg.version = appConfig.AppData.version;
|
||||
pkg.name = appConfig.AppData.id;
|
||||
|
@ -13,10 +14,10 @@ pkg.license = appConfig.AppData.license;
|
|||
pkg.repository = appConfig.AppData.repository;
|
||||
pkg.bugs = appConfig.AppData.bugs;
|
||||
|
||||
manifest.version = appConfig.AppData.version;
|
||||
manifest.name = appConfig.AppData.name;
|
||||
manifest.description = appConfig.AppData.description;
|
||||
manifest.homepage_url = appConfig.AppData.homepage;
|
||||
manifestJson.version = appConfig.AppData.version;
|
||||
manifestJson.name = appConfig.AppData.name;
|
||||
manifestJson.description = appConfig.AppData.description;
|
||||
manifestJson.homepage_url = appConfig.AppData.homepage;
|
||||
|
||||
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
|
||||
fs.writeFileSync('./public/manifest.json', JSON.stringify(manifest, null, 2));
|
||||
fs.writeFileSync('./public/manifest.json', JSON.stringify(manifestJson, null, 2));
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import * as fs from 'fs';
|
||||
// @ts-ignore
|
||||
const fs = require('fs');
|
||||
|
||||
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
|
||||
|
||||
|
@ -42,4 +43,4 @@ if (manifest.action) {
|
|||
}
|
||||
delete manifest.action
|
||||
|
||||
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));
|
||||
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue