mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-06-21 18:11:08 +00:00
commit
95121af7c3
8 changed files with 24 additions and 19 deletions
|
@ -2,11 +2,10 @@
|
||||||
"name": "browser_extension_template",
|
"name": "browser_extension_template",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deploy-v3": "npm run build-tooling && node ./tools/deploy.js && npm run sync && npm run build-js && npm run build-css && node ./tools/clean.js",
|
"deploy-v3": "npx rimraf ./dist/ && npm run build-tooling && node ./tools/deploy.js && npm run sync && npm run build-js && npm run build-css && node ./tools/clean.js",
|
||||||
"deploy-v2": "npm run deploy-v3 && node ./tools/v2.js",
|
"deploy-v2": " npm run deploy-v3 && node ./tools/v2.js",
|
||||||
"build-js": "webpack --config ./webpack.config.cjs && webpack --config ./webpack.config.settings.cjs && webpack --config ./webpack.config.background.cjs",
|
"build-js": "webpack --config ./webpack.config.ts && webpack --config ./webpack.config.settings.ts && webpack --config ./webpack.config.background.ts",
|
||||||
"build-css": "sass ./src/sass/:./dist/css/",
|
"build-css": "sass ./src/sass/:./dist/css/",
|
||||||
"build-tooling": "tsc --project ./tooling.tsconfig.json",
|
"build-tooling": "tsc --project ./tooling.tsconfig.json",
|
||||||
"watch-ts": "tsc -w -p tsconfig.json",
|
"watch-ts": "tsc -w -p tsconfig.json",
|
||||||
|
@ -19,6 +18,7 @@
|
||||||
"@webcomponents/webcomponentsjs": "^2.7.0",
|
"@webcomponents/webcomponentsjs": "^2.7.0",
|
||||||
"sass": "^1.39.0",
|
"sass": "^1.39.0",
|
||||||
"ts-loader": "^9.4.2",
|
"ts-loader": "^9.4.2",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.2.4",
|
"typescript": "^4.2.4",
|
||||||
"webpack": "^5.75.0",
|
"webpack": "^5.75.0",
|
||||||
"webpack-cli": "^5.0.1"
|
"webpack-cli": "^5.0.1"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import * as fs from "fs";
|
// @ts-ignore
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
function removeExport(file: string) {
|
function removeExport(file: string) {
|
||||||
let content = fs.readFileSync(file, "utf8");
|
let content = fs.readFileSync(file, "utf8");
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import * as fs from 'fs';
|
const path = require('path');
|
||||||
import * as path from 'path';
|
// @ts-ignore
|
||||||
const appConfig = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
const fs = require('fs');
|
||||||
|
|
||||||
|
const appConfigJson = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||||
const DEPLOY_ENTRY = "./public/";
|
const DEPLOY_ENTRY = "./public/";
|
||||||
const DEPLOY_TARGET = "./dist/";
|
const DEPLOY_TARGET = "./dist/";
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ function findHtmlFilesRecursive(source: string): string[] {
|
||||||
|
|
||||||
function replaceKeywordsInHtmlFile(file: string) {
|
function replaceKeywordsInHtmlFile(file: string) {
|
||||||
let content = fs.readFileSync(file, 'utf8');
|
let content = fs.readFileSync(file, 'utf8');
|
||||||
const pairs = appConfig.htmlTemplatePairs;
|
const pairs = appConfigJson.htmlTemplatePairs;
|
||||||
pairs.forEach(function (pair: object) {
|
pairs.forEach(function (pair: object) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
content = content.replaceAll(pair.key, pair.value);
|
content = content.replaceAll(pair.key, pair.value);
|
||||||
|
|
|
@ -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 appConfig = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||||
const pkg = JSON.parse(fs.readFileSync('./package.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.version = appConfig.AppData.version;
|
||||||
pkg.name = appConfig.AppData.id;
|
pkg.name = appConfig.AppData.id;
|
||||||
|
@ -13,10 +14,10 @@ pkg.license = appConfig.AppData.license;
|
||||||
pkg.repository = appConfig.AppData.repository;
|
pkg.repository = appConfig.AppData.repository;
|
||||||
pkg.bugs = appConfig.AppData.bugs;
|
pkg.bugs = appConfig.AppData.bugs;
|
||||||
|
|
||||||
manifest.version = appConfig.AppData.version;
|
manifestJson.version = appConfig.AppData.version;
|
||||||
manifest.name = appConfig.AppData.name;
|
manifestJson.name = appConfig.AppData.name;
|
||||||
manifest.description = appConfig.AppData.description;
|
manifestJson.description = appConfig.AppData.description;
|
||||||
manifest.homepage_url = appConfig.AppData.homepage;
|
manifestJson.homepage_url = appConfig.AppData.homepage;
|
||||||
|
|
||||||
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2));
|
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'));
|
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue