mirror of
https://github.com/JosunLP/BrowserExtensionTemplate.git
synced 2025-06-22 02:21:08 +00:00
Compare commits
No commits in common. "main" and "1.0.0" have entirely different histories.
27 changed files with 803 additions and 697 deletions
|
@ -1,35 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
||||||
[*.{js,ts,svg,md}]
|
|
||||||
charset = utf-8
|
|
||||||
|
|
||||||
[*.{ts,js}]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
|
|
||||||
[package.json]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.{sass,scss}]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.{css,less}]
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
|
|
||||||
[*.{json,yml,yaml}]
|
|
||||||
indent_style = space
|
|
94
.github/workflows/codeql-analysis.yml
vendored
94
.github/workflows/codeql-analysis.yml
vendored
|
@ -12,60 +12,60 @@
|
||||||
name: "CodeQL"
|
name: "CodeQL"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["main"]
|
branches: [ master ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: ["main"]
|
branches: [ master ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "37 13 * * 4"
|
- cron: '28 16 * * 0'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
name: Analyze
|
name: Analyze
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
actions: read
|
||||||
contents: read
|
contents: read
|
||||||
security-events: write
|
security-events: write
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: ["javascript"]
|
language: [ 'javascript' ]
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
# By default, queries listed here will override any specified in a config file.
|
# By default, queries listed here will override any specified in a config file.
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# queries: security-extended,security-and-quality
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# 📚 https://git.io/JvXDl
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
#- run: |
|
||||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
# - run: |
|
- name: Perform CodeQL Analysis
|
||||||
# echo "Run, Build Application using script"
|
uses: github/codeql-action/analyze@v1
|
||||||
# ./location_of_script_within_repo/buildscript.sh
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
|
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -688,7 +688,5 @@ FodyWeavers.xsd
|
||||||
dist
|
dist
|
||||||
|
|
||||||
tools/syncConfig.js
|
tools/syncConfig.js
|
||||||
tools/parse.js
|
tools/deploy.js
|
||||||
tools/v2.js
|
tools/v2.js
|
||||||
tools/clean.js
|
|
||||||
package-lock.json
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2024 Jonas Pfalzgraf
|
Copyright (c) 2022 Jonas Pfalzgraf
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
18
README.md
18
README.md
|
@ -4,11 +4,7 @@
|
||||||
[](https://github.com/JosunLP/BrowserExtensionTemplate/network)
|
[](https://github.com/JosunLP/BrowserExtensionTemplate/network)
|
||||||
[](https://github.com/JosunLP/BrowserExtensionTemplate/stargazers)
|
[](https://github.com/JosunLP/BrowserExtensionTemplate/stargazers)
|
||||||
[](https://github.com/JosunLP/BrowserExtensionTemplate)
|
[](https://github.com/JosunLP/BrowserExtensionTemplate)
|
||||||
[](https://twitter.com/intent/tweet?text=Look+what+i+found+on+GitHub+%23Developer%2C+%23SoftwareDeveloper%3A&url=https%3A%2F%2Fgithub.com%2FJosunLP%2FBrowserExtensionTemplate)
|
[](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2FJosunLP%2FBrowserExtensionTemplate)
|
||||||
[](https://www.codefactor.io/repository/github/josunlp/browserextensiontemplate)
|
|
||||||
[](https://snyk.io/test/github/JosunLP/BrowserExtensionTemplate)
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
A basic template based on SASS and TypeScript to create browser extensions without directly relying on a larger framework.
|
A basic template based on SASS and TypeScript to create browser extensions without directly relying on a larger framework.
|
||||||
|
|
||||||
|
@ -24,15 +20,3 @@ Your sourcecode can be written in the `src` folder. The `public` folder contains
|
||||||
With the `npm run deploy-v3` command you can deploy the extension to the dist folder, ready to be published to the chrome web store.
|
With the `npm run deploy-v3` command you can deploy the extension to the dist folder, ready to be published to the chrome web store.
|
||||||
With the `npm run deploy-v2` command you can deploy the extension to the dist folder, ready to be published to the firefox web store.
|
With the `npm run deploy-v2` command you can deploy the extension to the dist folder, ready to be published to the firefox web store.
|
||||||
This is necessary because the firefox web store needs the `manifest.json` file to be present in the version v2.
|
This is necessary because the firefox web store needs the `manifest.json` file to be present in the version v2.
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This project is licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
This project is open source. Feel free to fork and contribute!
|
|
||||||
|
|
||||||
## Author
|
|
||||||
|
|
||||||
Jonas Pfalzgraf
|
|
||||||
|
|
|
@ -19,11 +19,5 @@
|
||||||
"email": "info@josunlp.de"
|
"email": "info@josunlp.de"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
"htmlTemplatePairs": [
|
|
||||||
{
|
|
||||||
"key": "{{BET}}",
|
|
||||||
"value": "Browser Extension Template"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
459
package-lock.json
generated
Normal file
459
package-lock.json
generated
Normal file
|
@ -0,0 +1,459 @@
|
||||||
|
{
|
||||||
|
"name": "browser_extension_template",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "browser_extension_template",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"friendly-helper": "^1.7.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^18.7.4",
|
||||||
|
"sass": "^1.39.0",
|
||||||
|
"typescript": "^4.2.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/aes-js": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/aes-js/-/aes-js-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-SDSGgXT3LRCH6qMWk8OHT1vLSVNuHNvCpKCx2/TYtQMbMGGgxJC9fspwSkQjqzRagrWnCrxuLL3jMNXLXHHvSw=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "18.7.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.4.tgz",
|
||||||
|
"integrity": "sha512-RzRcw8c0B8LzryWOR4Wj7YOTFXvdYKwvrb6xQQyuDfnlTxwYXGCV5RZ/TEbq5L5kn+w3rliHAUyRcG1RtbmTFg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/aes-js": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ=="
|
||||||
|
},
|
||||||
|
"node_modules/anymatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"picomatch": "^2.0.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/binary-extensions": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/braces": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"fill-range": "^7.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chokidar": {
|
||||||
|
"version": "3.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||||
|
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"anymatch": "~3.1.2",
|
||||||
|
"braces": "~3.0.2",
|
||||||
|
"glob-parent": "~5.1.2",
|
||||||
|
"is-binary-path": "~2.1.0",
|
||||||
|
"is-glob": "~4.0.1",
|
||||||
|
"normalize-path": "~3.0.0",
|
||||||
|
"readdirp": "~3.6.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8.10.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"fsevents": "~2.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fill-range": {
|
||||||
|
"version": "7.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||||
|
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"to-regex-range": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/friendly-helper": {
|
||||||
|
"version": "1.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/friendly-helper/-/friendly-helper-1.7.1.tgz",
|
||||||
|
"integrity": "sha512-6X9baO2FZ/EReoJBNOP55fOO21Bu0Lnkr6cM97OHXPBgn+V0LF3rS1Nmxeb/WcQGomSkAO3kBi73HDcrEpUCiA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/aes-js": "^3.1.1",
|
||||||
|
"aes-js": "^3.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"dev": true,
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/glob-parent": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-glob": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/immutable": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"node_modules/is-binary-path": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"binary-extensions": "^2.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-extglob": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-glob": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-extglob": "^2.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-number": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/normalize-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/picomatch": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/readdirp": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"picomatch": "^2.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sass": {
|
||||||
|
"version": "1.54.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
|
||||||
|
"integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"chokidar": ">=3.0.0 <4.0.0",
|
||||||
|
"immutable": "^4.0.0",
|
||||||
|
"source-map-js": ">=0.6.2 <2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"sass": "sass.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/source-map-js": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/to-regex-range": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-number": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "4.7.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
||||||
|
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@types/aes-js": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/aes-js/-/aes-js-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-SDSGgXT3LRCH6qMWk8OHT1vLSVNuHNvCpKCx2/TYtQMbMGGgxJC9fspwSkQjqzRagrWnCrxuLL3jMNXLXHHvSw=="
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "18.7.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.4.tgz",
|
||||||
|
"integrity": "sha512-RzRcw8c0B8LzryWOR4Wj7YOTFXvdYKwvrb6xQQyuDfnlTxwYXGCV5RZ/TEbq5L5kn+w3rliHAUyRcG1RtbmTFg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"aes-js": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ=="
|
||||||
|
},
|
||||||
|
"anymatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"normalize-path": "^3.0.0",
|
||||||
|
"picomatch": "^2.0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"binary-extensions": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"braces": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"fill-range": "^7.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chokidar": {
|
||||||
|
"version": "3.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||||
|
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"anymatch": "~3.1.2",
|
||||||
|
"braces": "~3.0.2",
|
||||||
|
"fsevents": "~2.3.2",
|
||||||
|
"glob-parent": "~5.1.2",
|
||||||
|
"is-binary-path": "~2.1.0",
|
||||||
|
"is-glob": "~4.0.1",
|
||||||
|
"normalize-path": "~3.0.0",
|
||||||
|
"readdirp": "~3.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fill-range": {
|
||||||
|
"version": "7.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||||
|
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"to-regex-range": "^5.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"friendly-helper": {
|
||||||
|
"version": "1.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/friendly-helper/-/friendly-helper-1.7.1.tgz",
|
||||||
|
"integrity": "sha512-6X9baO2FZ/EReoJBNOP55fOO21Bu0Lnkr6cM97OHXPBgn+V0LF3rS1Nmxeb/WcQGomSkAO3kBi73HDcrEpUCiA==",
|
||||||
|
"requires": {
|
||||||
|
"@types/aes-js": "^3.1.1",
|
||||||
|
"aes-js": "^3.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fsevents": {
|
||||||
|
"version": "2.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||||
|
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||||
|
"dev": true,
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"glob-parent": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-glob": "^4.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"immutable": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-binary-path": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"binary-extensions": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-extglob": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-glob": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-extglob": "^2.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-number": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"normalize-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"picomatch": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
|
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"readdirp": {
|
||||||
|
"version": "3.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
|
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"picomatch": "^2.2.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sass": {
|
||||||
|
"version": "1.54.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.54.4.tgz",
|
||||||
|
"integrity": "sha512-3tmF16yvnBwtlPrNBHw/H907j8MlOX8aTBnlNX1yrKx24RKcJGPyLhFUwkoKBKesR3unP93/2z14Ll8NicwQUA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"chokidar": ">=3.0.0 <4.0.0",
|
||||||
|
"immutable": "^4.0.0",
|
||||||
|
"source-map-js": ">=0.6.2 <2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source-map-js": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"to-regex-range": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-number": "^7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "4.7.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
||||||
|
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
package.json
27
package.json
|
@ -2,27 +2,28 @@
|
||||||
"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": "npx rimraf ./dist/ && npm run build-tooling && npm run sync && npm run build && node ./tools/parse.js",
|
"deploy-v3": "npm run build-tooling && npm run sync && node ./tools/deploy.js && npm run build-js && npm run build-css",
|
||||||
"deploy-v2": "npm run deploy-v3 && node ./tools/v2.js",
|
"deploy-v2": "npm run deploy-v3 && node ./tools/v2.js",
|
||||||
"build": "vite build",
|
"build-js": "tsc -p tsconfig.json",
|
||||||
"build-tooling": "tsc --project ./tooling.tsconfig.json",
|
"build-css": "sass ./src/sass/:./dist/css/",
|
||||||
"watch": "vite build --watch",
|
"build-tooling": "tsc ./tools/v2.ts --target esnext --module esnext && tsc ./tools/syncConfig.ts --target esnext --module esnext && tsc ./tools/deploy.ts --target esnext --module esnext",
|
||||||
"sync": "npm run build-tooling && node ./tools/syncConfig.js"
|
"sync": "npm run build-tooling && node ./tools/syncConfig.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chrome": "^0.0.268",
|
"@types/node": "^18.7.4",
|
||||||
"@types/node": "^20.13.0",
|
"sass": "^1.39.0",
|
||||||
"@webcomponents/webcomponentsjs": "^2.8.0",
|
"typescript": "^4.2.4"
|
||||||
"sass": "^1.77.4",
|
|
||||||
"vite": "^5.2.12",
|
|
||||||
"vite-tsconfig-paths": "^4.3.2"
|
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not dead"
|
"not dead"
|
||||||
],
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"friendly-helper": "^1.7.1"
|
||||||
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Jonas Pfalzgraf",
|
"name": "Jonas Pfalzgraf",
|
||||||
|
@ -38,9 +39,5 @@
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/JosunLP/BrowserExtensionTemplate/issues"
|
"url": "https://github.com/JosunLP/BrowserExtensionTemplate/issues"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@webcomponents/custom-elements": "^1.6.0",
|
|
||||||
"bootstrap": "^5.3.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,13 +14,19 @@
|
||||||
"default_title": "BrowserExtensionTemplate",
|
"default_title": "BrowserExtensionTemplate",
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
},
|
},
|
||||||
"options_ui": {
|
|
||||||
"page": "options.html"
|
|
||||||
},
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"notifications"
|
"notifications"
|
||||||
],
|
],
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "background.js"
|
"service_worker": "js/background.js"
|
||||||
|
},
|
||||||
|
"commands": {
|
||||||
|
"_execute_browser_action": {
|
||||||
|
"suggested_key": {
|
||||||
|
"default": "Ctrl+Shift+F",
|
||||||
|
"mac": "MacCtrl+Shift+F"
|
||||||
|
},
|
||||||
|
"description": "Opens popup.html"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
||||||
<link rel="icon" href="./favicon.ico">
|
|
||||||
<title>{{BET}} Options</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<strong>We're sorry but {{BET}} doesn't work properly without JavaScript enabled. Please enable it to
|
|
||||||
continue.</strong>
|
|
||||||
</noscript>
|
|
||||||
<div id="app">
|
|
||||||
<img src="./icons/icon128.png" class="logo" />
|
|
||||||
<h1>Settings</h1>
|
|
||||||
<div id="settings">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<footer>
|
|
||||||
<script type="module" src="./settings.js"></script>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<link rel="icon" href="./favicon.ico">
|
<link rel="icon" href="./favicon.ico">
|
||||||
<title>{{BET}}</title>
|
<title>{{BET}}</title>
|
||||||
|
<link rel="stylesheet" href="css/app.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<script type="module" src="./app.js"></script>
|
<script type="module" src="./js/app.js"></script>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
11
src/app.ts
11
src/app.ts
|
@ -1,6 +1,3 @@
|
||||||
import { Session } from "./classes/session"
|
|
||||||
import "./sass/app.sass"
|
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
|
|
||||||
private static contentEntry: string = "content"
|
private static contentEntry: string = "content"
|
||||||
|
@ -11,21 +8,17 @@ class App {
|
||||||
}
|
}
|
||||||
|
|
||||||
async main(): Promise<void> {
|
async main(): Promise<void> {
|
||||||
console.log("Hello World")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async drawData(): Promise<void> {
|
async drawData(): Promise<void> {
|
||||||
const session = Session.getInstance()
|
|
||||||
const contentRoot = <HTMLDivElement>document.getElementById(App.contentEntry)
|
const contentRoot = <HTMLDivElement>document.getElementById(App.contentEntry)
|
||||||
const body = document.createElement("div")
|
const body = document.createElement("div")
|
||||||
const title = document.createElement("h1")
|
const title = document.createElement("h1")
|
||||||
const text = document.createElement("p")
|
|
||||||
title.innerText = "Hello World"
|
title.innerText = "Hello World"
|
||||||
text.innerText = session.contentTest
|
|
||||||
body.appendChild(title)
|
body.appendChild(title)
|
||||||
body.appendChild(text)
|
|
||||||
contentRoot.appendChild(body)
|
contentRoot.appendChild(body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new App();
|
new App();
|
|
@ -1,9 +1,13 @@
|
||||||
class Background {
|
|
||||||
constructor() {
|
|
||||||
this.main();
|
|
||||||
}
|
|
||||||
|
|
||||||
async main(): Promise<void> {}
|
class Background {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.main();
|
||||||
|
}
|
||||||
|
|
||||||
|
async main(): Promise<void> {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new Background();
|
new Background();
|
|
@ -1,55 +0,0 @@
|
||||||
export class Session {
|
|
||||||
|
|
||||||
private static instance: Session;
|
|
||||||
|
|
||||||
private constructor() {
|
|
||||||
}
|
|
||||||
|
|
||||||
static getInstance() {
|
|
||||||
if (!Session.instance && !Session.load()) {
|
|
||||||
Session.instance = new Session();
|
|
||||||
}
|
|
||||||
if (!Session.instance && Session.load()) {
|
|
||||||
Session.instance = <Session>Session.load();
|
|
||||||
}
|
|
||||||
Session.save();
|
|
||||||
return Session.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static save() {
|
|
||||||
localStorage.setItem('session', JSON.stringify(this.instance));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static load(): Session | null {
|
|
||||||
const session = localStorage.getItem('session');
|
|
||||||
if (session) {
|
|
||||||
const obj = <Session>JSON.parse(session);
|
|
||||||
const result = new Session();
|
|
||||||
result.contentTest = obj.contentTest;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static reloadSession() {
|
|
||||||
const session = localStorage.getItem('session');
|
|
||||||
if (session) {
|
|
||||||
const obj = <Session>JSON.parse(session);
|
|
||||||
const result = new Session();
|
|
||||||
result.contentTest = obj.contentTest;
|
|
||||||
Session.instance = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static resetSession() {
|
|
||||||
localStorage.removeItem('session');
|
|
||||||
sessionStorage.removeItem('session');
|
|
||||||
this.instance = new Session();
|
|
||||||
Session.save();
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly sessionId: string = crypto.randomUUID();
|
|
||||||
|
|
||||||
public contentTest: string = 'This is a simple example of a web application';
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
import { customButton } from "../types/buttonType";
|
|
||||||
|
|
||||||
export class BasicButton {
|
|
||||||
|
|
||||||
private type: customButton;
|
|
||||||
|
|
||||||
private text: string;
|
|
||||||
|
|
||||||
private id: string | undefined;
|
|
||||||
|
|
||||||
private className: string | undefined;
|
|
||||||
|
|
||||||
constructor(type: customButton, text: string, id?: string, className?: string) {
|
|
||||||
this.type = type;
|
|
||||||
this.text = text;
|
|
||||||
this.id = id;
|
|
||||||
this.className = className;
|
|
||||||
}
|
|
||||||
|
|
||||||
public render(): string {
|
|
||||||
const result = document.createElement('button');
|
|
||||||
result.type = "button";
|
|
||||||
result.className = this.type;
|
|
||||||
result.textContent = this.text;
|
|
||||||
|
|
||||||
switch (this.type) {
|
|
||||||
case "primary":
|
|
||||||
result.className = "btn btn-primary";
|
|
||||||
break;
|
|
||||||
case "success":
|
|
||||||
result.className = "btn btn-success";
|
|
||||||
break;
|
|
||||||
case "danger":
|
|
||||||
result.className = "btn btn-danger";
|
|
||||||
break;
|
|
||||||
case "warning":
|
|
||||||
result.className = "btn btn-warning";
|
|
||||||
break;
|
|
||||||
case "info":
|
|
||||||
result.className = "btn btn-info";
|
|
||||||
break;
|
|
||||||
case "light":
|
|
||||||
result.className = "btn btn-light";
|
|
||||||
break;
|
|
||||||
case "dark":
|
|
||||||
result.className = "btn btn-dark";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
result.className = "btn btn-primary";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.id) {
|
|
||||||
result.id = this.id;
|
|
||||||
}
|
|
||||||
if (this.className) {
|
|
||||||
result.className += ' ' + this.className;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.outerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,93 +1,84 @@
|
||||||
@import "root"
|
@import "root"
|
||||||
|
|
||||||
@mixin respond-to($media)
|
@mixin respond-to($media)
|
||||||
@if $media == handhelds
|
@if $media == handhelds
|
||||||
@media only screen and (max-device-width: 40rem)
|
@media only screen and (max-device-width: 40rem)
|
||||||
@content
|
@content
|
||||||
|
|
||||||
@else if $media == medium-screens
|
@else if $media == medium-screens
|
||||||
@media only screen and (min-device-width: 40rem)
|
@media only screen and (min-device-width: 40rem)
|
||||||
@content
|
@content
|
||||||
|
|
||||||
@else if $media == wide-screens
|
@else if $media == wide-screens
|
||||||
@media only screen and (min-width: 1000px)
|
@media only screen and (min-width: 1000px)
|
||||||
@content
|
@content
|
||||||
|
|
||||||
@mixin partialButton
|
@mixin partialButton
|
||||||
width: 5rem !important
|
button
|
||||||
height: 2rem !important
|
width: 100% !important
|
||||||
text-align: center !important
|
height: 100% !important
|
||||||
margin: 0.5rem !important
|
text-align: center !important
|
||||||
border-color: $seccond-color !important
|
margin: 0 !important
|
||||||
border-radius: 0.5rem !important
|
|
||||||
|
|
||||||
@include respond-to(handhelds)
|
@include respond-to(handhelds)
|
||||||
font-size: 3rem
|
font-size: 3rem
|
||||||
|
|
||||||
@include respond-to(medium-screens)
|
@include respond-to(medium-screens)
|
||||||
font-size: 1.5rem
|
font-size: 1.5rem
|
||||||
|
|
||||||
@mixin hoverMe
|
@mixin hoverMe
|
||||||
&:hover
|
&:hover
|
||||||
button
|
button
|
||||||
color: grey !important
|
color: grey !important
|
||||||
|
|
||||||
@mixin shadow
|
@mixin shadow
|
||||||
box-shadow: 0px 0px 30px silver
|
box-shadow: 0px 0px 30px silver
|
||||||
|
|
||||||
@mixin noselect
|
@mixin noselect
|
||||||
-webkit-touch-callout: none
|
-webkit-touch-callout: none
|
||||||
-webkit-user-select: none
|
-webkit-user-select: none
|
||||||
-khtml-user-select: none
|
-khtml-user-select: none
|
||||||
-moz-user-select: none
|
-moz-user-select: none
|
||||||
-ms-user-select: none
|
-ms-user-select: none
|
||||||
user-select: none
|
user-select: none
|
||||||
pointer-events: none
|
pointer-events: none
|
||||||
|
|
||||||
.form-group
|
|
||||||
margin-left: 2rem
|
|
||||||
margin-right: 2rem
|
|
||||||
margin-bottom: 0.5rem
|
|
||||||
flex-wrap: wrap
|
|
||||||
justify-content: center
|
|
||||||
display: flex
|
|
||||||
|
|
||||||
@mixin formBasic
|
@mixin formBasic
|
||||||
display: block
|
display: block
|
||||||
padding: 2rem
|
padding: 2rem
|
||||||
background: $background-color-content
|
background: $background-color-content
|
||||||
border-radius: 0.7rem
|
border-radius: 0.7rem
|
||||||
min-height: 20rem
|
min-height: 20rem
|
||||||
margin: auto
|
margin: auto
|
||||||
margin-top: 2rem
|
margin-top: 2rem
|
||||||
margin-bottom: 2rem
|
margin-bottom: 2rem
|
||||||
@include shadow
|
@include shadow
|
||||||
|
|
||||||
@include respond-to(handhelds)
|
@include respond-to(handhelds)
|
||||||
font-size: 2.5em
|
font-size: 2.5em
|
||||||
margin-left: -0.8em
|
margin-left: -0.8em
|
||||||
margin-right: -0.8em
|
margin-right: -0.8em
|
||||||
border-radius: 0
|
border-radius: 0
|
||||||
|
|
||||||
@include respond-to(medium-screens)
|
@include respond-to(medium-screens)
|
||||||
max-width: 40rem
|
max-width: 40rem
|
||||||
|
|
||||||
@include respond-to(wide-screens)
|
@include respond-to(wide-screens)
|
||||||
max-width: 40rem
|
max-width: 40rem
|
||||||
|
|
||||||
input
|
input
|
||||||
@include respond-to(handhelds)
|
@include respond-to(handhelds)
|
||||||
font-size: 3rem
|
font-size: 3rem
|
||||||
border-radius: 0.5rem
|
border-radius: 0.5rem
|
||||||
|
|
||||||
.check
|
.check
|
||||||
position: static
|
position: static
|
||||||
@include respond-to(handhelds)
|
@include respond-to(handhelds)
|
||||||
width: 2rem !important
|
width: 2rem !important
|
||||||
height: 2rem !important
|
height: 2rem !important
|
||||||
|
|
||||||
button
|
button
|
||||||
@include respond-to(handhelds)
|
@include respond-to(handhelds)
|
||||||
font-size: 3rem
|
font-size: 3rem
|
||||||
padding: 1rem
|
padding: 1rem
|
||||||
border-radius: 1rem
|
border-radius: 1rem
|
||||||
|
|
|
@ -1,26 +1,8 @@
|
||||||
$main-font: 'Ubuntu', 'Staatliches'
|
$main-font: 'Ubuntu', 'Staatliches'
|
||||||
$main-font-color: white
|
$main-font-color: white
|
||||||
$main-font-color-hover: lightgrey
|
$main-font-color-hover: lightgrey
|
||||||
$main-font-color-focus: lightgrey
|
|
||||||
$main-font-color-disabled: lightgrey
|
|
||||||
$main-font-color-active: lightgrey
|
|
||||||
$main-uschrift-font: 'Ubuntu', Arial
|
$main-uschrift-font: 'Ubuntu', Arial
|
||||||
$primary-color: #007bff
|
$seccond-color: lightgrey
|
||||||
$primary-color-hover: #0069d9
|
$background-color: rgb(119, 178, 255)
|
||||||
$primary-color-focus: #0062cc
|
|
||||||
$primary-color-disabled: #0069d9
|
|
||||||
$primary-color-active: #0062cc
|
|
||||||
$background-color-content-shadow: #0069d9
|
|
||||||
$seccond-color: #6c757d
|
|
||||||
$seccondary-color: darkgrey
|
|
||||||
$seccondary-color-hover: black
|
|
||||||
$seccondary-color-focus: black
|
|
||||||
$seccondary-color-disabled: black
|
|
||||||
$seccondary-color-active: black
|
|
||||||
$background-color: #77B2FF
|
|
||||||
$background-color-content: rgb(198, 223, 255)
|
$background-color-content: rgb(198, 223, 255)
|
||||||
$background-color-content-hover: rgb(198, 223, 255)
|
|
||||||
$background-color-content-focus: rgb(198, 223, 255)
|
|
||||||
$background-color-content-active: rgb(198, 223, 255)
|
|
||||||
$background-color-content-disabled: rgb(198, 223, 255)
|
|
||||||
$logo-image: url('../icons/icon128.png')
|
$logo-image: url('../icons/icon128.png')
|
||||||
|
|
|
@ -1,49 +1,41 @@
|
||||||
@import 'root'
|
@import 'root'
|
||||||
@import 'mixin'
|
@import 'mixin'
|
||||||
@import 'content'
|
@import 'content'
|
||||||
@import "../../node_modules/bootstrap/scss/bootstrap"
|
|
||||||
|
|
||||||
body
|
body
|
||||||
height: 30rem
|
height: 30rem
|
||||||
width: 30rem
|
width: 30rem
|
||||||
background-color: $background-color
|
background-color: $background-color
|
||||||
text-align: center
|
text-align: center
|
||||||
margin: auto
|
|
||||||
padding: 1rem
|
|
||||||
color: $main-font-color
|
|
||||||
|
|
||||||
p
|
|
||||||
font-size: 1rem
|
|
||||||
font-weight: bold
|
|
||||||
margin: auto
|
margin: auto
|
||||||
padding: auto
|
padding: auto
|
||||||
color: $main-font-color
|
color: $main-font-color
|
||||||
text-align: center
|
|
||||||
font-family: 'Roboto', sans-serif
|
@include partialButton
|
||||||
|
|
||||||
h1, h2
|
h1, h2
|
||||||
@include noselect
|
|
||||||
|
|
||||||
form
|
|
||||||
@include formBasic
|
|
||||||
|
|
||||||
.logo
|
|
||||||
width: 5rem
|
|
||||||
height: auto
|
|
||||||
padding-top: 2rem
|
|
||||||
@include noselect
|
|
||||||
|
|
||||||
svg
|
|
||||||
@include noselect
|
|
||||||
|
|
||||||
table
|
|
||||||
color: $main-font-color !important
|
|
||||||
|
|
||||||
th
|
|
||||||
@include noselect
|
@include noselect
|
||||||
|
|
||||||
a
|
form
|
||||||
color: $main-font-color
|
@include formBasic
|
||||||
|
|
||||||
&:hover
|
.logo
|
||||||
color: $background-color-content
|
width: 5rem
|
||||||
|
height: auto
|
||||||
|
padding-top: 2rem
|
||||||
|
@include noselect
|
||||||
|
|
||||||
|
svg
|
||||||
|
@include noselect
|
||||||
|
|
||||||
|
table
|
||||||
|
color: $main-font-color !important
|
||||||
|
|
||||||
|
th
|
||||||
|
@include noselect
|
||||||
|
|
||||||
|
a
|
||||||
|
color: $main-font-color
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
color: $background-color-content
|
|
@ -1,33 +0,0 @@
|
||||||
import { Session } from "./classes/session";
|
|
||||||
import { BasicButton } from "./components/button";
|
|
||||||
import "./sass/app.sass";
|
|
||||||
|
|
||||||
class Settings {
|
|
||||||
|
|
||||||
private session = Session.getInstance();
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.renderSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async renderSettings(): Promise<void> {
|
|
||||||
const settings = <HTMLDivElement>document.getElementById('settings');
|
|
||||||
const saveButton = new BasicButton('success', 'Save', 'saveSettings').render();
|
|
||||||
settings.innerHTML = `
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="contentTest">Content Test</label>
|
|
||||||
<input type="text" class="form-control text-input" id="contentTest" placeholder="Enter content test" value="${this.session.contentTest}">
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
settings.innerHTML += saveButton;
|
|
||||||
|
|
||||||
const saveSettings = <HTMLButtonElement>document.getElementById('saveSettings');
|
|
||||||
saveSettings.addEventListener('click', () => {
|
|
||||||
this.session.contentTest = (<HTMLInputElement>document.getElementById('contentTest')).value;
|
|
||||||
Session.save();
|
|
||||||
Session.reloadSession();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
new Settings();
|
|
|
@ -1 +0,0 @@
|
||||||
export type customButton = "neutral" | "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ESNext",
|
|
||||||
"lib": [
|
|
||||||
"ESNext"
|
|
||||||
],
|
|
||||||
"module": "ESNext",
|
|
||||||
"outDir": "./tools/",
|
|
||||||
"rootDir": "./tools/",
|
|
||||||
"removeComments": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"types": [
|
|
||||||
"node",
|
|
||||||
"chrome"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./tools/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules",
|
|
||||||
"./src/*.ts",
|
|
||||||
"./src/**/*.ts",
|
|
||||||
"./dist/*.ts",
|
|
||||||
"./dist/*.js"
|
|
||||||
]
|
|
||||||
}
|
|
82
tools/deploy.ts
Normal file
82
tools/deploy.ts
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
const appConfig = JSON.parse(fs.readFileSync('./app.config.json', 'utf8'));
|
||||||
|
var DEPLOY_ENTRY = "./public/";
|
||||||
|
var DEPLOY_TARGET = "./dist/";
|
||||||
|
|
||||||
|
function deleteFolderRecursive(path: string) {
|
||||||
|
if (fs.existsSync(path)) {
|
||||||
|
fs.readdirSync(path).forEach(function(file: string) {
|
||||||
|
var curPath = path + "/" + file;
|
||||||
|
if (fs.lstatSync(curPath).isDirectory()) {
|
||||||
|
deleteFolderRecursive(curPath);
|
||||||
|
} else {
|
||||||
|
fs.unlinkSync(curPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fs.rmdirSync(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function findHtmlFilesRecursive(source: string): string[] {
|
||||||
|
var files: string[] = [];
|
||||||
|
var dir = fs.readdirSync(source);
|
||||||
|
dir.forEach(function(file: any) {
|
||||||
|
var sourceFile = path.join(source, file);
|
||||||
|
var stat = fs.lstatSync(sourceFile);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
files = files.concat(findHtmlFilesRecursive(sourceFile));
|
||||||
|
} else {
|
||||||
|
if (path.extname(sourceFile) == '.html') {
|
||||||
|
files.push(sourceFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceKeywordsInHtmlFile(file: string, keywords: string[], values: string[]) {
|
||||||
|
var content = fs.readFileSync(file, 'utf8');
|
||||||
|
for (var i = 0; i < keywords.length; i++) {
|
||||||
|
content = content.replace(new RegExp(keywords[i], 'g'), values[i]);
|
||||||
|
}
|
||||||
|
file = file.replace("public\\", DEPLOY_TARGET);
|
||||||
|
fs.writeFileSync(file, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildHtmlFiles(source: string, keywords: string[], values: string[]) {
|
||||||
|
var files = findHtmlFilesRecursive(source);
|
||||||
|
files.forEach(function(file: string) {
|
||||||
|
replaceKeywordsInHtmlFile(file, keywords, values);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function mkdirSync(path: string) {
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(path);
|
||||||
|
} catch(e: any) {
|
||||||
|
if ( e.code != 'EEXIST' ) throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyFiles(source: string, target: string) {
|
||||||
|
var files = fs.readdirSync(source);
|
||||||
|
files.forEach(function(file: any) {
|
||||||
|
var sourceFile = path.join(source, file);
|
||||||
|
var targetFile = path.join(target, file);
|
||||||
|
var stat = fs.lstatSync(sourceFile);
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
mkdirSync(targetFile);
|
||||||
|
copyFiles(sourceFile, targetFile);
|
||||||
|
} else {
|
||||||
|
fs.writeFileSync(targetFile, fs.readFileSync(sourceFile));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteFolderRecursive(DEPLOY_TARGET);
|
||||||
|
mkdirSync(DEPLOY_TARGET);
|
||||||
|
copyFiles(DEPLOY_ENTRY, DEPLOY_TARGET);
|
||||||
|
buildHtmlFiles(DEPLOY_ENTRY, ["{{BET}}"], [appConfig.AppData.name]);
|
||||||
|
|
||||||
|
console.log("Deployed to " + DEPLOY_TARGET);
|
|
@ -1,72 +0,0 @@
|
||||||
import * as fs from "fs";
|
|
||||||
import * as path from "path";
|
|
||||||
const appConfig = JSON.parse(fs.readFileSync("./app.config.json", "utf8"));
|
|
||||||
const DEPLOY_TARGET = "./dist/";
|
|
||||||
|
|
||||||
function findCssFileNames(source: string): string[] {
|
|
||||||
let files: string[] = [];
|
|
||||||
const dir = fs.readdirSync(source);
|
|
||||||
dir.forEach(function (file: string) {
|
|
||||||
const sourceFile = path.join(source, file);
|
|
||||||
const stat = fs.lstatSync(sourceFile);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
files = files.concat(findCssFileNames(sourceFile));
|
|
||||||
} else {
|
|
||||||
if (path.extname(sourceFile) == ".css") {
|
|
||||||
files.push(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
function findHtmlFilesRecursive(source: string): string[] {
|
|
||||||
let files: string[] = [];
|
|
||||||
const dir = fs.readdirSync(source);
|
|
||||||
dir.forEach(function (file: string) {
|
|
||||||
const sourceFile = path.join(source, file);
|
|
||||||
const stat = fs.lstatSync(sourceFile);
|
|
||||||
if (stat.isDirectory()) {
|
|
||||||
files = files.concat(findHtmlFilesRecursive(sourceFile));
|
|
||||||
} else {
|
|
||||||
if (path.extname(sourceFile) == ".html") {
|
|
||||||
files.push(sourceFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return files;
|
|
||||||
}
|
|
||||||
|
|
||||||
function replaceKeywordsInHtmlFile(file: string) {
|
|
||||||
let content = fs.readFileSync(file, "utf8");
|
|
||||||
const pairs: { key: string; value: string }[] = appConfig.htmlTemplatePairs;
|
|
||||||
pairs.forEach(function (pair: { key: string; value: string }) {
|
|
||||||
//@ts-ignore
|
|
||||||
content = content.replaceAll(pair.key, pair.value);
|
|
||||||
});
|
|
||||||
file = file.replace("public\\", DEPLOY_TARGET);
|
|
||||||
fs.writeFileSync(file, content);
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildHtmlFiles(source: string) {
|
|
||||||
const files = findHtmlFilesRecursive(source);
|
|
||||||
files.forEach(function (file: string) {
|
|
||||||
replaceKeywordsInHtmlFile(file);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
findCssFileNames(DEPLOY_TARGET).forEach((file: string) => {
|
|
||||||
const files = findHtmlFilesRecursive(DEPLOY_TARGET);
|
|
||||||
files.forEach(function (htmlFile: string) {
|
|
||||||
let content = fs.readFileSync(htmlFile, "utf8");
|
|
||||||
content = content.replace(
|
|
||||||
"</head>",
|
|
||||||
`<link rel="stylesheet" href="./assets/${file}">\n</head>`
|
|
||||||
);
|
|
||||||
fs.writeFileSync(htmlFile, content);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
buildHtmlFiles(DEPLOY_TARGET);
|
|
||||||
|
|
||||||
console.log("Parsed Files: ", findHtmlFilesRecursive(DEPLOY_TARGET));
|
|
|
@ -1,9 +1,8 @@
|
||||||
// @ts-ignore
|
import * as fs from 'fs';
|
||||||
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 manifestJson = JSON.parse(fs.readFileSync('./public/manifest.json', 'utf8'));
|
const manifest = 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;
|
||||||
|
@ -14,10 +13,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;
|
||||||
|
|
||||||
manifestJson.version = appConfig.AppData.version;
|
manifest.version = appConfig.AppData.version;
|
||||||
manifestJson.name = appConfig.AppData.name;
|
manifest.name = appConfig.AppData.name;
|
||||||
manifestJson.description = appConfig.AppData.description;
|
manifest.description = appConfig.AppData.description;
|
||||||
manifestJson.homepage_url = appConfig.AppData.homepage;
|
manifest.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(manifestJson, null, 2));
|
fs.writeFileSync('./public/manifest.json', JSON.stringify(manifest, null, 2));
|
45
tools/v2.ts
45
tools/v2.ts
|
@ -1,46 +1,7 @@
|
||||||
// @ts-ignore
|
import * as fs from 'fs';
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
|
const manifest = JSON.parse(fs.readFileSync('./dist/manifest.json', 'utf8'));
|
||||||
|
|
||||||
manifest.manifest_version = 2
|
manifest.manifest_version = 2;
|
||||||
|
|
||||||
manifest.background.scripts = []
|
fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest, null, 2));
|
||||||
|
|
||||||
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));
|
|
140
tsconfig.json
140
tsconfig.json
|
@ -1,75 +1,81 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
|
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
|
||||||
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
"module": "ESNext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||||
"lib": ["ESNext", "DOM"], /* Specify library files to be included in the compilation. */
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
// "checkJs": true, /* Report errors in .js files. */
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
||||||
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||||
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
"sourceMap": true /* Generates corresponding '.map' file. */,
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
// "outFile": "./public/js/app.js", /* Concatenate and emit output to single file. */
|
// "outFile": "./public/js/app.js", /* Concatenate and emit output to single file. */
|
||||||
"outDir": "./dist/js/" /* Redirect output structure to the directory. */,
|
"outDir": "./dist/js/", /* Redirect output structure to the directory. */
|
||||||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
// "composite": true, /* Enable project compilation */
|
// "composite": true, /* Enable project compilation */
|
||||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||||
"removeComments": true /* Do not emit comments to output. */,
|
// "removeComments": true, /* Do not emit comments to output. */
|
||||||
// "noEmit": true, /* Do not emit outputs. */
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
/* Strict Type-Checking Options */
|
/* Strict Type-Checking Options */
|
||||||
"strict": true /* Enable all strict type-checking options. */,
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
|
||||||
/* Additional Checks */
|
/* Additional Checks */
|
||||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
|
||||||
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
|
||||||
|
|
||||||
/* Module Resolution Options */
|
/* Module Resolution Options */
|
||||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
// "types": [], /* Type declaration files to be included in compilation. */
|
// "types": [], /* Type declaration files to be included in compilation. */
|
||||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
|
||||||
/* Source Map Options */
|
/* Source Map Options */
|
||||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
|
||||||
/* Experimental Options */
|
/* Experimental Options */
|
||||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
|
||||||
/* Advanced Options */
|
/* Advanced Options */
|
||||||
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
||||||
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
||||||
},
|
},
|
||||||
"include": ["./src/**/*.ts", "./src/*.ts"],
|
"include": [
|
||||||
"exclude": ["node_modules", "./tools/*.ts", "./dist/*.ts", "./dist/*.js"],
|
"./src/**/*.ts",
|
||||||
"types": ["node", "chrome"]
|
"./src/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"./tools/*.ts",
|
||||||
|
"./dist/*.ts",
|
||||||
|
"./dist/*.js"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
import { defineConfig } from "vite";
|
|
||||||
import { resolve } from "path";
|
|
||||||
import tsconfigPaths from "vite-tsconfig-paths";
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
build: {
|
|
||||||
rollupOptions: {
|
|
||||||
input: {
|
|
||||||
app: resolve(__dirname, "src/app.ts"),
|
|
||||||
settings: resolve(__dirname, "src/settings.ts"),
|
|
||||||
background: resolve(__dirname, "src/background.ts"),
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
entryFileNames: "[name].js",
|
|
||||||
dir: resolve(__dirname, "dist"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sourcemap: true,
|
|
||||||
},
|
|
||||||
plugins: [tsconfigPaths()],
|
|
||||||
resolve: {
|
|
||||||
extensions: [".tsx", ".ts", ".scss", ".sass"],
|
|
||||||
},
|
|
||||||
esbuild: {
|
|
||||||
include: /.*\.tsx?$/,
|
|
||||||
exclude: [/node_modules/, /dist/],
|
|
||||||
},
|
|
||||||
});
|
|
Loading…
Add table
Reference in a new issue