Compare commits

..

25 Commits

Author SHA1 Message Date
b33beeb669 feat: date-fns 2023-09-27 16:24:38 +02:00
d2d577c012 feat: date-fns 2023-09-27 15:53:13 +02:00
fe517fb4aa refactor: remove search page inheritance from food data list 2023-09-27 14:15:13 +02:00
9e26fa7a1a refactor: replace moment.js with date-fns 2023-09-27 14:13:53 +02:00
38fb7a398d fix: long branch names prevent review deployment 2023-09-21 09:55:35 +02:00
a99e08cd68 refactor: change opening hours handling
fix: opening hours not updating
feat: lazy-load opening hours module
feat: add e2e tests for opening hours
refactor: migrate opening hours to on-push change detection
feat: show exact minutes in opening hours starting one hour before next change
2023-09-21 09:55:35 +02:00
a5c9d22016 feat: add external directions referral
feat: change map page
feat: add error handling and timeout to location fetching in directions

resolves #124
resolves #122
2023-09-15 18:52:28 +00:00
3c49c4cf6d fix: route stack service causes needless network traffic 2023-09-06 15:29:47 +02:00
f2c4ee308f feat: share loaded data to detail views across routes 2023-09-06 14:52:02 +02:00
bd09b36620 refactor: use observable chains in rating component 2023-08-29 10:20:35 +00:00
ca146b7761 refactor: separate dashboard schedule nav e2e tests 2023-08-28 13:48:34 +02:00
Thea Schöbl
001f978bf9 feat: cleanup profile page 2023-08-25 14:43:25 +00:00
Thea Schöbl
57a5b6061b fix: type errors in easy-ast when generating docs 2023-08-23 08:45:47 +00:00
Rainer Killinger
4fb5941c56 ci: prepare e2e jobs for non nonexistent cache 2023-08-22 17:09:14 +02:00
Rainer Killinger
314e6a6e86 ci: move most pipelines to GitLab OSS large runner 2023-08-08 17:31:14 +02:00
Thea Schöbl
e1cc33bba2 refactor: rename "recurring" to "week overview"
refactor: replace dashboard calendar icon
resolves #128

refactor: route dashboard "next unit" to date series instead of events
resolves #126
2023-08-07 15:51:23 +00:00
Rainer Killinger
9abd397578 refactor: update changelog
ci: publish release
2023-08-03 16:30:40 +02:00
Rainer Killinger
69fe8c6ac8 ci: polish publishing via ci pipelines 2023-08-03 16:30:35 +02:00
Thea Schöbl
cbc59795b7 feat: connection timeout 2023-08-02 17:59:51 +02:00
Thea Schöbl
945ae039eb feat: nix flake for development 2023-08-02 17:59:51 +02:00
Thea Schöbl
06f3120345 feat: use takeUntilDestroy instead of manually unsubscribing 2023-08-02 17:59:21 +02:00
Thea Schöbl
bebee6b4d0 feat: migrate app collection helpers to use the collecion-utils package 2023-08-02 17:59:21 +02:00
2f59ab9707 fix: parallax replacer might fail to find shadow root on its first try 2023-08-02 17:59:20 +02:00
Thea Schöbl
23481d0d73 feat: upgrade to Angular 16.1 2023-08-02 17:59:20 +02:00
Rainer Killinger
df37c6c185 refactor: remove app release template from monorepo 2023-08-02 17:58:20 +02:00
371 changed files with 5909 additions and 8195 deletions

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': major
---
Update to Angular 16.1

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Detail views now won't load data again if it is being navigated to from a list item

View File

@@ -0,0 +1,11 @@
---
'@openstapps/app': patch
---
Refactored Opening Hours
- Migrated Opening Hours to use OnPush change detection
- Fixed a bug where opening hours would not update correctly
- Lazy-load opening hours module to keep it out of the main bundle
- Added e2e tests to verify functionality
- Changed live update status to show exact minutes starting one hour before the next change

View File

@@ -5,7 +5,7 @@
"fixed": [], "fixed": [],
"linked": [["@openstapps/*"]], "linked": [["@openstapps/*"]],
"access": "restricted", "access": "restricted",
"baseBranch": "master", "baseBranch": "develop",
"updateInternalDependencies": "patch", "updateInternalDependencies": "patch",
"ignore": [] "ignore": []
} }

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Use observable chains instead of change detection in the rating component

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Added the ability to remove and add date series from their detail page

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Add a way to hide action chips on list items

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Add directions to inPlace and place list items

View File

@@ -0,0 +1,9 @@
---
'@openstapps/app': minor
---
Improved calendar descriptions
- The dashboard quick link now has a more intuitive icon
- "Recurring" has been renamed to "Week Overview"
- Long words in calendar tabs will now break instead of overflowing

View File

@@ -14,7 +14,6 @@
"@openstapps/minimal-deployment": "2.0.0", "@openstapps/minimal-deployment": "2.0.0",
"@openstapps/minimal-plugin": "2.0.0", "@openstapps/minimal-plugin": "2.0.0",
"@openstapps/app": "2.0.0", "@openstapps/app": "2.0.0",
"@openstapps/app-release-template": "2.0.0",
"@openstapps/api": "2.0.0", "@openstapps/api": "2.0.0",
"@openstapps/api-cli": "2.0.0", "@openstapps/api-cli": "2.0.0",
"@openstapps/api-plugin": "2.0.0", "@openstapps/api-plugin": "2.0.0",
@@ -24,9 +23,13 @@
"@openstapps/easy-ast": "2.0.0", "@openstapps/easy-ast": "2.0.0",
"@openstapps/es-mapping-generator": "2.0.0", "@openstapps/es-mapping-generator": "2.0.0",
"@openstapps/gitlab-api": "2.0.0", "@openstapps/gitlab-api": "2.0.0",
"@openstapps/logger": "2.0.0" "@openstapps/logger": "2.0.0",
"@openstapps/app-builder-image": "3.0.0-next.3",
"@openstapps/node-base": "3.0.0-next.3",
"@openstapps/node-builder": "3.0.0-next.3"
}, },
"changesets": [ "changesets": [
"bright-dryers-act",
"cool-jars-kiss", "cool-jars-kiss",
"cuddly-bobcats-roll", "cuddly-bobcats-roll",
"dull-news-appear", "dull-news-appear",
@@ -40,9 +43,14 @@
"moody-parrots-develop", "moody-parrots-develop",
"neat-hats-trade", "neat-hats-trade",
"new-pianos-joke", "new-pianos-joke",
"pretty-timers-complain",
"proud-wolves-end", "proud-wolves-end",
"quick-houses-count", "quick-houses-count",
"rare-squids-bake", "rare-squids-bake",
"serious-meals-sin",
"silent-maps-float",
"silly-news-punch",
"smart-ghosts-shout",
"soft-donuts-fail", "soft-donuts-fail",
"sour-coins-visit", "sour-coins-visit",
"spicy-snails-sort", "spicy-snails-sort",
@@ -51,6 +59,7 @@
"tall-ducks-dream", "tall-ducks-dream",
"tame-mayflies-hug", "tame-mayflies-hug",
"tame-rings-dream", "tame-rings-dream",
"tasty-islands-smell",
"thick-weeks-compete", "thick-weeks-compete",
"thin-camels-give", "thin-camels-give",
"tidy-buses-reflect", "tidy-buses-reflect",

View File

@@ -0,0 +1,13 @@
---
'@openstapps/app': minor
---
Revamp "My Courses" section on profile page
The "My Courses" section on the profile page has been improved
- It will now show the upcoming courses for the next five days
- The section header is now consistent with the other sections
- The section now uses standard list items instead of the custom solution
Additionally, the profile page component has been cleaned up.

View File

@@ -0,0 +1,8 @@
---
'@openstapps/app': minor
---
Adjust map button and item behavior on different screen sizes
- Small screens will show the item without margins below the map actions
- Large screens will show the list item on the left side

View File

@@ -0,0 +1,29 @@
---
'@openstapps/projectmanagement': patch
'@openstapps/prettier-config': patch
'@openstapps/es-mapping-generator': patch
'@openstapps/backend-config': patch
'@openstapps/eslint-config': patch
'@openstapps/minimal-deployment': patch
'@openstapps/minimal-connector': patch
'@openstapps/collection-utils': patch
'@openstapps/minimal-plugin': patch
'@openstapps/tsconfig': patch
'@openstapps/node-builder': patch
'@openstapps/api-plugin': patch
'@openstapps/core-tools': patch
'@openstapps/gitlab-api': patch
'@openstapps/app-builder-image': patch
'@openstapps/easy-ast': patch
'@openstapps/database': patch
'@openstapps/node-base': patch
'@openstapps/api-cli': patch
'@openstapps/backend': patch
'@openstapps/logger': patch
'@openstapps/proxy': patch
'@openstapps/core': patch
'@openstapps/app': patch
'@openstapps/api': patch
---
Update to TypeScript 5.1.6

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Migrate collection helpers to use @openstapps/collection-utils

View File

@@ -0,0 +1,8 @@
---
'@openstapps/app': minor
---
Migrate to Ionic 7
- Migrate uses of `<ion-label>` with inputs to new syntax
- Fix infinite loop in schedule date picker (`datetime.confirm()` to `datetime.cancel()`)

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': patch
---
Fixed an issue that caused double and triple loading of data detail items through the route stack service

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Map items are now native list items

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Replaced simple links with list items in date-series detail

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Use event title for date series instead of the generic date series title

View File

@@ -0,0 +1,5 @@
---
'@openstapps/app': minor
---
Replace moment.js with date-fns

5
.gitignore vendored
View File

@@ -19,6 +19,11 @@ www/
coverage.xml coverage.xml
report-junit.xml report-junit.xml
.deploy/ .deploy/
.venv/
# NixOS flake
result
hsperfdata_root
# Directory for instrumented libs generated by jscoverage/JSCover # Directory for instrumented libs generated by jscoverage/JSCover
lib-cov lib-cov

View File

@@ -7,14 +7,18 @@
# ``` # ```
# To your pipeline. # To your pipeline.
# https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs # https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#use-rules-to-add-jobs
.limit_pipelines:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop'
when: on_success
- when: never
include: include:
- local: /backend/backend/.gitlab-ci.yml - local: /backend/backend/.gitlab-ci.yml
- local: /frontend/app/.gitlab-ci.yml - local: /frontend/app/.gitlab-ci.yml
- local: /.gitlab/schedules.gitlab-ci.yml - local: /.gitlab/schedules.gitlab-ci.yml
- local: /.gitlab/publishing.gitlab-ci.yml - local: /.gitlab/publishing.gitlab-ci.yml
rules:
- if: '$CI_COMMIT_MESSAGE =~ /ci: publish release$/'
when: always
variables: variables:
TURBO_CACHE_BYPASS: TURBO_CACHE_BYPASS:
@@ -28,7 +32,7 @@ variables:
default: default:
image: registry.gitlab.com/openstapps/openstapps/node-builder image: registry.gitlab.com/openstapps/openstapps/node-builder
tags: tags:
- performance - saas-linux-xlarge-amd64
interruptible: true interruptible: true
before_script: before_script:
- corepack enable - corepack enable
@@ -76,13 +80,14 @@ build:
rules: &deploy-rules rules: &deploy-rules
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
variables: variables:
DEPLOY_ID: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME DEPLOY_ID: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_BRANCH == 'main' - if: $CI_COMMIT_BRANCH == 'main'
variables: variables:
DEPLOY_ID: production DEPLOY_ID: production
- if: $CI_COMMIT_BRANCH == 'develop' - if: $CI_COMMIT_BRANCH == 'develop'
variables: variables:
DEPLOY_ID: staging DEPLOY_ID: staging
- !reference [.limit_pipelines, rules]
stop review: stop review:
stage: build stage: build
@@ -121,15 +126,15 @@ unit:
coverage_format: cobertura coverage_format: cobertura
path: coverage.xml path: coverage.xml
rules: rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop' - !reference [.limit_pipelines, rules]
audit: audit:
stage: audit stage: audit
allow_failure: true
needs: [] needs: []
script: script:
- pnpm audit --prod - pnpm audit --prod
rules: rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'develop'
allow_failure: true
- if: $CI_COMMIT_BRANCH == 'main' - if: $CI_COMMIT_BRANCH == 'main'
allow_failure: false allow_failure: false
- !reference [.limit_pipelines, rules]

View File

@@ -1,6 +1,6 @@
.limit_publishing: .limit_publish_pipelines:
- if: $CI_PIPELINE_SOURCE != "schedule" rules:
when: on_success - if: '($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop") && $CI_COMMIT_MESSAGE =~ /ci: publish release/ && $CI_PIPELINE_SOURCE != "schedule"'
deploy: deploy:
stage: publish stage: publish
@@ -12,7 +12,8 @@ deploy:
paths: paths:
- ./.deploy - ./.deploy
- ./frontend/app/www - ./frontend/app/www
rules: !reference [.limit_publishing] rules:
- !reference [.limit_publish_pipelines, rules]
publish image: publish image:
stage: publish stage: publish
@@ -23,14 +24,15 @@ publish image:
image: image:
name: gcr.io/kaniko-project/executor:v1.12.1-debug name: gcr.io/kaniko-project/executor:v1.12.1-debug
entrypoint: [""] entrypoint: [""]
variables:
PUBLISH_TAG: next
script: script:
- > - >
/kaniko/executor /kaniko/executor
--context "${CI_PROJECT_DIR}/${DEPLOY_DIR}" --context "${CI_PROJECT_DIR}/${DEPLOY_DIR}"
--dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile" --dockerfile "${CI_PROJECT_DIR}/${DEPLOY_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)" --destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
--destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" --destination "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:${PUBLISH_TAG}"
rules: !reference [.limit_publishing]
parallel: parallel:
matrix: matrix:
- IMAGE_NAME: database - IMAGE_NAME: database
@@ -47,6 +49,11 @@ publish image:
DEPLOY_DIR: .deploy/minimal-plugin DEPLOY_DIR: .deploy/minimal-plugin
- IMAGE_NAME: app - IMAGE_NAME: app
DEPLOY_DIR: frontend/app DEPLOY_DIR: frontend/app
rules:
- if: $CI_COMMIT_BRANCH == 'main'
variables:
PUBLISH_TAG: latest
- !reference [.limit_publish_pipelines, rules]
publish packages: publish packages:
stage: publish stage: publish
@@ -54,18 +61,17 @@ publish packages:
variables: variables:
GIT_STRATEGY: clone GIT_STRATEGY: clone
GIT_DEPTH: 0 GIT_DEPTH: 0
PUBLISH_TAG: next
script: script:
- pnpm install - pnpm install
- pnpm build - pnpm build
- pnpm publish -r --publish-branch ${PUBLISH_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks... - pnpm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
- pnpm publish -r --publish-branch ${CI_COMMIT_BRANCH} --tag ${PUBLISH_TAG} --no-git-checks # TODO: Git checks...
rules: rules:
- if: $CI_COMMIT_BRANCH == 'main' - if: $CI_COMMIT_BRANCH == 'main'
variables: variables:
PUBLISH_BRANCH: main
PUBLISH_TAG: latest PUBLISH_TAG: latest
- variables: - !reference [.limit_publish_pipelines, rules]
PUBLISH_BRANCH: $CI_COMMIT_BRANCH
PUBLISH_TAG: next
publish docs: publish docs:
stage: publish stage: publish
@@ -77,3 +83,6 @@ publish docs:
artifacts: artifacts:
paths: paths:
- public - public
rules:
- if: $CI_COMMIT_BRANCH == 'main'
- !reference [.limit_publish_pipelines, rules]

View File

@@ -1,6 +1,6 @@
.limit_base_image_publishing: .limit_scheduled_pipelines:
- if: $CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == 'main' rules:
when: always - if: $CI_COMMIT_BRANCH == 'main' && $CI_PIPELINE_SOURCE == "schedule"
base image: base image:
image: docker image: docker
@@ -18,10 +18,9 @@ base image:
docker build docker build
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)" -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" && -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" &&
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" --all-tags
cache: {} # disable irrelevant cache for this job cache: {} # disable irrelevant cache for this job
before_script: [] # do not run irrelevant before script for this job before_script: [] # do not run irrelevant before script for this job
rules: !reference [.limit_base_image_publishing]
parallel: parallel:
matrix: matrix:
- IMAGE_NAME: node-base - IMAGE_NAME: node-base
@@ -30,4 +29,7 @@ base image:
DEPLOY_DIR: images/node-builder DEPLOY_DIR: images/node-builder
- IMAGE_NAME: app-builder - IMAGE_NAME: app-builder
DEPLOY_DIR: images/app-builder DEPLOY_DIR: images/app-builder
- IMAGE_NAME: app-cypress
DEPLOY_DIR: images/app-cypress
rules:
- !reference [.limit_scheduled_pipelines, rules]

View File

@@ -53,12 +53,6 @@ const config = {
packages: ['**'], packages: ['**'],
pinVersion: 'workspace:*', pinVersion: 'workspace:*',
}, },
{
label: 'App may have some dependency exceptions',
dependencies: ['typescript', '@typescript-eslint/**', 'eslint**'],
packages: ['@openstapps/app'],
isIgnored: true,
},
], ],
}; };

View File

@@ -19,4 +19,4 @@ integration:
junit: junit:
- backend/backend/coverage/integration-report-junit.xml - backend/backend/coverage/integration-report-junit.xml
rules: rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop' - !reference [.limit_pipelines, rules]

View File

@@ -1,5 +1,15 @@
# @openstapps/backend # @openstapps/backend
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/core-tools@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/backend", "name": "@openstapps/backend",
"description": "A reference implementation for a StApps backend", "description": "A reference implementation for a StApps backend",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@@ -99,7 +99,7 @@
"supertest": "6.3.3", "supertest": "6.3.3",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -0,0 +1,7 @@
# @openstapps/database
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/database", "name": "@openstapps/database",
"version": "2.0.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"files": [ "files": [
"config", "config",

View File

