Compare commits
119 Commits
afa0518f5f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f34d8e836a | |||
|
|
c891fdad45 | ||
|
|
128d4da9d9 | ||
|
|
417179a5e2 | ||
|
|
37e6e6d003 | ||
|
|
11bdecc6d3 | ||
|
|
7611f10b1c | ||
|
|
80ffb8b70c | ||
|
|
6422846605 | ||
|
|
f1fce63e24 | ||
|
|
fa6222a1a8 | ||
|
|
b37c040655 | ||
|
|
573b91d224 | ||
|
|
344127b617 | ||
|
|
eed389b59b | ||
|
|
87a43b0b37 | ||
|
|
a69186daaa | ||
|
|
a54cbf1338 | ||
|
|
36eea85b97 | ||
|
|
d7c7af13f1 | ||
|
|
3534d64960 | ||
|
|
99b46f891b | ||
|
|
f580c85587 | ||
|
|
18b1137641 | ||
|
|
83791ed223 | ||
|
|
0cb9e5cebe | ||
|
|
a6b5cf62da | ||
|
|
3ea3016e2c | ||
|
|
2ae1d82a65 | ||
|
|
875b4dc352 | ||
|
|
fd8ba8faa2 | ||
|
|
b0f5125908 | ||
|
|
dd644fc971 | ||
|
|
242ee0777a | ||
|
|
c3015fceda | ||
|
|
3efa03eb36 | ||
|
|
5b230c835d | ||
|
|
07e35d881d | ||
|
|
9dfd320aea | ||
|
|
4420ac799e | ||
|
|
f65368c9c3 | ||
|
|
470d52309e | ||
|
|
941de4c1dc | ||
|
|
6f069d5cec | ||
|
|
6d32dc1adb | ||
|
|
09d8e219e1 | ||
|
|
bc5740c90c | ||
|
|
5e7210125a | ||
|
|
b2b6f8be9f | ||
|
|
6c006970a8 | ||
|
|
0dc18d8c43 | ||
|
|
a0a5028ae2 | ||
|
|
43897efe1b | ||
|
|
ad28164188 | ||
|
|
e207f64bb1 | ||
|
|
40915f89fc | ||
|
|
7b9007b02d | ||
|
|
6e2c007709 | ||
|
|
7995e88f83 | ||
|
|
0a74e29e0e | ||
|
|
2d6066532a | ||
|
|
923cd6fe2f | ||
|
|
acdaa86ab8 | ||
|
|
19955a01b1 | ||
|
|
e8a3e72523 | ||
|
|
351eb1a7f0 | ||
|
|
23dd9f5cc8 | ||
|
|
2feedcefc5 | ||
|
|
750aea5e0c | ||
|
|
5c11822d09 | ||
|
|
a274767a48 | ||
|
|
99742e3dc1 | ||
|
|
b55552dd00 | ||
|
|
cd7a150c1d | ||
|
|
4e9506aca5 | ||
|
|
7a3d5d7d3a | ||
|
|
77b15bdfc4 | ||
|
|
1a5a76f912 | ||
|
|
e84821388e | ||
|
|
f45cd5d04d | ||
|
|
8d15786e5d | ||
|
|
4fa2999961 | ||
|
|
ce29f13f41 | ||
|
|
433dfeb7f5 | ||
|
|
39efb20600 | ||
|
|
0924b4a4bd | ||
|
|
66c7d033ac | ||
|
|
aa338ca75e | ||
|
|
731ce15206 | ||
|
|
afcb096f59 | ||
|
|
42f8cfdc5a | ||
|
|
215fde1a64 | ||
|
|
ff2953fc4f | ||
|
|
e87515e49a | ||
|
|
21b3408214 | ||
|
|
56fc02295b | ||
|
|
a1c2aa35bd | ||
|
|
f442df72c4 | ||
|
|
4a0397f56e | ||
|
|
fd598bb10d | ||
|
|
8822440f7d | ||
|
|
f17719c7e8 | ||
|
|
720223ec7f | ||
|
|
2559e973dc | ||
|
|
7e02b37b10 | ||
|
|
45a02e392c | ||
|
|
8543cf148c | ||
|
|
a100e3c488 | ||
|
|
83301e0fe7 | ||
|
|
73acf88a07 | ||
|
|
647889cd70 | ||
|
|
afd8916d71 | ||
|
|
0c82cf4259 | ||
|
|
9c8788fb2e | ||
|
|
f506c0c2ab | ||
|
|
47c74d015d | ||
|
|
ea90fd845f | ||
|
|
cae7f629aa | ||
|
|
ae45b810de |
36
.eslintrc.json
Normal file
36
.eslintrc.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2020": true,
|
||||
"node": true
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "import", "unicorn", "sonarjs"],
|
||||
"extends": [
|
||||
"plugin:unicorn/recommended",
|
||||
"plugin:sonarjs/recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"typescript": {
|
||||
"project": "workspaces/*/tsconfig.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ignorePatterns": ["**/dist/**/*", "**/.dist/**/*"],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"argsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-explicit-any": ["off"],
|
||||
"unicorn/prefer-module": "off"
|
||||
}
|
||||
}
|
||||
29
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: bug
|
||||
assignees: aadiene
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**How to reproduce**
|
||||
Simple steps to follow to reproduce the bug.
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Configuration (please complete the following information):**
|
||||
- OS : [e.g. iOS]
|
||||
- node version : [e.g. 14]
|
||||
- npm version : [e.g. 7]
|
||||
- ng-cli version : [e.g. 12]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEAT]"
|
||||
labels: enhancement
|
||||
assignees: aadiene
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
14
.github/dependabot.yml
vendored
Normal file
14
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: 'npm'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
# Check for npm updates on Sundays
|
||||
day: 'sunday'
|
||||
# Raise pull requests for version updates
|
||||
# to pip against the `develop` branch
|
||||
target-branch: 'develop'
|
||||
# Labels on pull requests for security and version updates
|
||||
labels:
|
||||
- 'npm dependencies'
|
||||
26
.github/pull_request_template.md
vendored
Normal file
26
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Pull Request Template
|
||||
|
||||
## Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Type of change
|
||||
|
||||
Please delete options that are not relevant.
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
## Checklist:
|
||||
|
||||
- [ ] My code follows the style guidelines of this project
|
||||
- [ ] I have performed a self-review of my own code
|
||||
- [ ] I have commented my code, particularly in hard-to-understand areas
|
||||
- [ ] I have made corresponding changes to the documentation
|
||||
- [ ] My changes generate no new warnings
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
- [ ] New and existing unit tests pass locally with my changes
|
||||
64
.github/workflows/ci.yml
vendored
Normal file
64
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
name: 'CI'
|
||||
|
||||
# Controls when the action will run.
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the master branch
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macOS-latest, ubuntu-latest, windows-latest]
|
||||
node-version: [14.x, 16.x, 18.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
# npm cache files are stored in `~/.npm`
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- name: Upgrade to the latest version of npm
|
||||
run: npm install -g npm@latest
|
||||
- name: Upgrade to the latest version of Angular CLI
|
||||
run: npm install -g @angular/cli@latest
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Test Angular E2E
|
||||
uses: GabrielBB/xvfb-action@v1
|
||||
with:
|
||||
run: npm run test:angular-e2e
|
||||
- name: Test Electron E2E
|
||||
uses: GabrielBB/xvfb-action@v1
|
||||
with:
|
||||
run: npm run test:electron-e2e
|
||||
- name: Check lint
|
||||
run: npm run lint
|
||||
- name: Make app distributables
|
||||
run: npm run make
|
||||
22
.github/workflows/close-inactive-issues.yml
vendored
Normal file
22
.github/workflows/close-inactive-issues.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
name: 'Close inactive issues'
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 1 * * *"
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v4
|
||||
with:
|
||||
days-before-issue-stale: 30
|
||||
days-before-issue-close: 14
|
||||
stale-issue-label: "stale"
|
||||
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
||||
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
28
.gitignore
vendored
28
.gitignore
vendored
@@ -16,6 +16,7 @@ pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
.DS_Store
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
@@ -45,6 +46,8 @@ jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
@@ -91,12 +94,25 @@ out
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
.dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
@@ -130,3 +146,15 @@ dist
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# Webpack
|
||||
.webpack/
|
||||
|
||||
# Electron-Forge
|
||||
out/
|
||||
|
||||
# Allure
|
||||
allure-results
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
1
.husky/.gitignore
vendored
Normal file
1
.husky/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
_;
|
||||
36
.husky/_/husky.sh
Normal file
36
.husky/_/husky.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env sh
|
||||
if [ -z "$husky_skip_init" ]; then
|
||||
debug () {
|
||||
if [ "$HUSKY_DEBUG" = "1" ]; then
|
||||
echo "husky (debug) - $1"
|
||||
fi
|
||||
}
|
||||
|
||||
readonly hook_name="$(basename -- "$0")"
|
||||
debug "starting $hook_name..."
|
||||
|
||||
if [ "$HUSKY" = "0" ]; then
|
||||
debug "HUSKY env variable is set to 0, skipping hook"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f ~/.huskyrc ]; then
|
||||
debug "sourcing ~/.huskyrc"
|
||||
. ~/.huskyrc
|
||||
fi
|
||||
|
||||
readonly husky_skip_init=1
|
||||
export husky_skip_init
|
||||
sh -e "$0" "$@"
|
||||
exitCode="$?"
|
||||
|
||||
if [ $exitCode != 0 ]; then
|
||||
echo "husky - $hook_name hook exited with code $exitCode (error)"
|
||||
fi
|
||||
|
||||
if [ $exitCode = 127 ]; then
|
||||
echo "husky - command not found in PATH=$PATH"
|
||||
fi
|
||||
|
||||
exit $exitCode
|
||||
fi
|
||||
8
.prettierrc
Normal file
8
.prettierrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"useTabs": true,
|
||||
"tabSize": 2,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true
|
||||
}
|
||||
12
.versionrc.json
Normal file
12
.versionrc.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"types": [
|
||||
{ "type": "feat", "section": "Features" },
|
||||
{ "type": "fix", "section": "Bug Fixes" },
|
||||
{ "type": "chore", "hidden": true },
|
||||
{ "type": "docs", "hidden": true },
|
||||
{ "type": "style", "hidden": true },
|
||||
{ "type": "refactor", "hidden": true },
|
||||
{ "type": "perf", "hidden": true },
|
||||
{ "type": "test", "hidden": true }
|
||||
]
|
||||
}
|
||||
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"skipFiles": ["<node_internals>/**"],
|
||||
"program": "${workspaceFolder}\\.webpack\\main",
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
"outFiles": ["${workspaceFolder}/.dist/**/*.js"]
|
||||
}
|
||||
]
|
||||
}
|
||||
127
CHANGELOG.md
Normal file
127
CHANGELOG.md
Normal file
@@ -0,0 +1,127 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [3.2.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v3.1.0...v3.2.0) (2022-09-24)
|
||||
|
||||
### Features
|
||||
|
||||
- angular upgrade - 13.3.2 => 14.2.3 ([fa6222a](https://github.com/sourcygen/electron-angular-quick-start/commit/fa6222a1a86c0528a09f901a97f61f374933e2a6))
|
||||
- electron upgrade - 18.0.3 => 20.2.0 ([f1fce63](https://github.com/sourcygen/electron-angular-quick-start/commit/f1fce63e24fc8c0ca53a97a83e337ea36332e645))
|
||||
|
||||
## [3.1.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v3.0.0...v3.1.0) (2022-04-07)
|
||||
|
||||
## [3.0.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v2.4.0...v3.0.0) (2022-04-07)
|
||||
|
||||
### Features
|
||||
|
||||
- migrating electron e2e from spectron (deprecated) to wdio ([#32](https://github.com/sourcygen/electron-angular-quick-start/issues/32)) ([d7c7af1](https://github.com/sourcygen/electron-angular-quick-start/commit/d7c7af13f109427c74e55886c2de0a19614283b6))
|
||||
|
||||
## [2.4.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v2.0.1...v2.4.0) (2021-08-06)
|
||||
|
||||
### Features
|
||||
|
||||
- ci build/test/make (github workflows) ([351eb1a](https://github.com/sourcygen/electron-angular-quick-start/commit/351eb1a7f0bd78043d8590effe7482965e0574b1))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- shared-lib not found ([99742e3](https://github.com/sourcygen/electron-angular-quick-start/commit/99742e3dc1779141c5c8f2ec573faf33c72dea84))
|
||||
- using chokidar instead of npm-watch (issue [#4](https://github.com/sourcygen/electron-angular-quick-start/issues/4)) ([2feedce](https://github.com/sourcygen/electron-angular-quick-start/commit/2feedcefc5a2125e701b460bbd3d644775572d47))
|
||||
|
||||
## [2.3.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v2.0.1...v2.3.0) (2021-08-01)
|
||||
|
||||
### Features
|
||||
|
||||
- ci build/test/make (github workflows) ([351eb1a](https://github.com/sourcygen/electron-angular-quick-start/commit/351eb1a7f0bd78043d8590effe7482965e0574b1))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- shared-lib not found ([99742e3](https://github.com/sourcygen/electron-angular-quick-start/commit/99742e3dc1779141c5c8f2ec573faf33c72dea84))
|
||||
- using chokidar instead of npm-watch (issue [#4](https://github.com/sourcygen/electron-angular-quick-start/issues/4)) ([2feedce](https://github.com/sourcygen/electron-angular-quick-start/commit/2feedcefc5a2125e701b460bbd3d644775572d47))
|
||||
|
||||
## [2.2.0](https://github.com/sourcygen/electron-angular-quick-start/compare/v2.0.1...v2.2.0) (2021-07-22)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- shared-lib not found ([99742e3](https://github.com/sourcygen/electron-angular-quick-start/commit/99742e3dc1779141c5c8f2ec573faf33c72dea84))
|
||||
|
||||
## 2.1.0 (2021-07-22)
|
||||
|
||||
### Features
|
||||
|
||||
- git hook config (husky eslint prettier) ([77b15bd](https://github.com/sourcygen/electron-angular-quick-start/commit/77b15bdfc4355afa63cd7517e87da0029a804691))
|
||||
- cypress setup for angular e2e tests ([7a3d5d7](https://github.com/sourcygen/electron-angular-quick-start/commit/7a3d5d7d3aaf92c4de9c89349a14c59d84d38afb))
|
||||
- crossplatform icon config ([4e9506a](https://github.com/sourcygen/electron-angular-quick-start/commit/4e9506aca5515dd32b481b9c6d26c5c79598dcea))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- fixing eslint problems ([1a5a76f](https://github.com/sourcygen/electron-angular-quick-start/commit/1a5a76f9121115db65ad3e1cb07f0b008c2e958a))
|
||||
|
||||
# 2.0.0 (2021-07-19)
|
||||
|
||||
### Features
|
||||
|
||||
- migrate from electron-webpack to electron-forge ([4fa2999](https://github.com/sourcygen/electron-angular-quick-start/commit/4fa299996145deb61e3b65d3d05faab0bd8a25e1))
|
||||
|
||||
## 1.0.2 (2020-09-29)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- reopening window crash on macos ([f442df7](https://github.com/sourcygen/electron-angular-quick-start/commit/f442df72c4120fb616d21c5c4e245a5eb478f57e))
|
||||
|
||||
### Features
|
||||
|
||||
- disable remote content execution ([0c82cf4](https://github.com/sourcygen/electron-angular-quick-start/commit/0c82cf425930de7368debfbc6176a3ef8ed7591e))
|
||||
- adapt angular part ([83301e0](https://github.com/sourcygen/electron-angular-quick-start/commit/83301e0fe7387e791d23f7c1d6cdaeb1f53e3cf4))
|
||||
- adapt electron part ([73acf88](https://github.com/sourcygen/electron-angular-quick-start/commit/73acf88a079984e50c15e23e5ad0aa98b0a7c2a1))
|
||||
- add electron dependencies ([f506c0c](https://github.com/sourcygen/electron-angular-quick-start/commit/f506c0c2ab613ec0d72863f5a30c2c1ce553dcd2))
|
||||
- add electron e2e launch scripts ([7e02b37](https://github.com/sourcygen/electron-angular-quick-start/commit/7e02b37b10f54f7bbb66e88f7e433ba67594287b))
|
||||
- add electron packaging scripts ([afd8916](https://github.com/sourcygen/electron-angular-quick-start/commit/afd8916d7143b258ed273d613f15135f91cb8edd))
|
||||
- add spectron and utility dependencies ([a100e3c](https://github.com/sourcygen/electron-angular-quick-start/commit/a100e3c488fde1cc2d60229f47032331b201f7b5))
|
||||
- angular upgrade : 9.1.1 => 10.1.3 ([b3a22e8](https://github.com/sourcygen/electron-angular-quick-start/commit/b3a22e8023b56d2e9707b98ec871c496d054a74d))
|
||||
- change project structure to meet targeted architecture ([9c8788f](https://github.com/sourcygen/electron-angular-quick-start/commit/9c8788fb2e419ae63c3a6545f4c5966547232702))
|
||||
- change project structure to meet targeted architecture ([ea90fd8](https://github.com/sourcygen/electron-angular-quick-start/commit/ea90fd845f8188c5fd4f867d7ec7f80ffd1b6e3f))
|
||||
- conventional commit setup ([4a0397f](https://github.com/sourcygen/electron-angular-quick-start/commit/4a0397f56e10e6e88312eeda2f9716d4314b1ea0))
|
||||
- decrease security in e2e tests ([8543cf1](https://github.com/sourcygen/electron-angular-quick-start/commit/8543cf148c498caa3e3298d8f08b14d16b5426b0))
|
||||
- electron upgrade : 8.2.3 => 10.1.3 ([c53b0d4](https://github.com/sourcygen/electron-angular-quick-start/commit/c53b0d497ea5d0823d425b445449cff2a9c1ddc7))
|
||||
- env config setup ([8822440](https://github.com/sourcygen/electron-angular-quick-start/commit/8822440f7dfa4452b588520cca5179121b276188))
|
||||
- i18n setup with ngx-translate ([f17719c](https://github.com/sourcygen/electron-angular-quick-start/commit/f17719c7e8d4c7798b299a6d500712f903ddda3e))
|
||||
- icon settings ([720223e](https://github.com/sourcygen/electron-angular-quick-start/commit/720223ec7ff4984445dcb52fe06ffe3386756367))
|
||||
- init electron e2e code source ([45a02e3](https://github.com/sourcygen/electron-angular-quick-start/commit/45a02e392c0fd755df33760db7f4adbbd31d9616))
|
||||
- init new angular project with angular cli ([cae7f62](https://github.com/sourcygen/electron-angular-quick-start/commit/cae7f629aafe69edb9aaaa6907615e5a2138b05a))
|
||||
- init shared code source ([647889c](https://github.com/sourcygen/electron-angular-quick-start/commit/647889cd70d8d334122ea33c376f8cb51cf3fe7d))
|
||||
- log setup with winston ([fd598bb](https://github.com/sourcygen/electron-angular-quick-start/commit/fd598bb10de942869a857e8927831aa87f768024))
|
||||
- move production dependencies into development dependencies ([47c74d0](https://github.com/sourcygen/electron-angular-quick-start/commit/47c74d015d130a15768be5e783b80f9bfcc97754))
|
||||
- other dependencies upgrade ([5db39a1](https://github.com/sourcygen/electron-angular-quick-start/commit/5db39a1f8b7135d1ed668dd4a77674bbfd9f4ef6))
|
||||
- packaging config ([2559e97](https://github.com/sourcygen/electron-angular-quick-start/commit/2559e973dcf1478f81e25d6acb7332f3edf91dcc))
|
||||
- use npm instead of yarn (issues with binaries) ([29e4dd9](https://github.com/sourcygen/electron-angular-quick-start/commit/29e4dd95bae61025faf820d141206deb81fdcf61))
|
||||
|
||||
## [1.0.1](https://github.com/sourcygen/electron-angular-quick-start/compare/v1.0.0...v1.0.1) (2020-04-30)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- reopening window crash on macos ([f442df7](https://github.com/sourcygen/electron-angular-quick-start/commit/f442df72c4120fb616d21c5c4e245a5eb478f57e))
|
||||
|
||||
# 1.0.0 (2020-04-30)
|
||||
|
||||
### Features
|
||||
|
||||
- disable remote content execution ([0c82cf4](https://github.com/sourcygen/electron-angular-quick-start/commit/0c82cf425930de7368debfbc6176a3ef8ed7591e))
|
||||
- adapt angular part ([83301e0](https://github.com/sourcygen/electron-angular-quick-start/commit/83301e0fe7387e791d23f7c1d6cdaeb1f53e3cf4))
|
||||
- adapt electron part ([73acf88](https://github.com/sourcygen/electron-angular-quick-start/commit/73acf88a079984e50c15e23e5ad0aa98b0a7c2a1))
|
||||
- add electron dependencies ([f506c0c](https://github.com/sourcygen/electron-angular-quick-start/commit/f506c0c2ab613ec0d72863f5a30c2c1ce553dcd2))
|
||||
- add electron e2e launch scripts ([7e02b37](https://github.com/sourcygen/electron-angular-quick-start/commit/7e02b37b10f54f7bbb66e88f7e433ba67594287b))
|
||||
- add electron packaging scripts ([afd8916](https://github.com/sourcygen/electron-angular-quick-start/commit/afd8916d7143b258ed273d613f15135f91cb8edd))
|
||||
- add spectron and utility dependencies ([a100e3c](https://github.com/sourcygen/electron-angular-quick-start/commit/a100e3c488fde1cc2d60229f47032331b201f7b5))
|
||||
- change project structure to meet targeted architecture ([9c8788f](https://github.com/sourcygen/electron-angular-quick-start/commit/9c8788fb2e419ae63c3a6545f4c5966547232702))
|
||||
- change project structure to meet targeted architecture ([ea90fd8](https://github.com/sourcygen/electron-angular-quick-start/commit/ea90fd845f8188c5fd4f867d7ec7f80ffd1b6e3f))
|
||||
- decrease security in e2e tests ([8543cf1](https://github.com/sourcygen/electron-angular-quick-start/commit/8543cf148c498caa3e3298d8f08b14d16b5426b0))
|
||||
- env config setup ([8822440](https://github.com/sourcygen/electron-angular-quick-start/commit/8822440f7dfa4452b588520cca5179121b276188))
|
||||
- i18n setup with ngx-translate ([f17719c](https://github.com/sourcygen/electron-angular-quick-start/commit/f17719c7e8d4c7798b299a6d500712f903ddda3e))
|
||||
- icon settings ([720223e](https://github.com/sourcygen/electron-angular-quick-start/commit/720223ec7ff4984445dcb52fe06ffe3386756367))
|
||||
- init electron e2e code source ([45a02e3](https://github.com/sourcygen/electron-angular-quick-start/commit/45a02e392c0fd755df33760db7f4adbbd31d9616))
|
||||
- init new angular project with angular cli ([cae7f62](https://github.com/sourcygen/electron-angular-quick-start/commit/cae7f629aafe69edb9aaaa6907615e5a2138b05a))
|
||||
- init shared code source ([647889c](https://github.com/sourcygen/electron-angular-quick-start/commit/647889cd70d8d334122ea33c376f8cb51cf3fe7d))
|
||||
- log setup with winston ([fd598bb](https://github.com/sourcygen/electron-angular-quick-start/commit/fd598bb10de942869a857e8927831aa87f768024))
|
||||
- move production dependencies into development dependencies ([47c74d0](https://github.com/sourcygen/electron-angular-quick-start/commit/47c74d015d130a15768be5e783b80f9bfcc97754))
|
||||
- packaging config ([2559e97](https://github.com/sourcygen/electron-angular-quick-start/commit/2559e973dcf1478f81e25d6acb7332f3edf91dcc))
|
||||
128
CODE_OF_CONDUCT.md
Normal file
128
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,128 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact.sourcygen@gmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
||||
1
_config.yml
Normal file
1
_config.yml
Normal file
@@ -0,0 +1 @@
|
||||
theme: jekyll-theme-cayman
|
||||
BIN
assets/murmur.xlsx
Normal file
BIN
assets/murmur.xlsx
Normal file
Binary file not shown.
BIN
assets/test-klant-2.xlsx
Normal file
BIN
assets/test-klant-2.xlsx
Normal file
Binary file not shown.
3
commitlint.config.js
Normal file
3
commitlint.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: ["@commitlint/config-conventional"],
|
||||
};
|
||||
13
config.json
Normal file
13
config.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"filePaths": [
|
||||
"./assets"
|
||||
],
|
||||
"mapping": {
|
||||
"lr": ["L/R"],
|
||||
"krukSlot": ["Kruk/\r\nSLOT"],
|
||||
"pivot": ["SCHARNIER"],
|
||||
"type": ["SOORT"],
|
||||
"modelKruk": ["MODEL\r\nKRUK"],
|
||||
"remark": ["OPMERKING"]
|
||||
}
|
||||
}
|
||||
44384
package-lock.json
generated
Normal file
44384
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
167
package.json
Normal file
167
package.json
Normal file
@@ -0,0 +1,167 @@
|
||||
{
|
||||
"name": "pevabo-deuren",
|
||||
"productName": "Pevabo Deuren",
|
||||
"version": "3.2.0",
|
||||
"description": "Deuren",
|
||||
"repository": "https://github.com/sourcygen/electron-angular-quick-start.git",
|
||||
"author": "Sourcygen",
|
||||
"license": "MIT",
|
||||
"main": ".webpack/main",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"angular 14",
|
||||
"electron",
|
||||
"electron 18",
|
||||
"typescript",
|
||||
"typescript 4",
|
||||
"wdio",
|
||||
"webdriverio",
|
||||
"chromedriver",
|
||||
"scss",
|
||||
"live reload"
|
||||
],
|
||||
"workspaces": [
|
||||
"workspaces/angular-app",
|
||||
"workspaces/shared-lib"
|
||||
],
|
||||
"scripts": {
|
||||
"start": "npm-run-all -p start:shared-lib start:angular-app start:electron-app",
|
||||
"start:shared-lib": "tsc -b workspaces/shared-lib -w",
|
||||
"start:angular-app": "wait-on workspaces/shared-lib/.dist/index.d.ts && cd workspaces/angular-app && npm run start",
|
||||
"start:electron-app": "node scripts/electron-forge-start-watch.js",
|
||||
"start:electron-app:once": "wait-on http://localhost:4200 && electron-forge start",
|
||||
"package": "npm run package:angular-app && npm run package:electron-app",
|
||||
"package:shared-lib": "tsc -b workspaces/shared-lib",
|
||||
"package:angular-app": "npm run package:shared-lib && cd workspaces/angular-app && npm run package",
|
||||
"package:electron-app": "npm run package:shared-lib && electron-forge package",
|
||||
"make": "npm run package:angular-app && electron-forge make",
|
||||
"publish": "electron-forge publish",
|
||||
"lint": "npm run package:shared-lib && eslint --ext .ts .",
|
||||
"test:e2e": "npm run test:angular-e2e && npm run test:electron-e2e",
|
||||
"test:angular-e2e": "npm-run-all -p -r start start:angular-e2e",
|
||||
"start:angular-e2e": "wait-on http://localhost:4200 && cd workspaces/angular-app && npm run cypress:run",
|
||||
"test:electron-e2e": "npm run package && npm run test:electron-e2e:wdio-only",
|
||||
"test:electron-e2e:wdio-only": "cross-env X_NODE_ENV=e2e-test wdio run workspaces/electron-e2e/webdriverio.config.ts --autoCompileOpts.tsNodeOpts.project=workspaces/electron-e2e/tsconfig.json",
|
||||
"clean": "shx rm -rf .webpack out allure-results package-lock.json node_modules workspaces/shared-lib/.dist workspaces/angular-app/node_modules workspaces/angular-app/.angular workspaces/angular-app/.dist",
|
||||
"prepare": "husky install",
|
||||
"postinstall": "husky install && shx rm -rf .git/hooks && shx ln -s ../.husky .git/hooks",
|
||||
"outdated-deps": "npm run outdated-deps:electron-app && npm run outdated-deps:angular-app && npm run outdated-deps:shared-lib",
|
||||
"outdated-deps:electron-app": "npx ncu",
|
||||
"outdated-deps:angular-app": "cd workspaces/angular-app && npx ncu",
|
||||
"outdated-deps:shared-lib": "cd workspaces/shared-lib && npx ncu",
|
||||
"update-deps": "npm run update-deps:electron-app && npm run update-deps:angular-app && npm run update-deps:shared-lib",
|
||||
"update-deps:electron-app": "npx ncu -u",
|
||||
"update-deps:angular-app": "cd workspaces/angular-app && ng update @angular/cli @angular/core --force && npx ncu -u && cd ../.. && npm run clean",
|
||||
"update-deps:shared-lib": "cd workspaces/shared-lib && npx ncu -u",
|
||||
"release:minor": "standard-version --release-as minor",
|
||||
"release:patch": "standard-version --release-as patch",
|
||||
"release:major": "standard-version --release-as major"
|
||||
},
|
||||
"config": {
|
||||
"forge": {
|
||||
"packagerConfig": {
|
||||
"name": "Electron Angular App",
|
||||
"executableName": "electron-angular-app",
|
||||
"icon": "./workspaces/electron-app/main/assets/icons/icon"
|
||||
},
|
||||
"makers": [
|
||||
{
|
||||
"name": "@electron-forge/maker-dmg",
|
||||
"config": {}
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-deb",
|
||||
"config": {}
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-squirrel",
|
||||
"config": {}
|
||||
}
|
||||
],
|
||||
"plugins": [
|
||||
[
|
||||
"@electron-forge/plugin-webpack",
|
||||
{
|
||||
"mainConfig": "./webpack.main.config.js",
|
||||
"renderer": {
|
||||
"config": "./webpack.renderer.config.js",
|
||||
"entryPoints": [
|
||||
{
|
||||
"html": "./workspaces/electron-app/renderer/index.html",
|
||||
"js": "./workspaces/electron-app/renderer/index.ts",
|
||||
"name": "main_window",
|
||||
"preload": {
|
||||
"js": "./workspaces/electron-app/renderer/preload.ts"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.1.2",
|
||||
"@commitlint/config-conventional": "^17.1.0",
|
||||
"@electron-forge/cli": "^6.0.0-beta.66",
|
||||
"@electron-forge/maker-deb": "^6.0.0-beta.66",
|
||||
"@electron-forge/maker-dmg": "^6.0.0-beta.66",
|
||||
"@electron-forge/maker-rpm": "^6.0.0-beta.66",
|
||||
"@electron-forge/maker-squirrel": "^6.0.0-beta.66",
|
||||
"@electron-forge/maker-zip": "^6.0.0-beta.66",
|
||||
"@electron-forge/plugin-webpack": "6.0.0-beta.66",
|
||||
"@types/lodash": "^4.14.185",
|
||||
"@types/node": "^18.7.18",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.0",
|
||||
"@typescript-eslint/parser": "^5.38.0",
|
||||
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
|
||||
"@wdio/allure-reporter": "^7.24.1",
|
||||
"@wdio/cli": "^7.24.1",
|
||||
"@wdio/jasmine-framework": "^7.24.1",
|
||||
"@wdio/local-runner": "^7.24.1",
|
||||
"@wdio/spec-reporter": "^7.24.1",
|
||||
"allure-commandline": "^2.18.1",
|
||||
"chokidar-cli": "^3.0.0",
|
||||
"chromedriver": "^104.0.0",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"css-loader": "^6.7.1",
|
||||
"electron": "^20.2.0",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.1",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-sonarjs": "^0.15.0",
|
||||
"eslint-plugin-unicorn": "^43.0.2",
|
||||
"fork-ts-checker-webpack-plugin": "^7.2.13",
|
||||
"husky": "^8.0.1",
|
||||
"lint-staged": "^13.0.3",
|
||||
"node-loader": "^2.0.0",
|
||||
"npm-check-updates": "^16.2.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.7.1",
|
||||
"shx": "^0.3.4",
|
||||
"standard-version": "^9.5.0",
|
||||
"style-loader": "^3.3.1",
|
||||
"tree-kill": "^1.2.2",
|
||||
"ts-loader": "^9.4.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.8.3",
|
||||
"wait-on": "^6.0.1",
|
||||
"wdio-chromedriver-service": "^7.3.2",
|
||||
"wdio-electron-service": "^3.5.0",
|
||||
"wdio-wait-for": "^2.2.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2.0.8",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"fs-extra": "^10.1.0",
|
||||
"winston": "^3.8.2",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.ts": "npm run lint"
|
||||
}
|
||||
}
|
||||
46
scripts/electron-forge-start-watch.js
Normal file
46
scripts/electron-forge-start-watch.js
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env node
|
||||
const spawn = require('child_process').spawn;
|
||||
const chokidar = require('chokidar');
|
||||
const kill = require('tree-kill');
|
||||
const path = require('path');
|
||||
|
||||
class ElectronForgeRunner {
|
||||
constructor() {
|
||||
this.__init__();
|
||||
}
|
||||
|
||||
__init__ = () => {
|
||||
this.args = process.argv;
|
||||
this.command = this.args[2];
|
||||
this.cwd = process.cwd();
|
||||
this.watchPaths = [
|
||||
path.join(this.cwd, '/workspaces/electron-app/**/*.ts'),
|
||||
path.join(this.cwd, '/workspaces/shared-lib/.dist/**/*.ts'),
|
||||
];
|
||||
this.ignoredPaths = '**/node_modules/*';
|
||||
|
||||
this.startWatching();
|
||||
this.reload();
|
||||
};
|
||||
|
||||
reload = () => {
|
||||
if (this.childProcess) kill(this.childProcess.pid);
|
||||
this.childProcess = spawn('npm run start:electron-app:once', [], {
|
||||
shell: true,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
};
|
||||
|
||||
startWatching = () => {
|
||||
chokidar
|
||||
.watch(this.watchPaths, {
|
||||
ignored: this.ignoredPaths,
|
||||
ignoreInitial: true,
|
||||
})
|
||||
.on('all', (event, path) => {
|
||||
this.reload();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
new ElectronForgeRunner();
|
||||
26
tsconfig.json
Normal file
26
tsconfig.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "es2020",
|
||||
"target": "es2015",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"outDir": ".dist",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"paths": {
|
||||
"*": ["node_modules/*"]
|
||||
},
|
||||
"types": [
|
||||
"node",
|
||||
"webdriverio/async",
|
||||
"@wdio/jasmine-framework",
|
||||
"expect-webdriverio"
|
||||
]
|
||||
},
|
||||
"include": ["workspaces/electron-app/**/*", "workspaces/electron-e2e/**/*"]
|
||||
}
|
||||
30
webpack.main.config.js
Normal file
30
webpack.main.config.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const path = require('path');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* This is the main entry point for your application, it's the first file
|
||||
* that runs in the main process.
|
||||
*/
|
||||
entry: './workspaces/electron-app/main/index.ts',
|
||||
// Put your normal webpack config below here
|
||||
module: {
|
||||
rules: require('./webpack.rules'),
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css', '.json'],
|
||||
modules: [path.resolve(__dirname, 'node_modules'), 'node_modules'],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'workspaces/electron-app/main/assets' },
|
||||
{
|
||||
from: 'workspaces/angular-app/.dist/angular-app',
|
||||
to: '../renderer/angular_window',
|
||||
noErrorOnMissing: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
};
|
||||
5
webpack.plugins.js
Normal file
5
webpack.plugins.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
module.exports = [
|
||||
new ForkTsCheckerWebpackPlugin()
|
||||
];
|
||||
19
webpack.renderer.config.js
Normal file
19
webpack.renderer.config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const path = require("path");
|
||||
const rules = require('./webpack.rules');
|
||||
const plugins = require('./webpack.plugins');
|
||||
|
||||
rules.push({
|
||||
test: /\.css$/,
|
||||
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }],
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
module: {
|
||||
rules,
|
||||
},
|
||||
plugins: plugins,
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'],
|
||||
modules: [path.resolve(__dirname, "node_modules"), "node_modules"]
|
||||
},
|
||||
};
|
||||
27
webpack.rules.js
Normal file
27
webpack.rules.js
Normal file
@@ -0,0 +1,27 @@
|
||||
module.exports = [
|
||||
// Add support for native node modules
|
||||
{
|
||||
test: /\.node$/,
|
||||
use: 'node-loader',
|
||||
},
|
||||
{
|
||||
test: /\.(m?js|node)$/,
|
||||
parser: { amd: false },
|
||||
use: {
|
||||
loader: '@vercel/webpack-asset-relocator-loader',
|
||||
options: {
|
||||
outputAssetBase: 'native_modules',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
exclude: /(node_modules|\.webpack)/,
|
||||
use: {
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true
|
||||
}
|
||||
}
|
||||
},
|
||||
];
|
||||
17
workspaces/angular-app/.browserslistrc
Normal file
17
workspaces/angular-app/.browserslistrc
Normal file
@@ -0,0 +1,17 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# For the full list of supported browsers by the Angular framework, please see:
|
||||
# https://angular.io/guide/browser-support
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
|
||||
last 1 Chrome version
|
||||
last 1 Firefox version
|
||||
last 2 Edge major versions
|
||||
last 2 Safari major versions
|
||||
last 2 iOS major versions
|
||||
Firefox ESR
|
||||
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
|
||||
46
workspaces/angular-app/.gitignore
vendored
Normal file
46
workspaces/angular-app/.gitignore
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/.dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
# Only exists if Bazel was run
|
||||
/bazel-out
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
# profiling files
|
||||
chrome-profiler-events*.json
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history/*
|
||||
|
||||
# misc
|
||||
/.angular/cache
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
27
workspaces/angular-app/README.md
Normal file
27
workspaces/angular-app/README.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# AngularApp
|
||||
|
||||
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.2.
|
||||
|
||||
## Development server
|
||||
|
||||
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
|
||||
|
||||
## Build
|
||||
|
||||
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
|
||||
|
||||
## Further help
|
||||
|
||||
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
||||
134
workspaces/angular-app/angular.json
Normal file
134
workspaces/angular-app/angular.json
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"angular-app": {
|
||||
"projectType": "application",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"style": "scss"
|
||||
},
|
||||
"@schematics/angular:application": {
|
||||
"strict": true
|
||||
}
|
||||
},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"outputPath": "./.dist/angular-app",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": ["src/favicon.ico", "src/assets"],
|
||||
"styles": ["src/styles.scss"],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kb",
|
||||
"maximumError": "1mb"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.production.ts"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"buildOptimizer": false,
|
||||
"optimization": false,
|
||||
"vendorChunk": true,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true,
|
||||
"namedChunks": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "angular-app:build:production"
|
||||
},
|
||||
"development": {
|
||||
"browserTarget": "angular-app:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "angular-app:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "src/test.ts",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"karmaConfig": "karma.conf.js",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": ["src/favicon.ico", "src/assets"],
|
||||
"styles": ["src/styles.scss"],
|
||||
"scripts": []
|
||||
}
|
||||
},
|
||||
"cypress-run": {
|
||||
"builder": "@cypress/schematic:cypress",
|
||||
"options": {
|
||||
"devServerTarget": "angular-app:serve"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "angular-app:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cypress-open": {
|
||||
"builder": "@cypress/schematic:cypress",
|
||||
"options": {
|
||||
"watch": true,
|
||||
"headless": false
|
||||
}
|
||||
},
|
||||
"e2e": {
|
||||
"builder": "@cypress/schematic:cypress",
|
||||
"options": {
|
||||
"devServerTarget": "angular-app:serve",
|
||||
"watch": true,
|
||||
"headless": false
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "angular-app:serve:production"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"cli": {
|
||||
"analytics": false
|
||||
}
|
||||
}
|
||||
18
workspaces/angular-app/cypress.config.ts
Normal file
18
workspaces/angular-app/cypress.config.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { defineConfig } from 'cypress';
|
||||
import configCypress from './cypress/plugins/index';
|
||||
|
||||
export default defineConfig({
|
||||
videosFolder: 'cypress/videos',
|
||||
screenshotsFolder: 'cypress/screenshots',
|
||||
fixturesFolder: 'cypress/fixtures',
|
||||
screenshotOnRunFailure: false,
|
||||
video: false,
|
||||
e2e: {
|
||||
// We've imported your old cypress plugins here.
|
||||
// You may want to clean this up later by importing these.
|
||||
setupNodeEvents(on, config) {
|
||||
return configCypress(on, config);
|
||||
},
|
||||
baseUrl: 'http://localhost:4200',
|
||||
},
|
||||
});
|
||||
7
workspaces/angular-app/cypress/e2e/spec.cy.ts
Normal file
7
workspaces/angular-app/cypress/e2e/spec.cy.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
describe('My First Test', () => {
|
||||
it('Visits the initial project page', () => {
|
||||
cy.visit('/');
|
||||
cy.contains('Welcome');
|
||||
cy.contains('electron-angular-quick-start app is running!');
|
||||
});
|
||||
});
|
||||
5
workspaces/angular-app/cypress/fixtures/example.json
Normal file
5
workspaces/angular-app/cypress/fixtures/example.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
8
workspaces/angular-app/cypress/plugins/index.ts
Normal file
8
workspaces/angular-app/cypress/plugins/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// Plugins enable you to tap into, modify, or extend the internal behavior of Cypress
|
||||
// For more info, visit https://on.cypress.io/plugins-api
|
||||
export default (
|
||||
_on: Cypress.PluginEvents,
|
||||
_config: Cypress.PluginConfigOptions
|
||||
): void => {
|
||||
// configure plugins here
|
||||
};
|
||||
37
workspaces/angular-app/cypress/support/commands.ts
Normal file
37
workspaces/angular-app/cypress/support/commands.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/// <reference types="cypress" />
|
||||
// ***********************************************
|
||||
// This example commands.ts shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
//
|
||||
// declare global {
|
||||
// namespace Cypress {
|
||||
// interface Chainable {
|
||||
// login(email: string, password: string): Chainable<void>
|
||||
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
||||
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
||||
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
22
workspaces/angular-app/cypress/support/e2e.ts
Normal file
22
workspaces/angular-app/cypress/support/e2e.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/* eslint-disable unicorn/prevent-abbreviations */
|
||||
|
||||
// ***********************************************************
|
||||
// This example support/e2e.ts is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
8
workspaces/angular-app/cypress/tsconfig.json
Normal file
8
workspaces/angular-app/cypress/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"include": ["**/*.ts"],
|
||||
"compilerOptions": {
|
||||
"sourceMap": false,
|
||||
"types": ["cypress"]
|
||||
}
|
||||
}
|
||||
44
workspaces/angular-app/karma.conf.js
Normal file
44
workspaces/angular-app/karma.conf.js
Normal file
@@ -0,0 +1,44 @@
|
||||
// Karma configuration file, see link for more information
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, './coverage/angular-app'),
|
||||
subdir: '.',
|
||||
reporters: [
|
||||
{ type: 'html' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['Chrome'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
};
|
||||
43
workspaces/angular-app/package.json
Normal file
43
workspaces/angular-app/package.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "angular-app",
|
||||
"version": "2.0.0",
|
||||
"scripts": {
|
||||
"start": "ng serve",
|
||||
"package": "ng build --configuration production --base-href ./",
|
||||
"e2e": "ng e2e",
|
||||
"cypress:open": "cypress open",
|
||||
"cypress:run": "cypress run"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^14.2.3",
|
||||
"@angular/common": "^14.2.3",
|
||||
"@angular/compiler": "^14.2.3",
|
||||
"@angular/core": "^14.2.3",
|
||||
"@angular/forms": "^14.2.3",
|
||||
"@angular/material": "^7.0.0",
|
||||
"@angular/platform-browser": "^14.2.3",
|
||||
"@angular/platform-browser-dynamic": "^14.2.3",
|
||||
"@angular/router": "^14.2.3",
|
||||
"@ngx-translate/core": "^14.0.0",
|
||||
"@ngx-translate/http-loader": "^7.0.0",
|
||||
"electron": "^20.2.0",
|
||||
"rxjs": "~7.5.6",
|
||||
"tslib": "^2.4.0",
|
||||
"zone.js": "~0.11.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^14.2.3",
|
||||
"@angular/cli": "^14.2.3",
|
||||
"@angular/compiler-cli": "^14.2.3",
|
||||
"@cypress/schematic": "^2.1.1",
|
||||
"@types/node": "^18.7.18",
|
||||
"cypress": "10.8.0",
|
||||
"karma": "~6.4.1",
|
||||
"karma-chrome-launcher": "~3.1.1",
|
||||
"karma-coverage": "~2.2.0",
|
||||
"karma-jasmine": "~5.1.0",
|
||||
"karma-jasmine-html-reporter": "~2.0.0",
|
||||
"typescript": "^4.8.3"
|
||||
}
|
||||
}
|
||||
16
workspaces/angular-app/src/app/app-routing.module.ts
Normal file
16
workspaces/angular-app/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { MultiplesComponent } from './components/multiples/multiples.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: MultiplesComponent,
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AppRoutingModule {}
|
||||
1
workspaces/angular-app/src/app/app.component.html
Normal file
1
workspaces/angular-app/src/app/app.component.html
Normal file
@@ -0,0 +1 @@
|
||||
<router-outlet></router-outlet>
|
||||
0
workspaces/angular-app/src/app/app.component.scss
Normal file
0
workspaces/angular-app/src/app/app.component.scss
Normal file
35
workspaces/angular-app/src/app/app.component.spec.ts
Normal file
35
workspaces/angular-app/src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'angular-app'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app.title).toEqual('angular-app');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('.content span')?.textContent).toContain('angular-app app is running!');
|
||||
});
|
||||
});
|
||||
10
workspaces/angular-app/src/app/app.component.ts
Normal file
10
workspaces/angular-app/src/app/app.component.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'PEVABO - Deuren';
|
||||
}
|
||||
30
workspaces/angular-app/src/app/app.module.ts
Normal file
30
workspaces/angular-app/src/app/app.module.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { MultiplesComponent } from './components/multiples/multiples.component';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent, MultiplesComponent],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
HttpClientModule,
|
||||
ReactiveFormsModule,
|
||||
MatSelectModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
BrowserAnimationsModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent],
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -0,0 +1,83 @@
|
||||
<mat-form-field appearance="fill" class="projects">
|
||||
<mat-label>Klantenbestand</mat-label>
|
||||
<mat-select [value]="project?.name" (selectionChange)="projectChange($event)">
|
||||
<mat-option *ngFor="let projectOption of projects" [value]="projectOption.name">
|
||||
{{ projectOption.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" class="doors">
|
||||
<mat-label>Deuren</mat-label>
|
||||
<mat-select [(value)]="door" [disabled]="!project" (selectionChange)="focus()">
|
||||
<mat-option *ngFor="let doorOption of doors" [value]="doorOption">
|
||||
{{ doorOption?.nr }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill" class="doors">
|
||||
<mat-label>Deuren</mat-label>
|
||||
<input
|
||||
matInput
|
||||
placeholder="Scanner"
|
||||
(input)="textInput($event)"
|
||||
[disabled]="!project"
|
||||
id="textsearch"
|
||||
/>
|
||||
</mat-form-field>
|
||||
|
||||
<button
|
||||
mat-raised-button
|
||||
color="primary"
|
||||
class="print-button"
|
||||
(click)="printLabel()"
|
||||
[disabled]="!door"
|
||||
>
|
||||
Print
|
||||
</button>
|
||||
|
||||
<div *ngIf="door?.nr" class="door">
|
||||
<div class="specs">
|
||||
<p class="property">Deurnummer</p>
|
||||
<p class="value">
|
||||
{{ door?.nr }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">L/R</p>
|
||||
<p class="value">
|
||||
{{ door?.lr }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">KRUK/SLOT</p>
|
||||
<p class="value">
|
||||
{{ door?.krukSlot }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">SCHARNIER</p>
|
||||
<p class="value">
|
||||
{{ door?.pivot }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">Soort Deur</p>
|
||||
<p class="value">
|
||||
{{ door?.type }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">Model Kruk</p>
|
||||
<p class="value">
|
||||
{{ door?.modelKruk }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="specs">
|
||||
<p class="property">Opmerkingen</p>
|
||||
<p class="value">
|
||||
{{ door?.remark }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
.doors {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
.specs {
|
||||
flex-direction: column;
|
||||
flex: 1 1 0;
|
||||
|
||||
p {
|
||||
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.door {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.print-button {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
|
||||
@media print {
|
||||
mat-form-field {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.door {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.specs {
|
||||
flex-direction: row;
|
||||
|
||||
p {
|
||||
display: inline-block;
|
||||
width: 220px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WindowApiConst, Door } from 'shared-lib';
|
||||
import { ElectronIpcService } from '../../services/electron-ipc.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-multiples',
|
||||
templateUrl: './multiples.component.html',
|
||||
styleUrls: ['./multiples.component.scss'],
|
||||
})
|
||||
export class MultiplesComponent implements OnInit {
|
||||
public projects: any[] = [];
|
||||
public project: {name: string|undefined, path: string|undefined} | undefined = undefined;
|
||||
public doors: Door[] = [];
|
||||
public door: Door | undefined = undefined;
|
||||
public Object = Object;
|
||||
|
||||
constructor(private electronIpc: ElectronIpcService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
// Specifying what to do with received data from main process
|
||||
this.electronIpc.receive<string[][]>(
|
||||
WindowApiConst.FILELIST_OUTPUT,
|
||||
(output: any[]) => {
|
||||
this.projects = output;
|
||||
}
|
||||
);
|
||||
|
||||
this.electronIpc.receive<[]>(
|
||||
WindowApiConst.PROJECT_OUTPUT,
|
||||
(output: Door[]) => {
|
||||
// Update current data
|
||||
this.doors = output;
|
||||
this.focus();
|
||||
}
|
||||
);
|
||||
|
||||
this.electronIpc.receive<void>(WindowApiConst.PRINT_OUTPUT, () => {
|
||||
this.focus();
|
||||
});
|
||||
|
||||
this.refreshProjects();
|
||||
}
|
||||
|
||||
refreshProjects(): void {
|
||||
this.electronIpc.send(WindowApiConst.FILELIST_INPUT, 'refresh');
|
||||
}
|
||||
|
||||
projectChange(event: any): void {
|
||||
this.door = undefined;
|
||||
this.project = this.projects.find(x => x.name === event.value);
|
||||
this.electronIpc.send(WindowApiConst.PROJECT_INPUT, this.project);
|
||||
}
|
||||
|
||||
textInput(event: any): void {
|
||||
const searchValue = event?.target?.value;
|
||||
const door: Door | undefined =
|
||||
this.doors.find((x) => x.nr === searchValue) || undefined;
|
||||
|
||||
if (door) {
|
||||
this.door = door;
|
||||
event.target.value = '';
|
||||
this.printLabel();
|
||||
}
|
||||
}
|
||||
|
||||
printLabel(): void {
|
||||
this.electronIpc.send(WindowApiConst.PRINT_INPUT, {});
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
setTimeout(() => {
|
||||
// eslint-disable-next-line unicorn/prefer-query-selector
|
||||
const input = document.getElementById('textsearch');
|
||||
|
||||
(input as any).value = "";
|
||||
input?.focus();
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ElectronIpcService } from './electron-ipc.service';
|
||||
|
||||
describe('ElectronIpcService', () => {
|
||||
let service: ElectronIpcService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ElectronIpcService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Injectable, NgZone } from '@angular/core';
|
||||
import { WindowApi } from 'shared-lib';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ElectronIpcService {
|
||||
private _api!: WindowApi;
|
||||
|
||||
constructor(private zone: NgZone) {
|
||||
if (window && (window as Window).api) {
|
||||
this._api = (window as Window).api;
|
||||
console.log('Preloader API has been loaded successfully');
|
||||
} else {
|
||||
console.warn('Preloader API is not loaded');
|
||||
}
|
||||
}
|
||||
|
||||
public receive<Out>(channel: string, callback: (output: Out) => void): void {
|
||||
if (this._api) {
|
||||
this._api.receive<Out>(channel, (output) => {
|
||||
console.log(`Received from main process channel [${channel}]`, output);
|
||||
|
||||
// Next code might run outside of Angular zone and therefore Angular
|
||||
// doesn't recognize it needs to run change detection
|
||||
// Further details on SO : https://stackoverflow.com/a/49136353/11480016
|
||||
this.zone.run(() => {
|
||||
callback(output);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public send<In>(channel: string, input: In): void {
|
||||
if (this._api) {
|
||||
console.log(`Sending to main process channel [${channel}]`, input);
|
||||
this._api.send<In>(channel, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
0
workspaces/angular-app/src/assets/.gitkeep
Normal file
0
workspaces/angular-app/src/assets/.gitkeep
Normal file
6
workspaces/angular-app/src/assets/i18n/en.json
Normal file
6
workspaces/angular-app/src/assets/i18n/en.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"MULTIPLES": {
|
||||
"TITLE": "Times table",
|
||||
"SUBMIT": "SUBMIT"
|
||||
}
|
||||
}
|
||||
6
workspaces/angular-app/src/assets/i18n/fr.json
Normal file
6
workspaces/angular-app/src/assets/i18n/fr.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"MULTIPLES": {
|
||||
"TITLE": "Table de multiplication",
|
||||
"SUBMIT": "SOUMETTRE"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
};
|
||||
16
workspaces/angular-app/src/environments/environment.ts
Normal file
16
workspaces/angular-app/src/environments/environment.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.production.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
BIN
workspaces/angular-app/src/favicon.ico
Normal file
BIN
workspaces/angular-app/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
14
workspaces/angular-app/src/index.html
Normal file
14
workspaces/angular-app/src/index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>ElectronAngularQuickStart</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!--<meta http-equiv="Content-Security-Policy" content="script-src 'self'" />-->
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
14
workspaces/angular-app/src/main.ts
Normal file
14
workspaces/angular-app/src/main.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic()
|
||||
.bootstrapModule(AppModule)
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
.catch((error) => console.error(error));
|
||||
52
workspaces/angular-app/src/polyfills.ts
Normal file
52
workspaces/angular-app/src/polyfills.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/guide/browser-support
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default, zone.js will patch all possible macroTask and DomEvents
|
||||
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
||||
* because those flags need to be set before `zone.js` being loaded, and webpack
|
||||
* will put import in the top of bundle, so user need to create a separate file
|
||||
* in this directory (for example: zone-flags.ts), and put the following flags
|
||||
* into that file, and then add the following code before importing zone.js.
|
||||
* import './zone-flags';
|
||||
*
|
||||
* The flags allowed in zone-flags.ts are listed here.
|
||||
*
|
||||
* The following flags will work for all browsers.
|
||||
*
|
||||
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
||||
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
||||
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
||||
*
|
||||
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
||||
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
||||
*
|
||||
* (window as any).__Zone_enable_cross_context_check = true;
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by default for Angular itself.
|
||||
*/
|
||||
import 'zone.js'; // Included with Angular CLI.
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
11
workspaces/angular-app/src/styles.scss
Normal file
11
workspaces/angular-app/src/styles.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
|
||||
|
||||
@media print {
|
||||
html {
|
||||
height: 530px;
|
||||
width: 460px;
|
||||
overflow: hidden;
|
||||
zoom: 0.25;
|
||||
}
|
||||
}
|
||||
34
workspaces/angular-app/src/test.ts
Normal file
34
workspaces/angular-app/src/test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting,
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import 'zone.js/testing';
|
||||
|
||||
declare const require: {
|
||||
context(
|
||||
path: string,
|
||||
deep?: boolean,
|
||||
filter?: RegExp
|
||||
): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(),
|
||||
{
|
||||
teardown: { destroyAfterEach: false },
|
||||
}
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
for (const key of context.keys()) {
|
||||
context(key);
|
||||
}
|
||||
15
workspaces/angular-app/tsconfig.app.json
Normal file
15
workspaces/angular-app/tsconfig.app.json
Normal file
@@ -0,0 +1,15 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"src/main.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
28
workspaces/angular-app/tsconfig.json
Normal file
28
workspaces/angular-app/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./.dist/out-tsc",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2020",
|
||||
"module": "es2020",
|
||||
"lib": ["es2018", "dom"]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true,
|
||||
"strictTemplates": true
|
||||
},
|
||||
"references": [{ "path": "../shared-lib" }]
|
||||
}
|
||||
18
workspaces/angular-app/tsconfig.spec.json
Normal file
18
workspaces/angular-app/tsconfig.spec.json
Normal file
@@ -0,0 +1,18 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts",
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
29
workspaces/electron-app/main/assets/config.json
Normal file
29
workspaces/electron-app/main/assets/config.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"development": {
|
||||
"configId": "development",
|
||||
"mainLogFile": "dist/dev-main.log",
|
||||
"mainLogLevel": "debug",
|
||||
"isIconAvailable": true,
|
||||
"isNodeIntegration": false,
|
||||
"isContextIsolation": true,
|
||||
"isEnableRemoteModule": false,
|
||||
"isOpenDevTools": true
|
||||
},
|
||||
"e2e-test": {
|
||||
"configId": "e2e-test",
|
||||
"mainLogFile": "dist/e2e-main.log",
|
||||
"mainLogLevel": "error",
|
||||
"isIconAvailable": true,
|
||||
"isNodeIntegration": true,
|
||||
"isContextIsolation": false,
|
||||
"isEnableRemoteModule": true,
|
||||
"isOpenDevTools": false
|
||||
},
|
||||
"production": {
|
||||
"configId": "production",
|
||||
"mainLogFile": "main.log",
|
||||
"mainLogLevel": "error",
|
||||
"isIconAvailable": false,
|
||||
"isOpenDevTools": false
|
||||
}
|
||||
}
|
||||
BIN
workspaces/electron-app/main/assets/icons/icon.icns
Normal file
BIN
workspaces/electron-app/main/assets/icons/icon.icns
Normal file
Binary file not shown.
BIN
workspaces/electron-app/main/assets/icons/icon.ico
Normal file
BIN
workspaces/electron-app/main/assets/icons/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 353 KiB |
BIN
workspaces/electron-app/main/assets/icons/icon.png
Normal file
BIN
workspaces/electron-app/main/assets/icons/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 231 KiB |
65
workspaces/electron-app/main/components/app.ts
Normal file
65
workspaces/electron-app/main/components/app.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { app, BrowserWindow, shell } from 'electron';
|
||||
import { Window } from './window';
|
||||
|
||||
declare const global: Global;
|
||||
|
||||
export class App {
|
||||
private static _wrapper: Window;
|
||||
|
||||
public static launch(): void {
|
||||
app.on('window-all-closed', App.quit);
|
||||
app.on('activate', App.start);
|
||||
app.on('ready', App.start);
|
||||
|
||||
// Limit navigation and open external links in default browser
|
||||
app.on('web-contents-created', App.openExternalLinksInDefaultBrowser);
|
||||
}
|
||||
|
||||
public static get electronWindow(): BrowserWindow | undefined {
|
||||
return this._wrapper ? this._wrapper.electronWindow : undefined;
|
||||
}
|
||||
|
||||
private static start() {
|
||||
// On MacOS it is common to re-create a window from app even after all windows have been closed
|
||||
if (!App.electronWindow) {
|
||||
App._wrapper = new Window();
|
||||
}
|
||||
}
|
||||
|
||||
private static quit() {
|
||||
// On MacOS it is common for applications to stay open until the user explicitly quits
|
||||
// But WebDriverIO Test Runner does handle that behaviour yet
|
||||
if (
|
||||
process.platform !== 'darwin' ||
|
||||
global.appConfig.configId === 'e2e-test'
|
||||
) {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
private static openExternalLinksInDefaultBrowser = (
|
||||
event: Electron.Event,
|
||||
contents: Electron.WebContents
|
||||
) => {
|
||||
// Disabling creation of new windows
|
||||
contents.setWindowOpenHandler((handler: Electron.HandlerDetails) => {
|
||||
// Telling the user platform to open this event's url in the default browser
|
||||
shell.openExternal(handler.url);
|
||||
|
||||
// Blocking this event from loading in current app
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
// Limiting navigation
|
||||
contents.on(
|
||||
'will-navigate',
|
||||
(event: Electron.Event, navigationUrl: string) => {
|
||||
const parsedUrl = new URL(navigationUrl);
|
||||
// Allowing local navigation only
|
||||
if (parsedUrl.origin !== 'http://localhost:4200') {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
147
workspaces/electron-app/main/components/window.ts
Normal file
147
workspaces/electron-app/main/components/window.ts
Normal file
@@ -0,0 +1,147 @@
|
||||
import { Door } from 'shared-lib';
|
||||
import * as remoteMain from '@electron/remote/main';
|
||||
import { app, BrowserWindow, ipcMain, nativeImage } from 'electron';
|
||||
import * as path from 'node:path';
|
||||
import { AbstractService } from '../services/abstract-service';
|
||||
import { FileListService } from '../services/file-list-service';
|
||||
import { PrintService } from './../services/print-service';
|
||||
import { Logger } from '../utils/logger';
|
||||
import { DoorService } from '../services/door-service';
|
||||
import { readFile } from 'node:fs';
|
||||
|
||||
declare const global: Global;
|
||||
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
|
||||
|
||||
export class Window {
|
||||
private _electronWindow: BrowserWindow | undefined;
|
||||
private _printService: PrintService;
|
||||
|
||||
constructor() {
|
||||
this.createWindow();
|
||||
this.loadRenderer();
|
||||
|
||||
const fileListService = new FileListService();
|
||||
this.registerService<void, any[]>(fileListService);
|
||||
const doorService = new DoorService();
|
||||
this.registerService<any, Door[]>(doorService);
|
||||
|
||||
readFile('./config.json', 'utf8', (error, data) => {
|
||||
if(error){
|
||||
console.log(error);
|
||||
return;
|
||||
}
|
||||
const config = JSON.parse(data);
|
||||
fileListService.setPaths(config.filePaths);
|
||||
doorService.setMapping(config.mapping);
|
||||
});
|
||||
}
|
||||
|
||||
private createWindow(): void {
|
||||
this._electronWindow = new BrowserWindow({
|
||||
fullscreen: false,
|
||||
backgroundColor: '#FFFFFF',
|
||||
icon: this.loadIcon(),
|
||||
webPreferences: {
|
||||
// Default behavior in Electron since 5, that
|
||||
// limits the powers granted to remote content
|
||||
// except in e2e test when those powers are required
|
||||
nodeIntegration: global.appConfig.isNodeIntegration,
|
||||
// Isolate window context to protect against prototype pollution
|
||||
// except in e2e test when that access is required
|
||||
contextIsolation: global.appConfig.isContextIsolation,
|
||||
// Introduced in Electron 20 and enabled by default
|
||||
// Among others security constraints, it prevents from required
|
||||
// CommonJS modules imports into preload script
|
||||
// which is not bundled yet in dev mode
|
||||
sandbox: global.appConfig.isSandbox,
|
||||
// Use a preload script to enhance security
|
||||
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
|
||||
},
|
||||
});
|
||||
|
||||
this._printService = new PrintService();
|
||||
this._printService.setWindow(this._electronWindow);
|
||||
this.registerService<string, void>(this._printService);
|
||||
|
||||
// Disable the remote module to enhance security
|
||||
// except in e2e test when that access is required
|
||||
if (global.appConfig.isEnableRemoteModule) {
|
||||
remoteMain.enable(this._electronWindow.webContents);
|
||||
}
|
||||
}
|
||||
|
||||
private loadIcon(): Electron.NativeImage | undefined {
|
||||
let iconObject;
|
||||
if (global.appConfig.isIconAvailable) {
|
||||
const iconPath = path.join(__dirname, 'icons/icon.png');
|
||||
Logger.debug('Icon Path', iconPath);
|
||||
iconObject = nativeImage.createFromPath(iconPath);
|
||||
// Change dock icon on MacOS
|
||||
if (iconObject && process.platform === 'darwin') {
|
||||
app.dock.setIcon(iconObject);
|
||||
}
|
||||
}
|
||||
return iconObject;
|
||||
}
|
||||
|
||||
private loadRenderer(): void {
|
||||
if (global.appConfig.configId === 'development') {
|
||||
// Dev mode, take advantage of the live reload by loading local URL
|
||||
this.electronWindow.loadURL(`http://localhost:4200`);
|
||||
} else {
|
||||
// Else mode, we simply load angular bundle
|
||||
const indexPath = path.join(
|
||||
__dirname,
|
||||
'../renderer/angular_window/index.html'
|
||||
);
|
||||
this.electronWindow.loadURL(`file://${indexPath}`);
|
||||
}
|
||||
|
||||
if (global.appConfig.isOpenDevTools) {
|
||||
this.openDevTools();
|
||||
}
|
||||
|
||||
// When the window is closed`
|
||||
this._electronWindow.on('closed', () => {
|
||||
// Remove IPC Main listeners
|
||||
ipcMain.removeAllListeners();
|
||||
// Delete current reference
|
||||
delete this._electronWindow;
|
||||
});
|
||||
}
|
||||
|
||||
private openDevTools(): void {
|
||||
this._electronWindow.webContents.openDevTools();
|
||||
this._electronWindow.webContents.on('devtools-opened', () => {
|
||||
this._electronWindow.focus();
|
||||
setImmediate(() => {
|
||||
this._electronWindow.focus();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private registerService<In, Out>(service: AbstractService<In, Out>) {
|
||||
ipcMain.on(
|
||||
service.receptionChannel(),
|
||||
async (event: Electron.IpcMainEvent, ...parameters: any[]) => {
|
||||
// Handling input
|
||||
const input = parameters[0];
|
||||
Logger.debug(`[${service.receptionChannel()}] =====> `, input);
|
||||
service.process(input).then((output: Out) => {
|
||||
// Handling output
|
||||
if (service.sendingChannel()) {
|
||||
Logger.debug(`[${service.sendingChannel()}] =====> `, output);
|
||||
this._electronWindow.webContents.send(
|
||||
service.sendingChannel(),
|
||||
output
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public get electronWindow(): BrowserWindow | undefined {
|
||||
return this._electronWindow;
|
||||
}
|
||||
}
|
||||
27
workspaces/electron-app/main/index.ts
Normal file
27
workspaces/electron-app/main/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as fs from 'fs-extra';
|
||||
import _ from 'lodash';
|
||||
import * as path from 'node:path';
|
||||
import { AppConfig } from 'shared-lib';
|
||||
import { App } from './components/app';
|
||||
|
||||
declare const global: Global;
|
||||
|
||||
declare global {
|
||||
// Global augmentation of the `Global` interface
|
||||
interface Global {
|
||||
appConfig: AppConfig;
|
||||
}
|
||||
}
|
||||
|
||||
// Load config
|
||||
const currentEnvironment = process.env.X_NODE_ENV || process.env.NODE_ENV;
|
||||
const appConfigs = fs.readJsonSync(path.join(__dirname, 'config.json'));
|
||||
const defaultConfig = appConfigs.development;
|
||||
const currentConfig = appConfigs[currentEnvironment];
|
||||
global.appConfig =
|
||||
currentEnvironment === 'development'
|
||||
? defaultConfig
|
||||
: _.merge(defaultConfig, currentConfig);
|
||||
|
||||
// Launch app
|
||||
App.launch();
|
||||
14
workspaces/electron-app/main/services/abstract-service.ts
Normal file
14
workspaces/electron-app/main/services/abstract-service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
const NOT_IMPEMENTED_YET = 'Method not implemented yet.';
|
||||
export class AbstractService<In, Out> {
|
||||
receptionChannel(): string {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
|
||||
sendingChannel(): string {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
|
||||
process(_input: In): Promise<Out> {
|
||||
throw new Error(NOT_IMPEMENTED_YET);
|
||||
}
|
||||
}
|
||||
67
workspaces/electron-app/main/services/door-service.ts
Normal file
67
workspaces/electron-app/main/services/door-service.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { WindowApiConst, Door } from 'shared-lib';
|
||||
import { AbstractService } from './abstract-service';
|
||||
import { readFile, set_fs } from 'xlsx';
|
||||
import * as fs from 'node:fs';
|
||||
set_fs(fs);
|
||||
|
||||
export class DoorService extends AbstractService<any, Door[]> {
|
||||
receptionChannel(): string {
|
||||
return WindowApiConst.PROJECT_INPUT;
|
||||
}
|
||||
|
||||
sendingChannel(): string {
|
||||
return WindowApiConst.PROJECT_OUTPUT;
|
||||
}
|
||||
private _mapping: any = {};
|
||||
|
||||
public setMapping(mapping: any): void {
|
||||
this._mapping = mapping;
|
||||
}
|
||||
|
||||
process(input: {name: string, path: string}): Promise<Door[]> {
|
||||
return new Promise((resolve) => {
|
||||
const workbook = readFile(`${input.path}/${input.name}`);
|
||||
const workingSheet = workbook.Sheets['DEURLIJST'];
|
||||
const doorList: Door[] = [];
|
||||
|
||||
|
||||
const headers: any = {};
|
||||
// get header values
|
||||
for (let index = 65; index <= 90; index++) {
|
||||
const currentValue = workingSheet[`${String.fromCodePoint(index)}3`]?.v;
|
||||
|
||||
for (const [key, value] of Object.entries(this._mapping)) {
|
||||
if ((value as string[]).find((x: string) => x.includes(currentValue)) != undefined) {
|
||||
this.setObjectWithChar(headers, key, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get max records
|
||||
const maxRecords = Number.parseInt(workingSheet['!ref'].split(':')[1].replace(/[A-Z]*/g, ''));
|
||||
|
||||
// stop at 19
|
||||
|
||||
for (let index = 4; index < maxRecords; index++) {
|
||||
const door: Door = {};
|
||||
door.nr = workingSheet[`A${index}`]?.v;
|
||||
if (door.nr) {
|
||||
door.lr = workingSheet[`${headers['lr']}${index}`]?.v;
|
||||
door.krukSlot = workingSheet[`${headers['krukSlot']}${index}`]?.v;
|
||||
door.pivot = workingSheet[`${headers['pivot']}${index}`]?.v;
|
||||
door.type = workingSheet[`${headers['type']}${index}`]?.v;
|
||||
door.modelKruk = workingSheet[`${headers['modelKruk']}${index}`]?.v;
|
||||
door.remark = workingSheet[`${headers['remark']}${index}`]?.v;
|
||||
|
||||
doorList.push(door);
|
||||
}
|
||||
}
|
||||
|
||||
resolve(doorList);
|
||||
});
|
||||
}
|
||||
|
||||
private setObjectWithChar(object: any, key: string, value: number) {
|
||||
object[key] = String.fromCodePoint(value);
|
||||
}
|
||||
}
|
||||
55
workspaces/electron-app/main/services/file-list-service.ts
Normal file
55
workspaces/electron-app/main/services/file-list-service.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { readdir } from 'node:fs';
|
||||
import { WindowApiConst } from 'shared-lib';
|
||||
import { AbstractService } from './abstract-service';
|
||||
|
||||
export class FileListService extends AbstractService<void, any[]> {
|
||||
private _paths: string[] = ['./assets'];
|
||||
|
||||
receptionChannel(): string {
|
||||
return WindowApiConst.FILELIST_INPUT;
|
||||
}
|
||||
|
||||
sendingChannel(): string {
|
||||
return WindowApiConst.FILELIST_OUTPUT;
|
||||
}
|
||||
|
||||
process(): Promise<any[]> {
|
||||
return new Promise((resolve) => {
|
||||
const projects: any[] = [];
|
||||
Promise.all(this._paths.map((path) => this.readPath(path))).then((result: any) => {
|
||||
for (const entry of result.entries()) {
|
||||
for (const file of entry[1].result) {
|
||||
projects.push({
|
||||
path: entry[1].path,
|
||||
name: file,
|
||||
});
|
||||
}
|
||||
}
|
||||
resolve(projects);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private readPath(path: string): Promise<any> {
|
||||
return new Promise((resolve) => {
|
||||
readdir(path, (error, fileList: string[]) => {
|
||||
if (!error) {
|
||||
const newList: string[] = [];
|
||||
for (const file of fileList) {
|
||||
newList.push(file);
|
||||
}
|
||||
return resolve({
|
||||
path,
|
||||
result: newList,
|
||||
});
|
||||
}
|
||||
|
||||
return {};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public setPaths(inputPaths: string[]) {
|
||||
this._paths = inputPaths;
|
||||
}
|
||||
}
|
||||
27
workspaces/electron-app/main/services/print-service.ts
Normal file
27
workspaces/electron-app/main/services/print-service.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { BrowserWindow } from 'electron';
|
||||
import { WindowApiConst } from 'shared-lib';
|
||||
import { AbstractService } from './abstract-service';
|
||||
|
||||
export class PrintService extends AbstractService<string, void> {
|
||||
private _browserWindow: BrowserWindow;
|
||||
sendingChannel(): string {
|
||||
return WindowApiConst.PRINT_OUTPUT;
|
||||
}
|
||||
|
||||
receptionChannel(): string {
|
||||
return WindowApiConst.PRINT_INPUT;
|
||||
}
|
||||
|
||||
process(): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (this._browserWindow) {
|
||||
this._browserWindow.webContents.print({ silent: false });
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
public setWindow(window: BrowserWindow): void {
|
||||
this._browserWindow = window;
|
||||
}
|
||||
}
|
||||
143
workspaces/electron-app/main/utils/logger.ts
Normal file
143
workspaces/electron-app/main/utils/logger.ts
Normal file
@@ -0,0 +1,143 @@
|
||||
import { app } from 'electron';
|
||||
import * as os from 'node:os';
|
||||
import * as path from 'node:path';
|
||||
import * as winston from 'winston';
|
||||
|
||||
declare const global: Global;
|
||||
|
||||
export class Logger {
|
||||
private static singleton: Logger;
|
||||
private _logger: winston.Logger;
|
||||
|
||||
public static error(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.error(message, meta);
|
||||
}
|
||||
|
||||
public static warn(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.warn(message, meta);
|
||||
}
|
||||
|
||||
public static info(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.info(message, meta);
|
||||
}
|
||||
|
||||
public static http(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.http(message, meta);
|
||||
}
|
||||
|
||||
public static verbose(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.verbose(message, meta);
|
||||
}
|
||||
|
||||
public static debug(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.debug(message, meta);
|
||||
}
|
||||
|
||||
public static silly(message: string, ...meta: any[]): void {
|
||||
Logger.initSingleton();
|
||||
Logger.singleton._logger.silly(message, meta);
|
||||
}
|
||||
|
||||
private static initSingleton(): void {
|
||||
if (!Logger.singleton) {
|
||||
Logger.singleton = new Logger();
|
||||
}
|
||||
}
|
||||
|
||||
private constructor() {
|
||||
this._logger = winston.createLogger({
|
||||
level: 'debug',
|
||||
format: winston.format.json(),
|
||||
defaultMeta: { service: 'user-service' },
|
||||
transports: [
|
||||
new winston.transports.File({
|
||||
filename: this.getLogFilename(),
|
||||
level: global.appConfig.mainLogLevel,
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
this.fileFormat
|
||||
),
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
// If we're not in production then log also to the `console` with the format:
|
||||
// `${info.timestamp} ${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
||||
if (global.appConfig.configId === 'development') {
|
||||
this._logger.add(
|
||||
new winston.transports.Console({
|
||||
stderrLevels: ['error', 'warn'],
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
this.consoleFormat
|
||||
),
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns log filename with standard path
|
||||
* In production, returns absolute standard path depending on platform
|
||||
*/
|
||||
private getLogFilename() {
|
||||
let filename = global.appConfig.mainLogFile;
|
||||
if (global.appConfig.configId === 'production') {
|
||||
const appName = app.getName();
|
||||
if (process.platform == 'linux') {
|
||||
filename = `.config/${appName}/${filename}`;
|
||||
} else if (process.platform == 'darwin') {
|
||||
filename = `Library/Logs/${appName}/${filename}`;
|
||||
} else if (process.platform == 'win32') {
|
||||
filename = `AppData\\Roaming\\${appName}\\${filename}`;
|
||||
}
|
||||
}
|
||||
return path.join(os.homedir(), filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom winston file format
|
||||
* Write JSON logs with given format :
|
||||
* `${timestamp} ${level} : ${info.message} : ${meta})`
|
||||
*/
|
||||
private fileFormat = winston.format.printf(
|
||||
(data: winston.Logform.TransformableInfo) => {
|
||||
return JSON.stringify(this.prepareLogData(data));
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Custom winston console format
|
||||
* Write logs with given format :
|
||||
* `${timestamp} ${level} : ${info.message} : JSON.stringify({ ...meta }) `
|
||||
*/
|
||||
private consoleFormat = winston.format.printf(
|
||||
(data: winston.Logform.TransformableInfo) => {
|
||||
const preparedData = this.prepareLogData(data);
|
||||
return (
|
||||
`${preparedData.timestamp} ${preparedData.level} : ` +
|
||||
`${preparedData.message} : ${JSON.stringify(preparedData.meta)}`
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
private prepareLogData = (data: winston.Logform.TransformableInfo) => {
|
||||
const additionalData = { ...data };
|
||||
delete additionalData.timestamp;
|
||||
delete additionalData.level;
|
||||
delete additionalData.message;
|
||||
delete additionalData.service;
|
||||
return {
|
||||
timestamp: data.timestamp,
|
||||
level: data.level,
|
||||
message: data.message,
|
||||
meta: additionalData,
|
||||
};
|
||||
};
|
||||
}
|
||||
3
workspaces/electron-app/renderer/README.md
Normal file
3
workspaces/electron-app/renderer/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
preload.ts is the only file that matters in this directory.
|
||||
|
||||
The others files are not needed at all, but they are required for electron forge webpack config.
|
||||
6
workspaces/electron-app/renderer/index.css
Normal file
6
workspaces/electron-app/renderer/index.css
Normal file
@@ -0,0 +1,6 @@
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
margin: auto;
|
||||
max-width: 38rem;
|
||||
padding: 2rem;
|
||||
}
|
||||
12
workspaces/electron-app/renderer/index.html
Normal file
12
workspaces/electron-app/renderer/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1>💖 Hello World!</h1>
|
||||
<p>Welcome to your Electron application.</p>
|
||||
</body>
|
||||
</html>
|
||||
31
workspaces/electron-app/renderer/index.ts
Normal file
31
workspaces/electron-app/renderer/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* This file will automatically be loaded by webpack and run in the "renderer" context.
|
||||
* To learn more about the differences between the "main" and the "renderer" context in
|
||||
* Electron, visit:
|
||||
*
|
||||
* https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
|
||||
*
|
||||
* By default, Node.js integration in this file is disabled. When enabling Node.js integration
|
||||
* in a renderer process, please be aware of potential security implications. You can read
|
||||
* more about security risks here:
|
||||
*
|
||||
* https://electronjs.org/docs/tutorial/security
|
||||
*
|
||||
* To enable Node.js integration in this file, open up `main.js` and enable the `nodeIntegration`
|
||||
* flag:
|
||||
*
|
||||
* ```
|
||||
* // Create the browser window.
|
||||
* mainWindow = new BrowserWindow({
|
||||
* width: 800,
|
||||
* height: 600,
|
||||
* webPreferences: {
|
||||
* nodeIntegration: true
|
||||
* }
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
import './index.css';
|
||||
|
||||
console.log('👋 This message is being logged by "renderer.js", included via webpack');
|
||||
57
workspaces/electron-app/renderer/preload.ts
Normal file
57
workspaces/electron-app/renderer/preload.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
/*/ To secure user platform when running renderer process stuff,
|
||||
// Node.JS and Electron APIs are only available in this script
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
||||
import { WindowApi, WindowApiConst } from 'shared-lib';
|
||||
|
||||
// So we expose protected methods that allow the renderer process
|
||||
// to use the ipcRenderer without exposing the entire object
|
||||
const windowApi: WindowApi = {
|
||||
send: <In>(channel: string, input: In) => {
|
||||
if (WindowApiConst.SENDING_SAFE_CHANNELS.includes(channel)) {
|
||||
ipcRenderer.send(channel, input);
|
||||
}
|
||||
},
|
||||
receive: <Out>(channel: string, callback: (output: Out) => void) => {
|
||||
if (WindowApiConst.RECEIVING_SAFE_CHANNELS.includes(channel)) {
|
||||
// Deliberately strip event as it includes `sender`
|
||||
ipcRenderer.on(
|
||||
channel,
|
||||
(_event: IpcRendererEvent, ...parameters: any[]) =>
|
||||
callback(parameters[0])
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
declare const window: Window;
|
||||
if (process.env.X_NODE_ENV === 'e2e-test') {
|
||||
// Injecting windowApi directly
|
||||
window.api = windowApi;
|
||||
} else {
|
||||
// ContextBridge API can only be used when contextIsolation is enabled
|
||||
// which is normally the case except in e2e test mode
|
||||
contextBridge.exposeInMainWorld('api', windowApi);
|
||||
}*/
|
||||
|
||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
||||
import { WindowApiConst } from 'shared-lib';
|
||||
|
||||
contextBridge.exposeInMainWorld('api', {
|
||||
node: () => process.versions.node,
|
||||
chrome: () => process.versions.chrome,
|
||||
electron: () => process.versions.electron,
|
||||
send: <In>(channel: string, input: In) => {
|
||||
if (WindowApiConst.SENDING_SAFE_CHANNELS.includes(channel)) {
|
||||
ipcRenderer.send(channel, input);
|
||||
}
|
||||
},
|
||||
receive: <Out>(channel: string, callback: (output: Out) => void) => {
|
||||
// Deliberately strip event as it includes `sender`
|
||||
ipcRenderer.on(channel, (_event: IpcRendererEvent, ...parameters: any[]) =>
|
||||
callback(parameters[0])
|
||||
);
|
||||
},
|
||||
// we can also expose variables, not just functions
|
||||
});
|
||||
|
||||
console.log('The preload script has been injected successfully.');
|
||||
4
workspaces/electron-app/tsconfig.json
Normal file
4
workspaces/electron-app/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"references": [{ "path": "../shared-lib" }]
|
||||
}
|
||||
46
workspaces/electron-e2e/app.spec.ts
Normal file
46
workspaces/electron-e2e/app.spec.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/*import MainPage from './pageobjects/main.page';
|
||||
|
||||
describe('My Login application', () => {
|
||||
it('should login with valid credentials', async () => {
|
||||
await MainPage.open();
|
||||
/*await LoginPage.open();
|
||||
|
||||
await LoginPage.login('tomsmith', 'SuperSecretPassword!');
|
||||
await expect(SecurePage.flashAlert).toBeExisting();
|
||||
await expect(SecurePage.flashAlert).toHaveTextContaining(
|
||||
'You logged into a secure area!');* /
|
||||
});
|
||||
});* /
|
||||
|
||||
describe('application loading', () => {
|
||||
describe('App', () => {
|
||||
it('should launch the application', async () => {
|
||||
|
||||
console.log('==>', await browser.getTitle());
|
||||
// expect(title).toEqual('Test');
|
||||
});
|
||||
|
||||
// it('should pass args through to the launched application', async () => {
|
||||
// // custom args are set in the wdio.conf.js file as they need to be set before WDIO starts
|
||||
// const argv = await app.mainProcess.argv();
|
||||
// expect(argv).toContain('--foo');
|
||||
// expect(argv).toContain('--bar=baz');
|
||||
// });
|
||||
});
|
||||
}); */
|
||||
|
||||
describe('A simple test to check if app window is opened, visible and with expected title', () => {
|
||||
describe('App should', () => {
|
||||
it('show an initial window', async () => {
|
||||
// Checking there is one visible window
|
||||
// expect(await browser.).toEqual(true);
|
||||
// Please note that getWindowHandles() will return 2 if `dev tools` is opened.
|
||||
const { length } = await browser.getWindowHandles();
|
||||
expect(length).toEqual(1);
|
||||
});
|
||||
|
||||
it('have expected title', async () => {
|
||||
expect(await browser.getTitle()).toEqual('ElectronAngularQuickStart');
|
||||
});
|
||||
});
|
||||
});
|
||||
20
workspaces/electron-e2e/multiples.spec.ts
Normal file
20
workspaces/electron-e2e/multiples.spec.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import MultiplesPage from './pageobjects/multiples.page';
|
||||
|
||||
describe('A simple test to check if a given input matches with computed multiples', () => {
|
||||
describe('Multiples component should', () => {
|
||||
it('show up on startup', async () => {
|
||||
await expect(MultiplesPage.root).toBeDisplayed();
|
||||
});
|
||||
|
||||
const number = Math.floor(Math.random() * 100) % 10;
|
||||
it(`display expected results on input (${number})`, async () => {
|
||||
await MultiplesPage.enterInput(number);
|
||||
const results = await MultiplesPage.results;
|
||||
for (const index of results.keys()) {
|
||||
const ntimes = 1 + index;
|
||||
const expected = `${number} * ${ntimes} = ${number * ntimes}`;
|
||||
expect(await results[index].getText()).toEqual(expected);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
32
workspaces/electron-e2e/pageobjects/multiples.page.ts
Normal file
32
workspaces/electron-e2e/pageobjects/multiples.page.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import AbstractPage from './page';
|
||||
|
||||
class MultiplesPage extends AbstractPage {
|
||||
/**
|
||||
* Selectors using getter methods
|
||||
*/
|
||||
public get root() {
|
||||
return $('#multiples');
|
||||
}
|
||||
|
||||
public get input() {
|
||||
return $('#input');
|
||||
}
|
||||
|
||||
public get results() {
|
||||
return $$('.results');
|
||||
}
|
||||
|
||||
public get buttonSubmit() {
|
||||
return $('button[type="submit"]');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method to interact with the page
|
||||
*/
|
||||
public async enterInput(number: number) {
|
||||
await this.input.setValue(number);
|
||||
await this.buttonSubmit.click();
|
||||
}
|
||||
}
|
||||
|
||||
export default new MultiplesPage();
|
||||
7
workspaces/electron-e2e/pageobjects/page.ts
Normal file
7
workspaces/electron-e2e/pageobjects/page.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Abstract page object containing all methods, selectors and functionality
|
||||
* that is shared across all page objects
|
||||
*/
|
||||
export default abstract class AbstractPage {
|
||||
// Not implemented yet
|
||||
}
|
||||
15
workspaces/electron-e2e/tsconfig.json
Normal file
15
workspaces/electron-e2e/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./.dist",
|
||||
"module": "commonjs",
|
||||
"target": "es2020",
|
||||
"noEmit": true,
|
||||
"types": [
|
||||
"node",
|
||||
"webdriverio/async",
|
||||
"@wdio/jasmine-framework",
|
||||
"expect-webdriverio"
|
||||
]
|
||||
}
|
||||
}
|
||||
360
workspaces/electron-e2e/webdriverio.config.ts
Normal file
360
workspaces/electron-e2e/webdriverio.config.ts
Normal file
@@ -0,0 +1,360 @@
|
||||
import type { Options } from '@wdio/types';
|
||||
import path from 'node:path';
|
||||
|
||||
// Path to local electron binary
|
||||
let electronPath = path.join(__dirname, '../../node_modules/.bin/electron');
|
||||
if (process.platform === 'win32') {
|
||||
electronPath += '.cmd';
|
||||
}
|
||||
|
||||
// Starting hook
|
||||
const waitUntilWindowLoaded = async () => {
|
||||
const timeout = 10_000;
|
||||
await browser.waitUntil(async () => (await browser.isLoading()) === false, {
|
||||
timeout: timeout,
|
||||
timeoutMsg: `Expected app to be loaded in less than ${timeout}ms`,
|
||||
});
|
||||
};
|
||||
|
||||
// Closing hook
|
||||
const closeApplication = async () => {
|
||||
if (browser) {
|
||||
// Wait 1 second and close window
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await browser.closeWindow();
|
||||
}
|
||||
};
|
||||
|
||||
export const config: Options.Testrunner = {
|
||||
//
|
||||
// ====================
|
||||
// Runner Configuration
|
||||
// ====================
|
||||
//
|
||||
//
|
||||
// =====================
|
||||
// ts-node Configurations
|
||||
// =====================
|
||||
//
|
||||
// You can write tests using TypeScript to get autocompletion and type safety.
|
||||
// You will need typescript and ts-node installed as devDependencies.
|
||||
// WebdriverIO will automatically detect if these dependencies are installed
|
||||
// and will compile your config and tests for you.
|
||||
// If you need to configure how ts-node runs please use the
|
||||
// environment variables for ts-node or use wdio config's autoCompileOpts section.
|
||||
//
|
||||
|
||||
autoCompileOpts: {
|
||||
autoCompile: true,
|
||||
// see https://github.com/TypeStrong/ts-node#cli-and-programmatic-options
|
||||
// for all available options
|
||||
tsNodeOpts: {
|
||||
transpileOnly: true,
|
||||
project: 'workspaces/electron-e2e/tsconfig.json',
|
||||
},
|
||||
// tsconfig-paths is only used if "tsConfigPathsOpts" are provided, if you
|
||||
// do please make sure "tsconfig-paths" is installed as dependency
|
||||
// tsConfigPathsOpts: {
|
||||
// baseUrl: './'
|
||||
// }
|
||||
},
|
||||
//
|
||||
// ==================
|
||||
// Specify Test Files
|
||||
// ==================
|
||||
// Define which test specs should run. The pattern is relative to the directory
|
||||
// from which `wdio` was called.
|
||||
//
|
||||
// The specs are defined as an array of spec files (optionally using wildcards
|
||||
// that will be expanded). The test for each spec file will be run in a separate
|
||||
// worker process. In order to have a group of spec files run in the same worker
|
||||
// process simply enclose them in an array within the specs array.
|
||||
//
|
||||
// If you are calling `wdio` from an NPM script (see https://docs.npmjs.com/cli/run-script),
|
||||
// then the current working directory is where your `package.json` resides, so `wdio`
|
||||
// will be called from there.
|
||||
//
|
||||
specs: ['./workspaces/electron-e2e/**/*.spec.ts'],
|
||||
// Patterns to exclude.
|
||||
exclude: [
|
||||
// 'path/to/excluded/files'
|
||||
],
|
||||
//
|
||||
// ============
|
||||
// Capabilities
|
||||
// ============
|
||||
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
|
||||
// time. Depending on the number of capabilities, WebdriverIO launches several test
|
||||
// sessions. Within your capabilities you can overwrite the spec and exclude options in
|
||||
// order to group specific specs to a specific capability.
|
||||
//
|
||||
// First, you can define how many instances should be started at the same time. Let's
|
||||
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
|
||||
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
|
||||
// files and you set maxInstances to 10, all spec files will get tested at the same time
|
||||
// and 30 processes will get spawned. The property handles how many capabilities
|
||||
// from the same test should run tests.
|
||||
//
|
||||
maxInstances: 10,
|
||||
//
|
||||
// If you have trouble getting all important capabilities together, check out the
|
||||
// Sauce Labs platform configurator - a great tool to configure your capabilities:
|
||||
// https://saucelabs.com/platform/platform-configurator
|
||||
//
|
||||
capabilities: [
|
||||
{
|
||||
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
||||
// grid with only 5 firefox instances available you can make sure that not more than
|
||||
// 5 instances get started at a time.
|
||||
maxInstances: 5,
|
||||
//
|
||||
browserName: 'chrome',
|
||||
acceptInsecureCerts: true,
|
||||
'goog:chromeOptions': {
|
||||
binary: electronPath,
|
||||
args: ['app=' + '.webpack/main/index.js'],
|
||||
},
|
||||
// If outputDir is provided WebdriverIO can capture driver session logs
|
||||
// it is possible to configure which logTypes to include/exclude.
|
||||
// excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
|
||||
// excludeDriverLogs: ['bugreport', 'server'],
|
||||
},
|
||||
],
|
||||
//
|
||||
// ===================
|
||||
// Test Configurations
|
||||
// ===================
|
||||
// Define all options that are relevant for the WebdriverIO instance here
|
||||
//
|
||||
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
||||
logLevel: 'info',
|
||||
//
|
||||
// Set specific log levels per logger
|
||||
// loggers:
|
||||
// - webdriver, webdriverio
|
||||
// - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
|
||||
// - @wdio/mocha-framework, @wdio/jasmine-framework
|
||||
// - @wdio/local-runner
|
||||
// - @wdio/sumologic-reporter
|
||||
// - @wdio/cli, @wdio/config, @wdio/utils
|
||||
// Level of logging verbosity: trace | debug | info | warn | error | silent
|
||||
// logLevels: {
|
||||
// webdriver: 'info',
|
||||
// '@wdio/appium-service': 'info'
|
||||
// },
|
||||
//
|
||||
// If you only want to run your tests until a specific amount of tests have failed use
|
||||
// bail (default is 0 - don't bail, run all tests).
|
||||
bail: 0,
|
||||
//
|
||||
// Set a base URL in order to shorten url command calls. If your `url` parameter starts
|
||||
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
||||
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
||||
// gets prepended directly.
|
||||
baseUrl: 'http://localhost',
|
||||
//
|
||||
// Default timeout for all waitFor* commands.
|
||||
waitforTimeout: 10_000,
|
||||
//
|
||||
// Default timeout in milliseconds for request
|
||||
// if browser driver or grid doesn't send response
|
||||
connectionRetryTimeout: 120_000,
|
||||
//
|
||||
// Default request retries count
|
||||
connectionRetryCount: 3,
|
||||
//
|
||||
// Test runner services
|
||||
// Services take over a specific job you don't want to take care of. They enhance
|
||||
// your test setup with almost no effort. Unlike plugins, they don't add new
|
||||
// commands. Instead, they hook themselves up into the test process.
|
||||
services: ['chromedriver'],
|
||||
|
||||
// Framework you want to run your specs with.
|
||||
// The following are supported: Mocha, Jasmine, and Cucumber
|
||||
// see also: https://webdriver.io/docs/frameworks
|
||||
//
|
||||
// Make sure you have the wdio adapter package for the specific framework installed
|
||||
// before running any tests.
|
||||
framework: 'jasmine',
|
||||
//
|
||||
// The number of times to retry the entire specfile when it fails as a whole
|
||||
// specFileRetries: 1,
|
||||
//
|
||||
// Delay in seconds between the spec file retry attempts
|
||||
// specFileRetriesDelay: 0,
|
||||
//
|
||||
// Whether or not retried specfiles should be retried immediately or deferred to the end of the queue
|
||||
// specFileRetriesDeferred: false,
|
||||
//
|
||||
// Test reporter for stdout.
|
||||
// The only one supported by default is 'dot'
|
||||
// see also: https://webdriver.io/docs/dot-reporter
|
||||
reporters: ['spec', ['allure', { outputDir: 'allure-results' }]],
|
||||
|
||||
//
|
||||
// Options to be passed to Jasmine.
|
||||
jasmineOpts: {
|
||||
// Jasmine default timeout
|
||||
defaultTimeoutInterval: 60_000,
|
||||
//
|
||||
// The Jasmine framework allows interception of each assertion in order to log the state of the application
|
||||
// or website depending on the result. For example, it is pretty handy to take a screenshot every time
|
||||
// an assertion fails.
|
||||
expectationResultHandler: function (_passed: boolean, _assertion) {
|
||||
// do something
|
||||
},
|
||||
},
|
||||
|
||||
//
|
||||
// =====
|
||||
// Hooks
|
||||
// =====
|
||||
// WebdriverIO provides several hooks you can use to interfere with the test process in order to enhance
|
||||
// it and to build services around it. You can either apply a single function or an array of
|
||||
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
|
||||
// resolved to continue.
|
||||
/**
|
||||
* Gets executed once before all workers get launched.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
*/
|
||||
// onPrepare: function (config, capabilities) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed before a worker process is spawned and can be used to initialise specific service
|
||||
* for that worker as well as modify runtime environments in an async fashion.
|
||||
* @param {String} cid capability id (e.g 0-0)
|
||||
* @param {[type]} caps object containing capabilities for session that will be spawn in the worker
|
||||
* @param {[type]} specs specs to be run in the worker process
|
||||
* @param {[type]} args object that will be merged with the main configuration once worker is initialized
|
||||
* @param {[type]} execArgv list of string arguments passed to the worker process
|
||||
*/
|
||||
// onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed just after a worker process has exited.
|
||||
* @param {String} cid capability id (e.g 0-0)
|
||||
* @param {Number} exitCode 0 - success, 1 - fail
|
||||
* @param {[type]} specs specs to be run in the worker process
|
||||
* @param {Number} retries number of retries used
|
||||
*/
|
||||
// onWorkerEnd: function (cid, exitCode, specs, retries) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
||||
* to manipulate configurations depending on the capability or spec.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that are to be run
|
||||
* @param {String} cid worker id (e.g. 0-0)
|
||||
*/
|
||||
// beforeSession: function (config, capabilities, specs, cid) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed before test execution begins. At this point you can access to all global
|
||||
* variables like `browser`. It is the perfect place to define custom commands.
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that are to be run
|
||||
* @param {Object} browser instance of created browser/device session
|
||||
*/
|
||||
// before: function (capabilities, specs) {
|
||||
// },
|
||||
/**
|
||||
* Runs before a WebdriverIO command gets executed.
|
||||
* @param {String} commandName hook command name
|
||||
* @param {Array} args arguments that command would receive
|
||||
*/
|
||||
// beforeCommand: function (commandName, args) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed before the suite starts
|
||||
* @param {Object} suite suite details
|
||||
*/
|
||||
beforeSuite: async (_suite) => {
|
||||
await waitUntilWindowLoaded();
|
||||
},
|
||||
/**
|
||||
* Function to be executed before a test (in Mocha/Jasmine) starts.
|
||||
*/
|
||||
// beforeTest: function (test, context) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed _before_ a hook within the suite starts (e.g. runs before calling
|
||||
* beforeEach in Mocha)
|
||||
*/
|
||||
// beforeHook: function (test, context) {
|
||||
// },
|
||||
/**
|
||||
* Hook that gets executed _after_ a hook within the suite starts (e.g. runs after calling
|
||||
* afterEach in Mocha)
|
||||
*/
|
||||
// afterHook: function (test, context, { error, result, duration, passed, retries }) {
|
||||
// },
|
||||
/**
|
||||
* Function to be executed after a test (in Mocha/Jasmine only)
|
||||
* @param {Object} test test object
|
||||
* @param {Object} context scope object the test was executed with
|
||||
* @param {Error} result.error error object in case the test fails, otherwise `undefined`
|
||||
* @param {Any} result.result return object of test function
|
||||
* @param {Number} result.duration duration of test
|
||||
* @param {Boolean} result.passed true if test has passed, otherwise false
|
||||
* @param {Object} result.retries informations to spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
||||
*/
|
||||
afterTest: async function (_test, _context, result) {
|
||||
// result = { _error, _result, _duration, passed, _retries }
|
||||
if (!result.passed) {
|
||||
await browser.takeScreenshot();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Hook that gets executed after the suite has ended
|
||||
* @param {Object} suite suite details
|
||||
*/
|
||||
// afterSuite: async function (_suite) {
|
||||
// },
|
||||
/**
|
||||
* Runs after a WebdriverIO command gets executed
|
||||
* @param {String} commandName hook command name
|
||||
* @param {Array} args arguments that command would receive
|
||||
* @param {Number} result 0 - command success, 1 - command error
|
||||
* @param {Object} error error object if any
|
||||
*/
|
||||
// afterCommand: function (commandName, args, result, error) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed after all tests are done. You still have access to all global variables from
|
||||
* the test.
|
||||
* @param {Number} result 0 - test pass, 1 - test fail
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that ran
|
||||
*/
|
||||
after: async (_result, _capabilities, _specs) => {
|
||||
await closeApplication();
|
||||
},
|
||||
/**
|
||||
* Gets executed right after terminating the webdriver session.
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {Array.<String>} specs List of spec file paths that ran
|
||||
*/
|
||||
// afterSession: function (config, capabilities, specs) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed after all workers got shut down and the process is about to exit. An error
|
||||
* thrown in the onComplete hook will result in the test run failing.
|
||||
* @param {Object} exitCode 0 - success, 1 - fail
|
||||
* @param {Object} config wdio configuration object
|
||||
* @param {Array.<Object>} capabilities list of capabilities details
|
||||
* @param {<Object>} results object containing test results
|
||||
*/
|
||||
// onComplete: function(_exitCode, _config, _capabilities, _results) {
|
||||
// },
|
||||
/**
|
||||
* Gets executed when a refresh happens.
|
||||
* @param {String} oldSessionId session ID of the old session
|
||||
* @param {String} newSessionId session ID of the new session
|
||||
*/
|
||||
// onReload: function(oldSessionId, newSessionId) {
|
||||
// }
|
||||
};
|
||||
2
workspaces/shared-lib/.gitignore
vendored
Normal file
2
workspaces/shared-lib/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Generated JS files
|
||||
/.dist
|
||||
24
workspaces/shared-lib/apis/window-api-consts.ts
Normal file
24
workspaces/shared-lib/apis/window-api-consts.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export class WindowApiConst {
|
||||
public static readonly FILELIST_INPUT = 'getFileListInput';
|
||||
public static readonly FILELIST_OUTPUT = 'getFileListOutput';
|
||||
|
||||
public static readonly PROJECT_INPUT = 'getProjectInput';
|
||||
public static readonly PROJECT_OUTPUT = 'getProjectOutput';
|
||||
|
||||
public static readonly PRINT_OUTPUT = 'getPrintOutput';
|
||||
public static readonly PRINT_INPUT = 'getPrintInput';
|
||||
|
||||
/** Whitelist of the safe channels to use when sending data to the main process */
|
||||
public static readonly SENDING_SAFE_CHANNELS = [
|
||||
WindowApiConst.FILELIST_INPUT,
|
||||
WindowApiConst.PROJECT_INPUT,
|
||||
WindowApiConst.PRINT_INPUT,
|
||||
];
|
||||
|
||||
/** Whitelist of the safe channels to use when receiving data from the main process */
|
||||
public static readonly RECEIVING_SAFE_CHANNELS = [
|
||||
WindowApiConst.FILELIST_OUTPUT,
|
||||
WindowApiConst.PROJECT_OUTPUT,
|
||||
WindowApiConst.PROJECT_OUTPUT,
|
||||
];
|
||||
}
|
||||
15
workspaces/shared-lib/apis/window-api.ts
Normal file
15
workspaces/shared-lib/apis/window-api.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export interface WindowApi {
|
||||
/**
|
||||
* This method is used by the renderer process to receive data from the main process
|
||||
* @param channel used by the renderer to receive data and by the main to send them
|
||||
* @param func the callback function to execute when data are available
|
||||
*/
|
||||
receive<Out>(channel: string, callback: (output: Out) => void): void;
|
||||
|
||||
/**
|
||||
* This method is used by the renderer process to send data to the main process
|
||||
* @param channel used by the renderer to send data and by the main to receive them
|
||||
* @param data the data sent by the renderer process to the main process
|
||||
*/
|
||||
send<In>(channel: string, input: In): void;
|
||||
}
|
||||
12
workspaces/shared-lib/index.ts
Normal file
12
workspaces/shared-lib/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { WindowApi } from './apis/window-api';
|
||||
export * from './apis/window-api';
|
||||
export * from './apis/window-api-consts';
|
||||
export * from './models/config/app-config';
|
||||
export * from './models/door';
|
||||
|
||||
declare global {
|
||||
// Global augmentation of the `Window` interface
|
||||
interface Window {
|
||||
api: WindowApi;
|
||||
}
|
||||
}
|
||||
28
workspaces/shared-lib/models/config/app-config.ts
Normal file
28
workspaces/shared-lib/models/config/app-config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
export interface AppConfig {
|
||||
/** The configuration identifier */
|
||||
configId: string;
|
||||
|
||||
/** The main logger output file path */
|
||||
mainLogFile: string;
|
||||
|
||||
/** The main logger output level */
|
||||
mainLogLevel: string;
|
||||
|
||||
/** Tells if we should try to load app icon */
|
||||
isIconAvailable: boolean;
|
||||
|
||||
/** Tells if `nodeIntegration` webPreference is enabled */
|
||||
isNodeIntegration: boolean;
|
||||
|
||||
/** Tells if `contextIsolation` and `worldSafeExecuteJavaScript` webPreferences are enabled */
|
||||
isContextIsolation: boolean;
|
||||
|
||||
/** Tells if `isSandbox` webPreference is enabled */
|
||||
isSandbox: boolean;
|
||||
|
||||
/** Tells if `isEnableRemoteModule` webPreference is enabled */
|
||||
isEnableRemoteModule: boolean;
|
||||
|
||||
/** Tells if we should open dev tools */
|
||||
isOpenDevTools: boolean;
|
||||
}
|
||||
9
workspaces/shared-lib/models/door.ts
Normal file
9
workspaces/shared-lib/models/door.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export interface Door {
|
||||
nr?: string;
|
||||
lr?: string;
|
||||
pivot?: string;
|
||||
type?: string;
|
||||
remark?: string;
|
||||
modelKruk?: string;
|
||||
krukSlot?: string;
|
||||
}
|
||||
8
workspaces/shared-lib/package.json
Normal file
8
workspaces/shared-lib/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "shared-lib",
|
||||
"version": "2.0.0",
|
||||
"main": ".dist/index.js",
|
||||
"scripts": {},
|
||||
"author": "Sourcygen",
|
||||
"license": "MIT"
|
||||
}
|
||||
10
workspaces/shared-lib/tsconfig.json
Normal file
10
workspaces/shared-lib/tsconfig.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"sourceMap": true,
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"outDir": "./.dist"
|
||||
},
|
||||
"include": ["./**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user