@@ -1,5 +1,13 @@
# @openstapps/proxy # @openstapps/proxy
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/logger@3.0.0-next.4
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/proxy", "name": "@openstapps/proxy",
"description": "NGINX proxy that is dynamically configured by a Node.js script", "description": "NGINX proxy that is dynamically configured by a Node.js script",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@@ -51,7 +51,7 @@
"is-cidr": "4.0.2", "is-cidr": "4.0.2",
"mustache": "4.2.0", "mustache": "4.2.0",
"semver": "7.3.8", "semver": "7.3.8",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"devDependencies": { "devDependencies": {
"@openstapps/api-cli": "workspace:*", "@openstapps/api-cli": "workspace:*",

View File

@@ -1,5 +1,11 @@
# @openstapps/backend-config # @openstapps/backend-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/backend-config", "name": "@openstapps/backend-config",
"description": "Backend Configuration for OpenStApps", "description": "Backend Configuration for OpenStApps",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",

View File

@@ -1,5 +1,11 @@
# @openstapps/eslint-config # @openstapps/eslint-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/eslint-config", "name": "@openstapps/eslint-config",
"description": "A collection of configuration base files for StApps projects. Just an (unused) experiment for now.", "description": "A collection of configuration base files for StApps projects. Just an (unused) experiment for now.",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"type": "commonjs", "type": "commonjs",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/eslint-config.git", "repository": "git@gitlab.com:openstapps/eslint-config.git",
@@ -19,7 +19,7 @@
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"eslint": "8.43.0", "eslint": "8.43.0",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "5.60.1", "@typescript-eslint/eslint-plugin": "5.60.1",

View File

@@ -1,5 +1,11 @@
# @openstapps/prettier-config # @openstapps/prettier-config
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/prettier-config", "name": "@openstapps/prettier-config",
"description": "StApps Prettier Config", "description": "StApps Prettier Config",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/prettier-config.git", "repository": "git@gitlab.com:openstapps/prettier-config.git",

View File

@@ -1,5 +1,22 @@
# @openstapps/projectmanagement # @openstapps/projectmanagement
## 3.0.0-next.4
### Major Changes
- 11c9d742: Move images to separate packages
Removed builder image due to migration to Kaniko
### Patch Changes
- 4e4c7b5c: Update release configs
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/collection-utils@3.0.0-next.4
- @openstapps/gitlab-api@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
## 3.0.0-next.3 ## 3.0.0-next.3
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/projectmanagement", "name": "@openstapps/projectmanagement",
"description": "Main documentation and scripts for maintenance.", "description": "Main documentation and scripts for maintenance.",
"version": "3.0.0-next.3", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -65,7 +65,7 @@
"mocha-junit-reporter": "2.2.0", "mocha-junit-reporter": "2.2.0",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -1,5 +1,11 @@
# @openstapps/tsconfig # @openstapps/tsconfig
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/tsconfig", "name": "@openstapps/tsconfig",
"description": "The tsconfig for the openstapps project", "description": "The tsconfig for the openstapps project",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"type": "commonjs", "type": "commonjs",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"repository": "git@gitlab.com:openstapps/eslint-config.git", "repository": "git@gitlab.com:openstapps/eslint-config.git",

View File

@@ -1,12 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
"alwaysStrict": true, "alwaysStrict": true,
"charset": "utf8",
"declaration": true, "declaration": true,
"esModuleInterop": true, "esModuleInterop": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"skipLibCheck": true, "skipLibCheck": true,
"downlevelIteration": true,
"inlineSourceMap": true, "inlineSourceMap": true,
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
@@ -21,9 +21,9 @@
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"outDir": "../../../lib/", "outDir": "../../../lib/",
"lib": ["ES2021", "DOM"], "lib": ["ES2022", "DOM"],
"strict": true, "strict": true,
"target": "ES2021" "target": "ES2022"
}, },
"ts-node": { "ts-node": {
"transpileOnly": true "transpileOnly": true

View File

@@ -1,5 +1,15 @@
# @openstapps/minimal-connector # @openstapps/minimal-connector
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-connector", "name": "@openstapps/minimal-connector",
"description": "This is a minimal connector which serves as an example", "description": "This is a minimal connector which serves as an example",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -55,7 +55,7 @@
"nock": "13.3.1", "nock": "13.3.1",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

View File

@@ -0,0 +1,7 @@
# @openstapps/minimal-deployment
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6

View File

@@ -1,6 +1,6 @@
{ {
"name": "@openstapps/minimal-deployment", "name": "@openstapps/minimal-deployment",
"version": "2.0.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"files": [ "files": [
"database", "database",

View File

@@ -1,5 +1,17 @@
# @openstapps/minimal-plugin # @openstapps/minimal-plugin
## 3.0.0-next.4
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- Updated dependencies [23481d0d]
- @openstapps/api-plugin@3.0.0-next.4
- @openstapps/core-tools@3.0.0-next.4
- @openstapps/logger@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/minimal-plugin", "name": "@openstapps/minimal-plugin",
"description": "Minimal Plugin", "description": "Minimal Plugin",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"type": "module", "type": "module",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
@@ -44,7 +44,7 @@
"@types/express": "4.17.17", "@types/express": "4.17.17",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"tsup": "6.7.0", "tsup": "6.7.0",
"typescript": "4.9.5" "typescript": "5.1.6"
}, },
"tsup": { "tsup": {
"entry": [ "entry": [

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1689752456,
"narHash": "sha256-VOChdECcEI8ixz8QY+YC4JaNEFwQd1V8bA0G4B28Ki0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7f256d7da238cb627ef189d56ed590739f42f13b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

77
flake.nix Normal file
View File

@@ -0,0 +1,77 @@
{
description = "A Nix-flake-based development environment for OpenStApps";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs }:
let
buildToolsVersion = "30.0.3";
overlays = [
(final: prev: rec {
nodejs = prev.nodejs-18_x;
pnpm = prev.nodePackages.pnpm;
chrome = prev.google-chrome;
firefox = prev.firefox;
webkit = prev.epiphany; # Safari-ish browser
android = prev.androidenv.composeAndroidPackages {
buildToolsVersions = [ "${buildToolsVersion}" ];
platformVersions = [ "32" ];
};
cypress = prev.cypress.overrideAttrs(cyPrev: rec {
version = "13.2.0";
src = prev.fetchzip {
url = "https://cdn.cypress.io/desktop/${version}/linux-x64/cypress.zip";
hash = "sha256-9o0nprGcJhudS1LNm+T7Vf0Dwd1RBauYKI+w1FBQ3ZM=";
};
});
})
];
# TODO: aarch64-linux, x68_64-darwin, aarch64-darwin
supportedSystems = [ "x86_64-linux" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs {
inherit overlays system;
config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
};
});
in
{
devShells = forEachSupportedSystem ({ pkgs }:
let
python = (pkgs.python311.withPackages(ps: with ps; [ brotli fonttools ] ++ (with fonttools.optional-dependencies; [ ufo lxml unicode woff ])));
in
{
default = (pkgs.buildFHSUserEnv {
name = "StApps Dev";
targetPkgs = pkgs: with pkgs; [
nodejs
pnpm
python
docker
# tools
curl
jq
# browsers
firefox
chrome
webkit
cypress
# android
jdk17
android.androidsdk
musl
];
runScript = "bash";
profile = ''
export CYPRESS_INSTALL_BINARY=0
export CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress
export ANDROID_SDK_ROOT=${pkgs.android.androidsdk}/libexec/android-sdk
export ANDROID_JAVA_HOME=${pkgs.jdk.home}
export DOCKER_HOST=unix:///run/user/1000/docker.sock
{ dockerd-rootless & } 2>/dev/null
'';
}).env;
});
};
}

View File

@@ -9,4 +9,6 @@
last 2 versions last 2 versions
Firefox ESR Firefox ESR
not dead not dead
not IE 9-11 # For IE 9-11 support, remove 'not'. not kaios 2.5
not op_mini all
not IE 9-11

View File

@@ -1,17 +0,0 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View File

@@ -8,7 +8,7 @@
"parserOptions": { "parserOptions": {
"ecmaVersion": 2020, "ecmaVersion": 2020,
"sourceType": "module", "sourceType": "module",
"project": ["tsconfig.json", "tsconfig.spec.json", "e2e/tsconfig.e2e.json"], "project": ["tsconfig.json", "tsconfig.spec.json", "cypress/tsconfig.json"],
"createDefaultProgram": true "createDefaultProgram": true
}, },
"extends": [ "extends": [
@@ -33,6 +33,7 @@
"unicorn/prefer-object-from-entries": "off", "unicorn/prefer-object-from-entries": "off",
"unicorn/prefer-node-protocol": "off", "unicorn/prefer-node-protocol": "off",
"unicorn/no-process-exit": "off", "unicorn/no-process-exit": "off",
"unicorn/prefer-event-target": "off",
"unicorn/prevent-abbreviations": [ "unicorn/prevent-abbreviations": [
"warn", "warn",
{ {

View File

@@ -1,9 +1,12 @@
e2e: e2e:
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/ image: registry.gitlab.com/openstapps/openstapps/app-cypress:node-18
stage: test stage: test
script: script:
- pnpm --filter=@openstapps/app install - pnpm --filter=@openstapps/app install
- pnpm --filter=@openstapps/app exec cypress install - pnpm --filter=@openstapps/app exec cypress install
- cd node_modules/.pnpm/re2*/node_modules/re2
- npm run install
- cd $CI_PROJECT_DIR
- pnpm test:integration:app - pnpm test:integration:app
artifacts: artifacts:
when: on_failure when: on_failure
@@ -19,4 +22,4 @@ e2e:
- BROWSER: chrome - BROWSER: chrome
- BROWSER: firefox - BROWSER: firefox
rules: rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event' || $CI_COMMIT_BRANCH == 'main' || $CI_COMMIT_BRANCH == 'develop' - !reference [.limit_pipelines, rules]

View File

@@ -1,30 +0,0 @@
build:
stage: build
script:
- npm run build
artifacts:
paths:
- www
except:
- schedules
scheduled-build:
stage: build
script:
- npm run build
only:
- schedules
unit:
stage: test
script:
- npm run check-icons
- npm run test -- --watch=false --no-progress --code-coverage
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
artifacts:
paths:
- coverage
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml

View File

@@ -1,11 +0,0 @@
# Ignore all files/folders by default
# See https://stackoverflow.com/a/29932318
/*
# Except these files/folders
!docs
!lib
!LICENSE
!package.json
!package-lock.json
!README.md
!src

View File

@@ -23,4 +23,5 @@ module.exports = {
}, },
}, },
], ],
ignorePath: ['.prettierignore', '../../.gitignore'],
}; };

View File

@@ -1,5 +1,29 @@
# @openstapps/app # @openstapps/app
## 3.0.0-next.4
### Major Changes
- 23481d0d: Update to Angular 16.1
### Minor Changes
- 23481d0d: Migrate to Ionic 7
- Migrate uses of `<ion-label>` with inputs to new syntax
- Fix infinite loop in schedule date picker (`datetime.confirm()` to `datetime.cancel()`)
### Patch Changes
- 23481d0d: Update to TypeScript 5.1.6
- bebee6b4: Migrate collection helpers to use @openstapps/collection-utils
- 107a7c5e: Migrate unit tests to karma-coverage and junit reports.
Fixes an issue where coverage reports would not be generated.
- Updated dependencies [23481d0d]
- @openstapps/collection-utils@3.0.0-next.4
- @openstapps/core@3.0.0-next.4
- @openstapps/api@3.0.0-next.4
## 3.0.0-next.0 ## 3.0.0-next.0
### Major Changes ### Major Changes

View File

@@ -2,6 +2,14 @@
A few notes to our icon set, for users and future maintainers. A few notes to our icon set, for users and future maintainers.
You will need to setup fonttools with python
```shell
python -m venv .venv && .venv/bin/python -m pip install -r requirements.txt
```
Alternatively, anything that puts `fonttools` within your path will do as well.
## Usage ## Usage
To find icon names, visit the To find icon names, visit the
@@ -73,6 +81,3 @@ npm run minify-icons
Unfortunately, I was unable to find a JS package that could to the job, Unfortunately, I was unable to find a JS package that could to the job,
and had to rely on the Python module [fonttools](https://github.com/fonttools/fonttools). and had to rely on the Python module [fonttools](https://github.com/fonttools/fonttools).
That means that you might run into additional issues when running the
above-mentioned command.

View File

@@ -42,3 +42,23 @@ The command `ionic cordova run ios` runs into the error `/platforms/ios/build/em
- Either use the command: `ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"` - Either use the command: `ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"`
- Or open the iOS project in Xcode and change build system in workspace settings to `Lagacy Build System`. Then the normal run command works also. - Or open the iOS project in Xcode and change build system in workspace settings to `Lagacy Build System`. Then the normal run command works also.
## Cypress
#### Problem
The browser doesn't open or the tests don't connect to a browser
#### Cause
Cypress was installed to a read-only location, see
[this issue](https://github.com/cypress-io/cypress/issues/18893).
This can be the case if you use NixOS.
#### Solution
Make sure the cypress folder is writable before each launch
```shell
chmod -R +rw ~/.config/Cypress
```

View File

@@ -1,70 +1,70 @@
[ [
{ {
"pkg": "@capacitor/app", "pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin" "classpath": "com.capacitorjs.plugins.app.AppPlugin"
}, },
{ {
"pkg": "@capacitor/browser", "pkg": "@capacitor/browser",
"classpath": "com.capacitorjs.plugins.browser.BrowserPlugin" "classpath": "com.capacitorjs.plugins.browser.BrowserPlugin"
}, },
{ {
"pkg": "@capacitor/device", "pkg": "@capacitor/device",
"classpath": "com.capacitorjs.plugins.device.DevicePlugin" "classpath": "com.capacitorjs.plugins.device.DevicePlugin"
}, },
{ {
"pkg": "@capacitor/dialog", "pkg": "@capacitor/dialog",
"classpath": "com.capacitorjs.plugins.dialog.DialogPlugin" "classpath": "com.capacitorjs.plugins.dialog.DialogPlugin"
}, },
{ {
"pkg": "@capacitor/filesystem", "pkg": "@capacitor/filesystem",
"classpath": "com.capacitorjs.plugins.filesystem.FilesystemPlugin" "classpath": "com.capacitorjs.plugins.filesystem.FilesystemPlugin"
}, },
{ {
"pkg": "@capacitor/geolocation", "pkg": "@capacitor/geolocation",
"classpath": "com.capacitorjs.plugins.geolocation.GeolocationPlugin" "classpath": "com.capacitorjs.plugins.geolocation.GeolocationPlugin"
}, },
{ {
"pkg": "@capacitor/haptics", "pkg": "@capacitor/haptics",
"classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin" "classpath": "com.capacitorjs.plugins.haptics.HapticsPlugin"
}, },
{ {
"pkg": "@capacitor/keyboard", "pkg": "@capacitor/keyboard",
"classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin" "classpath": "com.capacitorjs.plugins.keyboard.KeyboardPlugin"
}, },
{ {
"pkg": "@capacitor/local-notifications", "pkg": "@capacitor/local-notifications",
"classpath": "com.capacitorjs.plugins.localnotifications.LocalNotificationsPlugin" "classpath": "com.capacitorjs.plugins.localnotifications.LocalNotificationsPlugin"
}, },
{ {
"pkg": "@capacitor/network", "pkg": "@capacitor/network",
"classpath": "com.capacitorjs.plugins.network.NetworkPlugin" "classpath": "com.capacitorjs.plugins.network.NetworkPlugin"
}, },
{ {
"pkg": "@capacitor/preferences", "pkg": "@capacitor/preferences",
"classpath": "com.capacitorjs.plugins.preferences.PreferencesPlugin" "classpath": "com.capacitorjs.plugins.preferences.PreferencesPlugin"
}, },
{ {
"pkg": "@capacitor/share", "pkg": "@capacitor/share",
"classpath": "com.capacitorjs.plugins.share.SharePlugin" "classpath": "com.capacitorjs.plugins.share.SharePlugin"
}, },
{ {
"pkg": "@capacitor/splash-screen", "pkg": "@capacitor/splash-screen",
"classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin" "classpath": "com.capacitorjs.plugins.splashscreen.SplashScreenPlugin"
}, },
{ {
"pkg": "@capacitor/status-bar", "pkg": "@capacitor/status-bar",
"classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin" "classpath": "com.capacitorjs.plugins.statusbar.StatusBarPlugin"
}, },
{ {
"pkg": "@hugotomazi/capacitor-navigation-bar", "pkg": "@hugotomazi/capacitor-navigation-bar",
"classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin" "classpath": "br.com.tombus.capacitor.plugin.navigationbar.NavigationBarPlugin"
}, },
{ {
"pkg": "@transistorsoft/capacitor-background-fetch", "pkg": "@transistorsoft/capacitor-background-fetch",
"classpath": "com.transistorsoft.bgfetch.capacitor.BackgroundFetchPlugin" "classpath": "com.transistorsoft.bgfetch.capacitor.BackgroundFetchPlugin"
}, },
{ {
"pkg": "capacitor-secure-storage-plugin", "pkg": "capacitor-secure-storage-plugin",
"classpath": "com.whitestein.securestorage.SecureStoragePluginPlugin" "classpath": "com.whitestein.securestorage.SecureStoragePluginPlugin"
} }
] ]

View File

@@ -1,54 +1,54 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android' include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') project(':capacitor-android').projectDir = new File('../../../node_modules/.pnpm/@capacitor+android@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/android/capacitor')
include ':capacitor-app' include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') project(':capacitor-app').projectDir = new File('../../../node_modules/.pnpm/@capacitor+app@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/app/android')
include ':capacitor-browser' include ':capacitor-browser'
project(':capacitor-browser').projectDir = new File('../node_modules/@capacitor/browser/android') project(':capacitor-browser').projectDir = new File('../../../node_modules/.pnpm/@capacitor+browser@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/browser/android')
include ':capacitor-device' include ':capacitor-device'
project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android') project(':capacitor-device').projectDir = new File('../../../node_modules/.pnpm/@capacitor+device@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/device/android')
include ':capacitor-dialog' include ':capacitor-dialog'
project(':capacitor-dialog').projectDir = new File('../node_modules/@capacitor/dialog/android') project(':capacitor-dialog').projectDir = new File('../../../node_modules/.pnpm/@capacitor+dialog@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/dialog/android')
include ':capacitor-filesystem' include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android') project(':capacitor-filesystem').projectDir = new File('../../../node_modules/.pnpm/@capacitor+filesystem@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/filesystem/android')
include ':capacitor-geolocation' include ':capacitor-geolocation'
project(':capacitor-geolocation').projectDir = new File('../node_modules/@capacitor/geolocation/android') project(':capacitor-geolocation').projectDir = new File('../../../node_modules/.pnpm/@capacitor+geolocation@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/geolocation/android')
include ':capacitor-haptics' include ':capacitor-haptics'
project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/haptics/android') project(':capacitor-haptics').projectDir = new File('../../../node_modules/.pnpm/@capacitor+haptics@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/haptics/android')
include ':capacitor-keyboard' include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android') project(':capacitor-keyboard').projectDir = new File('../../../node_modules/.pnpm/@capacitor+keyboard@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/keyboard/android')
include ':capacitor-local-notifications' include ':capacitor-local-notifications'
project(':capacitor-local-notifications').projectDir = new File('../node_modules/@capacitor/local-notifications/android') project(':capacitor-local-notifications').projectDir = new File('../../../node_modules/.pnpm/@capacitor+local-notifications@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/local-notifications/android')
include ':capacitor-network' include ':capacitor-network'
project(':capacitor-network').projectDir = new File('../node_modules/@capacitor/network/android') project(':capacitor-network').projectDir = new File('../../../node_modules/.pnpm/@capacitor+network@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/network/android')
include ':capacitor-preferences' include ':capacitor-preferences'
project(':capacitor-preferences').projectDir = new File('../node_modules/@capacitor/preferences/android') project(':capacitor-preferences').projectDir = new File('../../../node_modules/.pnpm/@capacitor+preferences@4.0.2_@capacitor+core@4.6.1/node_modules/@capacitor/preferences/android')
include ':capacitor-share' include ':capacitor-share'
project(':capacitor-share').projectDir = new File('../node_modules/@capacitor/share/android') project(':capacitor-share').projectDir = new File('../../../node_modules/.pnpm/@capacitor+share@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/share/android')
include ':capacitor-splash-screen' include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android') project(':capacitor-splash-screen').projectDir = new File('../../../node_modules/.pnpm/@capacitor+splash-screen@4.1.2_@capacitor+core@4.6.1/node_modules/@capacitor/splash-screen/android')
include ':capacitor-status-bar' include ':capacitor-status-bar'
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android') project(':capacitor-status-bar').projectDir = new File('../../../node_modules/.pnpm/@capacitor+status-bar@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/status-bar/android')
include ':hugotomazi-capacitor-navigation-bar' include ':hugotomazi-capacitor-navigation-bar'
project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../node_modules/@hugotomazi/capacitor-navigation-bar/android') project(':hugotomazi-capacitor-navigation-bar').projectDir = new File('../../../node_modules/.pnpm/@hugotomazi+capacitor-navigation-bar@2.0.0_@capacitor+core@4.6.1/node_modules/@hugotomazi/capacitor-navigation-bar/android')
include ':transistorsoft-capacitor-background-fetch' include ':transistorsoft-capacitor-background-fetch'
project(':transistorsoft-capacitor-background-fetch').projectDir = new File('../node_modules/@transistorsoft/capacitor-background-fetch/android') project(':transistorsoft-capacitor-background-fetch').projectDir = new File('../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@4.6.1/node_modules/@transistorsoft/capacitor-background-fetch/android')
include ':capacitor-secure-storage-plugin' include ':capacitor-secure-storage-plugin'
project(':capacitor-secure-storage-plugin').projectDir = new File('../node_modules/capacitor-secure-storage-plugin/android') project(':capacitor-secure-storage-plugin').projectDir = new File('../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.8.1_@capacitor+core@4.6.1/node_modules/capacitor-secure-storage-plugin/android')

0
frontend/app/android/gradlew vendored Normal file → Executable file
View File

View File

@@ -7,7 +7,7 @@ ext {
androidxCoordinatorLayoutVersion = '1.2.0' androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.8.0' androidxCoreVersion = '1.8.0'
androidxFragmentVersion = '1.4.1' androidxFragmentVersion = '1.4.1'
coreSplashScreenVersion = '1.0.1' coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0' androidxWebkitVersion = '1.4.0'
junitVersion = '4.13.2' junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3' androidxJunitVersion = '1.1.3'

View File

@@ -1,7 +1,6 @@
{ {
"$schema": "./node_modules/@angular/cli/lib/config/schema.json", "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1, "version": 1,
"defaultProject": "app",
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"app": { "app": {
@@ -17,10 +16,17 @@
"outputPath": "www", "outputPath": "www",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
"polyfills": "src/polyfills.ts", "polyfills": "zone.js",
"tsConfig": "tsconfig.app.json", "tsConfig": "tsconfig.app.json",
"allowedCommonJsDependencies": [
"moment",
"opening_hours",
"leaflet",
"leaflet.markercluster",
"localforge",
"guid-typescript"
],
"aot": true, "aot": true,
"allowedCommonJsDependencies": ["moment", "opening_hours"],
"assets": [ "assets": [
{ {
"glob": "**/*", "glob": "**/*",
@@ -44,8 +50,7 @@
}, },
"./node_modules/leaflet/dist/leaflet.css", "./node_modules/leaflet/dist/leaflet.css",
"./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css" "./node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css"
], ]
"scripts": []
}, },
"configurations": { "configurations": {
"production": { "production": {
@@ -102,7 +107,6 @@
"browserTarget": "app:build:development" "browserTarget": "app:build:development"
}, },
"ci": { "ci": {
"progress": false,
"browserTarget": "app:build" "browserTarget": "app:build"
}, },
"fake": { "fake": {
@@ -111,21 +115,13 @@
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"
}, },
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
"main": "src/test.ts", "polyfills": ["zone.js", "zone.js/testing"],
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json", "tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js", "karmaConfig": "karma.conf.js",
"styles": [], "main": "src/test.ts",
"scripts": [],
"assets": [ "assets": [
{ {
"glob": "favicon.ico", "glob": "favicon.ico",
@@ -143,12 +139,6 @@
"output": "assets/" "output": "assets/"
} }
] ]
},
"configurations": {
"ci": {
"progress": false,
"watch": false
}
} }
}, },
"lint": { "lint": {
@@ -192,6 +182,7 @@
"builder": "@cypress/schematic:cypress", "builder": "@cypress/schematic:cypress",
"options": { "options": {
"devServerTarget": "app:serve", "devServerTarget": "app:serve",
"liveReload": false,
"watch": true, "watch": true,
"headless": false "headless": false
}, },
@@ -206,7 +197,6 @@
}, },
"cli": { "cli": {
"packageManager": "pnpm", "packageManager": "pnpm",
"defaultCollection": "@ionic/angular-toolkit",
"analytics": false "analytics": false
}, },
"schematics": { "schematics": {

View File

@@ -18,14 +18,18 @@
describe('dashboard', async function () { describe('dashboard', async function () {
describe('schedule section', function () { describe('schedule section', function () {
it('should lead to the schedule', function () { it('should lead to the week overview', function () {
cy.visit('/overview'); cy.visit('/overview');
cy.get('.schedule').contains('a', 'Stundenplan').click(); cy.get('.schedule')
cy.url().should('include', '/schedule/recurring'); .contains('a', /Wochen.*übersicht/)
.click();
cy.url().should('include', '/schedule/week-overview');
});
it('should lead to the calendar', function () {
cy.visit('/overview'); cy.visit('/overview');
cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click(); cy.get('.schedule').contains('a', 'Kein Eintrag gefunden').click();
cy.url().should('include', '/schedule/recurring'); cy.url().should('include', '/schedule/calendar');
}); });
// TODO: Reenable and stabilize tests // TODO: Reenable and stabilize tests

View File

@@ -30,14 +30,14 @@ describe('ical', function () {
cy.get('ion-app > ion-modal').within(() => { cy.get('ion-app > ion-modal').within(() => {
cy.get('ion-footer > ion-toolbar > ion-button').should('have.attr', 'disabled'); cy.get('ion-footer > ion-toolbar > ion-button').should('have.attr', 'disabled');
cy.contains('ion-item', /19\.\s+Januar\s+2059,\s+\d{2}:00\s+-\s+\d{2}:00/).click(); cy.contains('ion-item', /1\s+Stunde\s+Sonntag,\s+19\.\s+Januar\s+2059\s+um\s+\d{2}:00/).click();
cy.get('ion-footer > ion-toolbar > ion-button').should('not.have.attr', 'disabled'); cy.get('ion-footer > ion-toolbar > ion-button').should('not.have.attr', 'disabled');
cy.get('ion-footer > ion-toolbar > ion-button').click(); cy.get('ion-footer > ion-toolbar > ion-button').click();
}); });
cy.get('add-event-review-modal').within(() => { cy.get('add-event-review-modal').within(() => {
cy.get('ion-item-group').should('contain', 'UNIcert (Test)'); cy.get('ion-item-group').should('contain', 'UNIcert (Test)');
cy.contains('ion-item-group', /19\.\s+Jan\.\s+2059,\s+\d{2}:00/); cy.contains('ion-item-group', /19\.\s+Januar\s+2059\s+um\s+\d{2}:00/);
}); });
}); });
}); });

View File

@@ -0,0 +1,141 @@
describe('opening hours', () => {
beforeEach(function () {
cy.intercept('POST', 'https://mobile.server.uni-frankfurt.de/search', {
fixture: 'search/types/canteen/canteen-search-result.json',
}).as('search');
});
it('should specify relative closing time', () => {
cy.clock(new Date(2023, 9, 16, 15, 29), ['Date']);
cy.visit('/canteen');
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt heute um 22:00');
});
it('should specify relative opening time', () => {
cy.clock(new Date(2023, 9, 16, 6, 29), ['Date']);
cy.visit('/canteen');
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet heute um 08:30');
});
it('should specify soon opening time', () => {
cy.clock(new Date(2023, 9, 16, 8, 0), ['Date']);
cy.visit('/canteen');
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet in 30 Minuten');
});
it('should specify soon closing time', () => {
cy.clock(new Date(2023, 9, 16, 21, 30), ['Date']);
cy.visit('/canteen');
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 30 Minuten');
});
it('should update the soon closing time every minute', () => {
cy.clock(new Date(2023, 9, 16, 21, 30));
cy.visit('/canteen');
cy.tick(500);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 30 Minuten');
cy.tick(60_000);
cy.tick(50);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 29 Minuten');
});
it('should update the status when it changes', () => {
cy.clock(new Date(2023, 9, 16, 21, 59));
cy.visit('/canteen');
cy.tick(500);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 1 Minute');
cy.tick(60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet morgen um 08:30');
});
// This one takes long to execute!
it('should update as expected', () => {
cy.clock(new Date(2023, 9, 16, 20, 59));
cy.visit('/canteen');
cy.tick(500);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt heute um 22:00');
cy.tick(60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 60 Minuten');
cy.tick(30 * 60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt in 30 Minuten');
cy.tick(30 * 60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet morgen um 08:30');
cy.tick(9.5 * 60 * 60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet in 60 Minuten');
cy.tick(30 * 60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geschlossen')
.should('contain', 'Öffnet in 30 Minuten');
cy.tick(30 * 60_000);
cy.get('stapps-opening-hours')
.first()
.should('contain', 'Geöffnet')
.should('contain', 'Schließt heute um 22:00');
// Long tick warps will cause network requests to time out
cy.get('@consoleError').invoke('resetHistory');
});
});

View File

@@ -25,7 +25,7 @@ describe('schedule', function () {
it('should respect the url', function () { it('should respect the url', function () {
cy.visit('/schedule/calendar/2022-01-19'); cy.visit('/schedule/calendar/2022-01-19');
cy.get('#date-select-button0').should('contain', '19.01.22'); cy.get('#date-select-button0').should('contain', '19.01.2022');
}); });
it('should navigate a full page', function () { it('should navigate a full page', function () {
@@ -66,13 +66,13 @@ describe('schedule', function () {
it('should navigate to a specific date', function () { it('should navigate to a specific date', function () {
cy.visit('/schedule/calendar/2059-01-19'); cy.visit('/schedule/calendar/2059-01-19');
cy.contains('#date-select-button0', '19.01.59').click(); cy.contains('#date-select-button0', '19.01.2059').click();
cy.wait(2000); cy.wait(2000);
cy.get('button[data-day=1][data-month=1][data-year=2059]', { cy.get('button[data-day=1][data-month=1][data-year=2059]', {
includeShadowDom: true, includeShadowDom: true,
}).click(); }).click();
cy.wait(2000); cy.wait(2000);
cy.contains('#date-select-button0', '01.01.59').click(); cy.contains('#date-select-button0', '01.01.2059').click();
}); });
// TODO: Reenable and stabilize tests // TODO: Reenable and stabilize tests

View File

@@ -31,36 +31,24 @@
// When a command from ./commands is ready to use, import with `import './commands'` syntax // When a command from ./commands is ready to use, import with `import './commands'` syntax
// import './commands'; // import './commands';
beforeEach(async function () { beforeEach(function () {
let databases: string[]; cy.wrap(
if (window.indexedDB.databases) { new Promise(resolve => {
databases = (await window.indexedDB.databases()).map(it => it.name); window.indexedDB.deleteDatabase('_ionicstorage').onsuccess = resolve;
console.log('Trying to clear all databases'); }),
} else { );
console.log("Browser doesn't support database enumeration, deleting just ionic storage");
databases = ['_ionicstorage'];
}
for (const database of databases) {
if (database) {
console.log(`Deleting database ${database}`);
await new Promise(resolve => (window.indexedDB.deleteDatabase(database).onsuccess = resolve));
console.log(`Deleted database ${database}`);
}
}
}); });
Cypress.on('window:before:load', window => { Cypress.on('window:before:load', window => {
// Fake that user is using its browser in german language // Fake that user is using its browser in German
Object.defineProperty(window.navigator, 'language', {value: 'de-DE'}); Object.defineProperty(window.navigator, 'language', {value: 'de-DE'});
Object.defineProperty(window.navigator, 'languages', [{value: 'de-DE'}]); Object.defineProperty(window.navigator, 'languages', [{value: 'de-DE'}]);
// Fail tests on console error cy.spy(window.console, 'error').as('consoleError');
cy.stub(window.console, 'error').callsFake(message => { });
// log out to the terminal
cy.now('task', 'error', message); afterEach(function () {
// log to Command Log and fail the test cy.get('@consoleError').should('not.have.been.called');
throw new Error(message);
});
}); });
Cypress.on('uncaught:exception', error => { Cypress.on('uncaught:exception', error => {

View File

@@ -9,25 +9,25 @@ use_frameworks!
install! 'cocoapods', :disable_input_output_paths => true install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'Capacitor', :path => '../../../../node_modules/.pnpm/@capacitor+ios@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../../../node_modules/.pnpm/@capacitor+ios@4.6.1_@capacitor+core@4.6.1/node_modules/@capacitor/ios'
pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' pod 'CapacitorApp', :path => '../../../../node_modules/.pnpm/@capacitor+app@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/app'
pod 'CapacitorBrowser', :path => '../../node_modules/@capacitor/browser' pod 'CapacitorBrowser', :path => '../../../../node_modules/.pnpm/@capacitor+browser@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/browser'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device' pod 'CapacitorDevice', :path => '../../../../node_modules/.pnpm/@capacitor+device@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/device'
pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog' pod 'CapacitorDialog', :path => '../../../../node_modules/.pnpm/@capacitor+dialog@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/dialog'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem' pod 'CapacitorFilesystem', :path => '../../../../node_modules/.pnpm/@capacitor+filesystem@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/filesystem'
pod 'CapacitorGeolocation', :path => '../../node_modules/@capacitor/geolocation' pod 'CapacitorGeolocation', :path => '../../../../node_modules/.pnpm/@capacitor+geolocation@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/geolocation'
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics' pod 'CapacitorHaptics', :path => '../../../../node_modules/.pnpm/@capacitor+haptics@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard' pod 'CapacitorKeyboard', :path => '../../../../node_modules/.pnpm/@capacitor+keyboard@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/keyboard'
pod 'CapacitorLocalNotifications', :path => '../../node_modules/@capacitor/local-notifications' pod 'CapacitorLocalNotifications', :path => '../../../../node_modules/.pnpm/@capacitor+local-notifications@4.1.4_@capacitor+core@4.6.1/node_modules/@capacitor/local-notifications'
pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network' pod 'CapacitorNetwork', :path => '../../../../node_modules/.pnpm/@capacitor+network@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/network'
pod 'CapacitorPreferences', :path => '../../node_modules/@capacitor/preferences' pod 'CapacitorPreferences', :path => '../../../../node_modules/.pnpm/@capacitor+preferences@4.0.2_@capacitor+core@4.6.1/node_modules/@capacitor/preferences'
pod 'CapacitorShare', :path => '../../node_modules/@capacitor/share' pod 'CapacitorShare', :path => '../../../../node_modules/.pnpm/@capacitor+share@4.1.0_@capacitor+core@4.6.1/node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen' pod 'CapacitorSplashScreen', :path => '../../../../node_modules/.pnpm/@capacitor+splash-screen@4.1.2_@capacitor+core@4.6.1/node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar' pod 'CapacitorStatusBar', :path => '../../../../node_modules/.pnpm/@capacitor+status-bar@4.1.1_@capacitor+core@4.6.1/node_modules/@capacitor/status-bar'
pod 'HugotomaziCapacitorNavigationBar', :path => '../../node_modules/@hugotomazi/capacitor-navigation-bar' pod 'HugotomaziCapacitorNavigationBar', :path => '../../../../node_modules/.pnpm/@hugotomazi+capacitor-navigation-bar@2.0.0_@capacitor+core@4.6.1/node_modules/@hugotomazi/capacitor-navigation-bar'
pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../node_modules/@transistorsoft/capacitor-background-fetch' pod 'TransistorsoftCapacitorBackgroundFetch', :path => '../../../../node_modules/.pnpm/@transistorsoft+capacitor-background-fetch@1.0.2_@capacitor+core@4.6.1/node_modules/@transistorsoft/capacitor-background-fetch'
pod 'CapacitorSecureStoragePlugin', :path => '../../node_modules/capacitor-secure-storage-plugin' pod 'CapacitorSecureStoragePlugin', :path => '../../../../node_modules/.pnpm/capacitor-secure-storage-plugin@0.8.1_@capacitor+core@4.6.1/node_modules/capacitor-secure-storage-plugin'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end end

View File

@@ -1,3 +1,4 @@
// @ts-check
/* /*
* Copyright (C) 2022 StApps * Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@@ -13,10 +14,13 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Karma configuration file, see link for more information // Karma configuration file, see the link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html // https://karma-runner.github.io/1.0/config/configuration-file.html
var isDocker = require('is-docker'); var isDocker = require('is-docker');
/**
* @param config {import('karma').Config}
*/
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
basePath: '', basePath: '',
@@ -25,9 +29,9 @@ module.exports = function (config) {
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'),
require('karma-mocha-reporter'), require('karma-mocha-reporter'),
require('karma-junit-reporter'), require('karma-junit-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
], ],
client: { client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser clearContext: false, // leave Jasmine Spec Runner output visible in browser
@@ -44,19 +48,18 @@ module.exports = function (config) {
useBrowserName: false, useBrowserName: false,
}, },
reporters: ['mocha', 'junit', 'coverage'], reporters: ['mocha', 'junit', 'coverage'],
singleRun: true,
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: config.LOG_INFO, logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['ChromeNoSandbox'], browsers: ['ChromeNoSandbox'],
customLaunchers: { customLaunchers: {
ChromeNoSandbox: { ChromeNoSandbox: {
base: 'ChromeHeadless', base: 'ChromeHeadless',
// We must disable the Chrome sandbox when running Chrome inside Docker, // We must disable the Chrome sandbox when running Chrome inside Docker,
// see https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3 // see https://hackernoon.com/running-karma-tests-with-headless-chrome-inside-docker-ae4aceb06ed3
flags: isDocker ? ['--no-sandbox'] : [], flags: isDocker() ? ['--no-sandbox'] : [],
}, },
}, },
singleRun: false,
}); });
}; };

View File

@@ -1,11 +0,0 @@
import {process} from '@angular/compiler-cli/ngcc';
import path from 'path';
const legacyViewEngineLibraries = [
['@awesome-cordova-plugins', 'calendar'],
['@ionic-native', 'core'],
];
for (const basePath of legacyViewEngineLibraries) {
process({basePath: path.resolve(path.join('node_modules', ...basePath))});
}

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/app", "name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.", "description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "3.0.0-next.0", "version": "3.0.0-next.4",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -15,7 +15,7 @@
], ],
"scripts": { "scripts": {
"analyze": "webpack-bundle-analyzer www/stats.json", "analyze": "webpack-bundle-analyzer www/stats.json",
"build": "pnpm check-icons && ng build --configuration=production --stats-json && webpack-bundle-analyzer www/stats.json --mode static --report www/bundle-info.html", "build": "pnpm check-icons && ng build --configuration=production --stats-json && webpack-bundle-analyzer --no-open www/stats.json --mode static --report www/bundle-info.html",
"build:analyze": "npm run build:stats && npm run analyze", "build:analyze": "npm run build:stats && npm run analyze",
"build:android": "ionic capacitor build android --no-open && cd android && ./gradlew clean assembleDebug && cd ..", "build:android": "ionic capacitor build android --no-open && cd android && ./gradlew clean assembleDebug && cd ..",
"build:prod": "ng build --configuration=production", "build:prod": "ng build --configuration=production",
@@ -31,14 +31,13 @@
"docker:run:android": "sudo docker run -v $PWD:/app --privileged -v /dev/bus/usb:/dev/bus/usb --net=host -it registry.gitlab.com/openstapps/app bash -c \"npm run run:android\"", "docker:run:android": "sudo docker run -v $PWD:/app --privileged -v /dev/bus/usb:/dev/bus/usb --net=host -it registry.gitlab.com/openstapps/app bash -c \"npm run run:android\"",
"docker:serve": "sudo docker run -p 8100:8100 -p 35729:35729 -p 53703:53703 -v $PWD:/app -it registry.gitlab.com/openstapps/app bash -c \"npm run start:external\"", "docker:serve": "sudo docker run -p 8100:8100 -p 35729:35729 -p 53703:53703 -v $PWD:/app -it registry.gitlab.com/openstapps/app bash -c \"npm run start:external\"",
"e2e": "ng e2e", "e2e": "ng e2e",
"format": "prettier . -c --ignore-path ../../.gitignore", "format": "prettier . -c",
"format:fix": "prettier --write . --ignore-path ../../.gitignore", "format:fix": "prettier --write .",
"licenses": "license-checker --json > src/assets/about/licenses.json && ts-node ./scripts/accumulate-licenses.ts && git add src/assets/about/licenses.json", "licenses": "license-checker --json > src/assets/about/licenses.json && ts-node ./scripts/accumulate-licenses.ts && git add src/assets/about/licenses.json",
"lint": "ng lint && stylelint \"**/*.scss\"", "lint": "ng lint && stylelint \"**/*.scss\"",
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/ && stylelint --fix \"**/*.scss\"", "lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/ && stylelint --fix \"**/*.scss\"",
"minify-icons": "ts-node-esm scripts/minify-icon-font.ts", "minify-icons": "ts-node-esm scripts/minify-icon-font.ts",
"ng": "ng", "postinstall": "jetify && echo \"skipping jetify in production mode\"",
"postinstall": "(jetify && node ngcc-postinstall.mjs) || echo \"skipping jetify in production mode\"",
"preview": "http-server www --p 8101 -o", "preview": "http-server www --p 8101 -o",
"push": "git push && git push origin \"v$npm_package_version\"", "push": "git push && git push origin \"v$npm_package_version\"",
"resources:android": "cordova-res android --skip-config --copy", "resources:android": "cordova-res android --skip-config --copy",
@@ -47,23 +46,24 @@
"start": "ionic serve", "start": "ionic serve",
"start:external": "ionic serve --external", "start:external": "ionic serve --external",
"start:prod": "ionic serve --prod", "start:prod": "ionic serve --prod",
"test": "ng test --watch=false --code-coverage", "test": "ng test --code-coverage",
"test:integration": "sh integration-test.sh" "test:integration": "sh integration-test.sh"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "13.4.0", "@angular/animations": "16.1.4",
"@angular/cdk": "13.3.9", "@angular/cdk": "16.1.4",
"@angular/common": "13.4.0", "@angular/common": "16.1.4",
"@angular/core": "13.4.0", "@angular/core": "16.1.4",
"@angular/forms": "13.4.0", "@angular/forms": "16.1.4",
"@angular/platform-browser": "13.4.0", "@angular/platform-browser": "16.1.4",
"@angular/router": "13.4.0", "@angular/router": "16.1.4",
"@asymmetrik/ngx-leaflet": "13.0.2", "@asymmetrik/ngx-leaflet": "16.0.1",
"@asymmetrik/ngx-leaflet-markercluster": "13.0.1", "@asymmetrik/ngx-leaflet-markercluster": "16.0.0",
"@awesome-cordova-plugins/calendar": "5.45.0", "@awesome-cordova-plugins/calendar": "5.45.0",
"@awesome-cordova-plugins/core": "5.45.0", "@awesome-cordova-plugins/core": "5.45.0",
"@capacitor/app": "4.1.1", "@capacitor/app": "4.1.1",
"@capacitor/browser": "4.1.0", "@capacitor/browser": "4.1.0",
"@capacitor/clipboard": "4.1.0",
"@capacitor/core": "4.6.1", "@capacitor/core": "4.6.1",
"@capacitor/device": "4.1.0", "@capacitor/device": "4.1.0",
"@capacitor/dialog": "4.1.0", "@capacitor/dialog": "4.1.0",
@@ -79,16 +79,20 @@
"@capacitor/status-bar": "4.1.1", "@capacitor/status-bar": "4.1.1",
"@hugotomazi/capacitor-navigation-bar": "2.0.0", "@hugotomazi/capacitor-navigation-bar": "2.0.0",
"@ionic-native/core": "5.36.0", "@ionic-native/core": "5.36.0",
"@ionic/angular": "6.7.5", "@ionic/angular": "7.1.3",
"@ionic/storage": "4.0.0", "@ionic/storage-angular": "4.0.0",
"@ngx-translate/core": "14.0.0", "@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "7.0.0", "@ngx-translate/http-loader": "8.0.0",
"@openid/appauth": "1.3.1", "@openid/appauth": "1.3.1",
"@openstapps/api": "workspace:*", "@openstapps/api": "workspace:*",
"@openstapps/collection-utils": "workspace:*",
"@openstapps/core": "workspace:*", "@openstapps/core": "workspace:*",
"@transistorsoft/capacitor-background-fetch": "1.0.2", "@transistorsoft/capacitor-background-fetch": "1.0.2",
"@types/dom-view-transitions": "1.0.1",
"capacitor-secure-storage-plugin": "0.8.1", "capacitor-secure-storage-plugin": "0.8.1",
"cordova-plugin-calendar": "5.1.6", "cordova-plugin-calendar": "5.1.6",
"date-fns": "2.30.0",
"duration-fns": "3.0.2",
"deepmerge": "4.3.1", "deepmerge": "4.3.1",
"form-data": "4.0.0", "form-data": "4.0.0",
"geojson": "0.5.0", "geojson": "0.5.0",
@@ -97,38 +101,37 @@
"leaflet": "1.9.3", "leaflet": "1.9.3",
"leaflet.markercluster": "1.5.3", "leaflet.markercluster": "1.5.3",
"material-symbols": "0.10.0", "material-symbols": "0.10.0",
"moment": "2.29.4", "ngx-date-fns": "10.0.1",
"ngx-logger": "5.0.12", "ngx-logger": "5.0.12",
"ngx-markdown": "13.1.0", "ngx-markdown": "16.0.0",
"ngx-moment": "6.0.2",
"opening_hours": "3.8.0", "opening_hours": "3.8.0",
"rxjs": "7.8.0", "rxjs": "7.8.1",
"swiper": "8.4.5", "swiper": "8.4.5",
"tslib": "2.4.1", "tslib": "2.4.1",
"zone.js": "0.12.0" "zone.js": "0.13.1"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/architect": "0.1303.11", "@angular-devkit/architect": "0.1601.4",
"@angular-devkit/build-angular": "13.3.11", "@angular-devkit/build-angular": "16.1.4",
"@angular-devkit/core": "13.3.11", "@angular-devkit/core": "16.1.4",
"@angular-devkit/schematics": "13.3.11", "@angular-devkit/schematics": "16.1.4",
"@angular-eslint/builder": "13.5.0", "@angular-eslint/builder": "16.1.0",
"@angular-eslint/eslint-plugin": "13.5.0", "@angular-eslint/eslint-plugin": "16.1.0",
"@angular-eslint/eslint-plugin-template": "13.5.0", "@angular-eslint/eslint-plugin-template": "16.1.0",
"@angular-eslint/schematics": "13.5.0", "@angular-eslint/schematics": "16.1.0",
"@angular-eslint/template-parser": "13.5.0", "@angular-eslint/template-parser": "16.1.0",
"@angular/cli": "13.3.11", "@angular/cli": "16.1.4",
"@angular/compiler": "13.4.0", "@angular/compiler": "16.1.4",
"@angular/compiler-cli": "13.4.0", "@angular/compiler-cli": "16.1.4",
"@angular/language-service": "13.4.0", "@angular/language-service": "16.1.4",
"@angular/platform-browser-dynamic": "13.3.11", "@angular/platform-browser-dynamic": "16.1.4",
"@capacitor/android": "4.6.1", "@capacitor/android": "4.6.1",
"@capacitor/cli": "4.6.1", "@capacitor/cli": "4.6.1",
"@capacitor/ios": "4.6.1", "@capacitor/ios": "4.6.1",
"@compodoc/compodoc": "1.1.19", "@compodoc/compodoc": "1.1.19",
"@cypress/schematic": "1.7.0", "@cypress/schematic": "1.7.0",
"@ionic/angular-toolkit": "6.1.0", "@ionic/angular-toolkit": "10.0.0",
"@ionic/cli": "6.20.4", "@ionic/cli": "7.1.1",
"@openstapps/prettier-config": "workspace:*", "@openstapps/prettier-config": "workspace:*",
"@openstapps/tsconfig": "workspace:*", "@openstapps/tsconfig": "workspace:*",
"@types/fontkit": "1.8.0", "@types/fontkit": "1.8.0",
@@ -137,33 +140,35 @@
"@types/jasmine": "4.3.1", "@types/jasmine": "4.3.1",
"@types/jasminewd2": "2.0.10", "@types/jasminewd2": "2.0.10",
"@types/jsonpath": "0.2.0", "@types/jsonpath": "0.2.0",
"@types/karma": "6.3.4",
"@types/karma-coverage": "2.0.1",
"@types/karma-jasmine": "4.0.2",
"@types/leaflet": "1.9.0", "@types/leaflet": "1.9.0",
"@types/leaflet.markercluster": "1.5.1", "@types/leaflet.markercluster": "1.5.1",
"@types/node": "18.15.3", "@types/node": "18.15.3",
"@typescript-eslint/eslint-plugin": "5.49.0", "@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.49.0", "@typescript-eslint/parser": "5.60.1",
"cordova-res": "0.15.4", "cordova-res": "0.15.4",
"cypress": "12.0.1", "cypress": "13.2.0",
"eslint": "8.33.0", "eslint": "8.43.0",
"eslint-plugin-jsdoc": "39.7.4", "eslint-plugin-jsdoc": "46.4.2",
"eslint-plugin-prettier": "4.2.1", "eslint-plugin-prettier": "4.2.1",
"eslint-plugin-unicorn": "45.0.2", "eslint-plugin-unicorn": "47.0.0",
"fontkit": "2.0.2", "fontkit": "2.0.2",
"glob": "10.2.7", "glob": "10.2.7",
"http-server": "14.1.1", "http-server": "14.1.1",
"is-docker": "2.2.1", "is-docker": "2.2.1",
"jasmine-core": "4.5.0", "jasmine-core": "5.0.1",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
"jetifier": "2.0.0", "jetifier": "2.0.0",
"junit-report-merger": "6.0.2", "junit-report-merger": "6.0.2",
"karma": "6.4.1", "karma": "6.4.2",
"karma-chrome-launcher": "3.1.1", "karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.1", "karma-coverage": "2.2.1",
"karma-jasmine": "5.1.0", "karma-jasmine": "5.1.0",
"karma-junit-reporter": "2.0.1", "karma-junit-reporter": "2.0.1",
"karma-mocha-reporter": "2.2.5", "karma-mocha-reporter": "2.2.5",
"license-checker": "25.0.1", "license-checker": "25.0.1",
"protractor": "7.0.0",
"stylelint": "15.10.1", "stylelint": "15.10.1",
"stylelint-config-clean-order": "5.0.1", "stylelint-config-clean-order": "5.0.1",
"stylelint-config-prettier-scss": "1.0.0", "stylelint-config-prettier-scss": "1.0.0",
@@ -171,7 +176,7 @@
"stylelint-config-standard-scss": "10.0.0", "stylelint-config-standard-scss": "10.0.0",
"surge": "0.23.1", "surge": "0.23.1",
"ts-node": "10.9.1", "ts-node": "10.9.1",
"typescript": "4.6.4", "typescript": "5.1.6",
"webpack-bundle-analyzer": "4.7.0" "webpack-bundle-analyzer": "4.7.0"
}, },
"prettier": "@openstapps/prettier-config", "prettier": "@openstapps/prettier-config",

View File

@@ -0,0 +1,7 @@
appdirs==1.4.4
Brotli==1.0.9
fonttools==4.41.0
fs==2.4.16
lxml==4.9.3
six==1.16.0
zopfli==0.2.2

View File

@@ -86,15 +86,9 @@ async function minifyIconFont() {
} }
glyphs.sort(); glyphs.sort();
const pythonPath = `"${await run('npm config get python')}"`;
console.log(`Using python from npm config ${pythonPath}`);
console.log(await run(`${pythonPath} --version`));
console.log(await run([pythonPath, '-m', 'pip', 'install', 'fonttools[ufo,lxml,unicode,woff]']));
console.log( console.log(
await run([ await run([
pythonPath, 'pyftsubset',
'-m fontTools.subset',
`"${config.inputPath}"`, `"${config.inputPath}"`,
`--unicodes=${glyphs.join(',')}`, `--unicodes=${glyphs.join(',')}`,
'--no-layout-closure', '--no-layout-closure',

View File

@@ -1,28 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Chunk array into smaller arrays of a specified size.
*
* @param array The array to chunk.
* @param chunkSize The size of each chunk.
*/
export function chunk<T>(array: T[], chunkSize = 1): T[][] {
const arrayCopy = [...array];
const out: T[][] = [];
if (chunkSize <= 0) return out;
while (arrayCopy.length > 0) out.push(arrayCopy.splice(0, chunkSize));
return out;
}

View File

@@ -1,25 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {differenceBy} from './difference';
describe('differenceBy', function () {
it('should return the difference of two arrays', function () {
const a = [1, 2, 3, 4, 5];
const b = [1, 2, 3];
expect(differenceBy(a, b, it => it)).toEqual([4, 5]);
});
});

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns the difference between two arrays.
*/
export function differenceBy<T>(a: T[], b: T[], transform: (item: T) => unknown) {
const disallowed = new Set(b.map(transform));
return a.filter(item => !disallowed.has(transform(item)));
}

View File

@@ -1,39 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {get} from './get';
describe('get', function () {
it('should get a simple path', function () {
const object = {
a: {
b: {
c: 'd',
},
},
};
expect(get(object, 'a.b.c')).toBe('d');
});
it('should return undefined for a non-existent path', function () {
const object = {
a: {
b: {
c: 'd',
},
},
};
expect(get(object, 'a.b.c.d')).toBeUndefined();
});
});

View File

@@ -1,30 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Gets a value from a nested object.
* The path must be key names separated by dots.
* If the path doesn't exist, undefined is returned.
*/
export function get<U = unknown>(object: object, path: string): U {
return path.split('.').reduce(
(accumulator, current) =>
accumulator?.hasOwnProperty(current)
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
(accumulator as any)[current]
: undefined,
object,
) as unknown as U;
}

View File

@@ -1,123 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {groupBy, groupByStable, groupByProperty} from './group-by';
describe('groupBy', () => {
it('should group an array by a key', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
];
const result = groupBy(array, it => it.name);
expect(result).toEqual({
one: [{id: 1, name: 'one'}],
two: [{id: 2, name: 'two'}],
three: [{id: 3, name: 'three'}],
four: [{id: 4, name: 'four'}],
five: [{id: 5, name: 'five'}],
});
});
it('should handle multiple elements per group', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
{id: 6, name: 'one'},
{id: 7, name: 'two'},
{id: 8, name: 'three'},
{id: 9, name: 'four'},
{id: 10, name: 'five'},
];
const result = groupBy(array, it => it.name);
expect(result).toEqual({
one: [
{id: 1, name: 'one'},
{id: 6, name: 'one'},
],
two: [
{id: 2, name: 'two'},
{id: 7, name: 'two'},
],
three: [
{id: 3, name: 'three'},
{id: 8, name: 'three'},
],
four: [
{id: 4, name: 'four'},
{id: 9, name: 'four'},
],
five: [
{id: 5, name: 'five'},
{id: 10, name: 'five'},
],
});
});
});
describe('groupByStable', () => {
const array = [
{id: 2, name: 'two'},
{id: 4, name: 'three'},
{id: 3, name: 'three'},
{id: 1, name: 'one'},
];
const result = groupByStable(array, it => it.name);
it('should group an array by keys', () => {
expect(result.get('one')).toEqual([{id: 1, name: 'one'}]);
expect(result.get('two')).toEqual([{id: 2, name: 'two'}]);
expect(result.get('three')).toEqual([
{id: 4, name: 'three'},
{id: 3, name: 'three'},
]);
});
it('should provide ordered keys', () => {
expect([...result.keys()]).toEqual(['two', 'three', 'one']);
});
});
describe('groupByProperty', function () {
it('should group by property', () => {
const array = [
{id: 1, name: 'one'},
{id: 2, name: 'two'},
{id: 3, name: 'three'},
{id: 4, name: 'four'},
{id: 5, name: 'five'},
];
const result = groupByProperty(array, 'name');
expect(result).toEqual({
one: [{id: 1, name: 'one'}],
two: [{id: 2, name: 'two'}],
three: [{id: 3, name: 'three'}],
four: [{id: 4, name: 'four'}],
five: [{id: 5, name: 'five'}],
});
});
});

View File

@@ -1,45 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Group an array by a function
*/
export function groupBy<T>(collection: T[], group: (item: T) => string | undefined): Record<string, T[]> {
return collection.reduce((accumulator: Record<string, T[]>, item) => {
const key = group(item) ?? '';
accumulator[key] = accumulator[key] ?? [];
accumulator[key].push(item);
return accumulator;
}, {});
}
/**
* Group an array by a function (returns a Map, whose keys keep order info of items entry)
*/
export function groupByStable<T>(collection: T[], group: (item: T) => string | undefined): Map<string, T[]> {
return collection.reduce((accumulator: Map<string, T[]>, item) => {
const key = group(item) ?? '';
accumulator.set(key, accumulator.get(key) ?? []);
accumulator.get(key)?.push(item);
return accumulator;
}, new Map<string, T[]>());
}
/**
*
*/
export function groupByProperty<T extends object>(collection: T[], property: keyof T): Record<string, T[]> {
return groupBy(collection, item => item[property] as unknown as string);
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {keyBy} from './key-by';
describe('keyBy', function () {
it('should key objects', function () {
const objects = [
{
id: 1,
name: 'foo',
},
{
id: 2,
name: 'bar',
},
];
const result = keyBy(objects, it => it.id);
expect(result).toEqual({
1: {
id: 1,
name: 'foo',
},
2: {
id: 2,
name: 'bar',
},
});
});
});

View File

@@ -1,27 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Create an object composed of keys generated from the results of running
* each element of collection thru iteratee. The corresponding value of
* each key is the last element responsible for generating the key. The
* iteratee is invoked with one argument: (value).
*/
export function keyBy<T>(collection: T[], key: (item: T) => string | number): Record<string, T> {
return collection.reduce((accumulator, item) => {
accumulator[key(item)] = item;
return accumulator;
}, {} as Record<string | number, T>);
}

View File

@@ -1,50 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {mapValues} from './map-values';
describe('map-values', () => {
it('should map values', () => {
const object = {
a: 1,
b: 2,
c: 3,
};
const result = mapValues(object, value => value * 2);
expect(result).toEqual({
a: 2,
b: 4,
c: 6,
});
});
it('should not modify the original object', () => {
const object = {
a: 1,
b: 2,
c: 3,
};
mapValues(object, value => value * 2);
expect(object).toEqual({
a: 1,
b: 2,
c: 3,
});
});
});

View File

@@ -1,32 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Maps the values of an object to a new object
*/
export function mapValues<T extends object, U>(
object: T,
transform: (value: T[keyof T], key: keyof T) => U,
): {[key in keyof T]: U} {
const result = {} as {[key in keyof T]: U};
for (const key in object) {
if (object.hasOwnProperty(key)) {
result[key] = transform(object[key], key);
}
}
return result;
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {minBy} from './min';
describe('minBy', function () {
it('should pick the minimum value based on transform', function () {
expect(
minBy(
[
{id: 1, name: 'A'},
{id: 2, name: 'B'},
{id: 3, name: 'C'},
],
it => it.id,
),
).toEqual({id: 1, name: 'A'});
});
it('should not return undefined if there are other choices', function () {
expect(
minBy(
[
{id: undefined, name: 'B'},
{id: 1, name: 'A'},
{id: undefined, name: 'C'},
],
it => it.id,
),
).toEqual({id: 1, name: 'A'});
});
});

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns the minimum value of a collection.
*/
export function minBy<T>(array: T[], transform: (item: T) => number | undefined): T {
const transforms = array.map(transform);
const min = Math.min(...(transforms.filter(it => !!it) as number[]));
return array.find((_, i) => transforms[i] === min) as T;
}

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {omit} from './omit';
describe('omit', function () {
it('should omit keys', function () {
const object = {a: 1, b: 2, c: 3};
const result = omit(object, 'a', 'c');
expect(result).toEqual({b: 2});
});
});

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Returns a new object without the specified keys.
*/
export function omit<T extends object, U extends keyof T>(object: T, ...keys: U[]): Omit<T, U> {
const out = {...object};
for (const key of keys) delete out[key];
return out as Exclude<T, U>;
}

View File

@@ -1,25 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {partition} from './partition';
describe('partition', function () {
it('should partition an array', function () {
expect(partition([1, 2, 3, 4], it => it % 2 === 0)).toEqual([
[2, 4],
[1, 3],
]);
});
});

View File

@@ -1,28 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Partitions a list into two lists. One with the elements that satisfy a predicate,
* and one with the elements that don't satisfy the predicate.
*/
export function partition<T>(array: T[], transform: (item: T) => boolean): [T[], T[]] {
return array.reduce<[T[], T[]]>(
(accumulator, item) => {
accumulator[transform(item) ? 0 : 1].push(item);
return accumulator;
},
[[], []],
);
}

View File

@@ -1,23 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {pick} from './pick';
describe('pick', function () {
it('should pick properties', function () {
const object = {a: 1, b: 2, c: 3};
const result = pick(object, ['a', 'c']);
expect(result).toEqual({a: 1, c: 3});
});
});

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Pick a set of properties from an object
*/
export function pick<T extends object, U extends keyof T>(object: T, keys: U[]): Pick<T, U> {
return keys.reduce((accumulator, key) => {
if (object.hasOwnProperty(key)) {
accumulator[key] = object[key];
}
return accumulator;
}, {} as Pick<T, U>);
}
/**
* Pick a set of properties from an object using a predicate function
*/
export function pickBy<T extends object, U extends keyof T>(
object: T,
predicate: (value: T[U], key: U) => boolean,
): Pick<T, U> {
return (Object.keys(object) as U[]).reduce((accumulator, key) => {
if (predicate(object[key], key)) {
accumulator[key] = object[key];
}
return accumulator;
}, {} as Pick<T, U>);
}

View File

@@ -1,30 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {shuffle} from './shuffle';
describe('shuffle', function () {
it('should shuffle an array', function () {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const shuffled = shuffle(array);
expect(shuffled).not.toEqual(array);
expect(shuffled).toEqual(jasmine.arrayContaining(array));
});
it('should not modify the original array', function () {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
shuffle(array);
expect(array).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
});
});

View File

@@ -1,28 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Shuffles an array
*/
export function shuffle<T>(array: T[]): T[] {
const copy = [...array];
const out = [];
while (copy.length > 0) {
out.push(copy.splice(Math.floor(Math.random() * copy.length), 1)[0]);
}
return out;
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {stringSort, stringSortBy} from './string-sort';
describe('stringSort', () => {
it('should sort an array of strings', () => {
expect(['a', 'c', 'b', 'd'].sort(stringSort)).toEqual(['a', 'b', 'c', 'd']);
});
});
describe('stringSortBy', () => {
it('should sort an array of strings', () => {
expect([{item: 'a'}, {item: 'c'}, {item: 'b'}, {item: 'd'}].sort(stringSortBy(it => it.item))).toEqual([
{item: 'a'},
{item: 'b'},
{item: 'c'},
{item: 'd'},
]);
});
});

View File

@@ -1,36 +0,0 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* sort function for two strings
*/
export function stringSort(a = '', b = ''): number {
if (a < b) return -1;
if (a > b) return 1;
return 0;
}
/**
* sort function for two strings that allows for a custom transform
*/
export function stringSortBy<T>(map: (item: T) => string | undefined): (a: T, b: T) => number {
return (a: T, b: T): number => {
const aValue = map(a) || '';
const bValue = map(b) || '';
if (aValue < bValue) return -1;
if (aValue > bValue) return 1;
return 0;
};
}

Some files were not shown because too many files have changed in this diff Show More