diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..25ac2b4 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,29 @@ +on: [push] +jobs: + build: + runs-on: container + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build package (transpile ts => js) + run: ng build + + - name: Store build + uses: actions/upload-artifact@v3 + with: + name: Package + path: dist/ diff --git a/.gitignore b/.gitignore index ee6bec4..105c00f 100644 --- a/.gitignore +++ b/.gitignore @@ -44,5 +44,3 @@ testem.log # System Files .DS_Store Thumbs.db - -.npmrc diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml deleted file mode 100644 index 24c4254..0000000 --- a/.woodpecker/build.yaml +++ /dev/null @@ -1,50 +0,0 @@ -when: - - event: manual - - event: tag - -#depends_on: - #- test - -steps: - npm: - image: code.philo.ydns.eu/philorg/pnpm-deb - environment: - ORG: philorg - REGISTRY_TOKEN: - from_secret: registry_token - volumes: - - pnpm:/root/.local/share/pnpm - commands: - - pnpm install --frozen-lockfile - - pnpm set "//code.philo.ydns.eu/api/packages/$ORG/npm/:_authToken=$REGISTRY_TOKEN" - - pnpm publish --no-git-checks - failure: ignore - - build: - image: code.philo.ydns.eu/philorg/pnpm-deb - commands: - - pnpm build - - build_publish: - image: quay.io/podman/stable:latest - # Caution: This image is built daily. It might fill up your image store quickly. - #pull: true - volumes: - - containers:/var/lib/containers - - pnpm:/root/.local/share/pnpm - # Fill in the trusted checkbox in Woodpecker's settings as well - privileged: true - environment: - registry: code.philo.ydns.eu - org: philorg - container_name: treetrail-frontend - registry_token: - from_secret: registry_token - commands: - # Login at the registry - - podman login -u __token__ --password $registry_token $registry - # Build the container image - - podman build --volume=/var/lib/containers:/var/lib/containers --tag $registry/$org/$container_name:latest --tag $registry/$org/$container_name:$CI_COMMIT_TAG . - # Push the image - - podman push $registry/$org/$container_name:latest - - podman push $registry/$org/$container_name:$CI_COMMIT_TAG diff --git a/Containerfile b/Containerfile index b2476a3..2851af6 100644 --- a/Containerfile +++ b/Containerfile @@ -1,6 +1,7 @@ FROM docker.io/library/nginx:alpine +MAINTAINER philo email phil.dev@philome.mooo.com EXPOSE 80 COPY nginx.conf /etc/nginx/nginx.conf -COPY dist/treetrail/browser /usr/share/nginx/html +COPY treetrail-app/dist/treetrail/browser /usr/share/nginx/html \ No newline at end of file diff --git a/README.md b/README.md index ede9083..d692ad1 100644 --- a/README.md +++ b/README.md @@ -1,10 +1 @@ -# Treetrail web front-end - -Front-end for *Tree Trail*, a fun and pedagogic tool -to discover the trails and trees around. - -Home page (source, bugs, etc): - . - -The main documentation for Tree Trail is: - . +Front-end for *Tree Trail*, a fun and pedagogic tool to discover the trails and trees around. \ No newline at end of file diff --git a/build.yaml b/build.yaml deleted file mode 100644 index 0bd92e0..0000000 --- a/build.yaml +++ /dev/null @@ -1,49 +0,0 @@ -- name: Build container image - hosts: localhost - gather_facts: false - vars: - repository: tiptop:5000 - force_rm: false - cache: false - - tasks: - - name: Install dependencies - command: pnpm install - args: - chdir: "{{ playbook_dir }}" - - - name: Build the Angular app - command: ng build - args: - chdir: "{{ playbook_dir }}" - - - name: Get the version from git - command: git describe --dirty --tags - register: version - args: - chdir: "{{ playbook_dir }}" - - - name: Update version.json - command: pnpm run version - args: - chdir: "{{ playbook_dir }}" - - - name: Build frontend container - containers.podman.podman_image: - name: "treetrail-frontend:{{ version.stdout }}" - state: build - force: true - path: "{{ playbook_dir }}" - build: - format: oci - force_rm: "{{ force_rm }}" - cache: "{{ cache }}" - file: Containerfile - extra_args: "--build-arg APP_VERSION={{ version.stdout }}" - push: true - push_args: - dest: "{{ repository }}/treetrail-frontend:{{ version.stdout }}" - #quadlet_options: - # - | - # [Install] - # WantedBy=default.target diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 5d3152a..0000000 --- a/nginx.conf +++ /dev/null @@ -1,66 +0,0 @@ -events { - worker_connections 1024; ## Default: 1024 -} - -http { - - ## use mime types - include /etc/nginx/mime.types; - - server { - - listen 80 default_server; - listen [::]:80 default_server; - server_name _; - root /usr/share/nginx/html; - - location = / { - ## Convevience redirect to redirect to the web root - return 301 /treetrail/; - } - - location = /treetrail { - ## Convevience redirect to redirect to the web root - return 301 /treetrail/; - } - - location /treetrail/ { - alias /usr/share/nginx/html/; - index index.html; - try_files $uri $uri/ /index.html; - } - - location /treetrail/v1/ { - proxy_set_header Host $http_host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - proxy_redirect off; - proxy_buffering off; - proxy_pass http://127.0.0.1:8081; - } - } - - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - - ## enable gzip compression - gzip on; - gzip_vary on; - gzip_min_length 256; - gzip_proxied any; - - gzip_types - ## text/html is always compressed : https://nginx.org/en/docs/http/ngx_http_gzip_module.html - text/plain - text/css - text/javascript - application/javascript - application/x-javascript - application/xml - application/json - application/ld+json; -} diff --git a/package-lock.json b/package-lock.json index 91aa9a1..55c3ef2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "treetrail", - "version": "0.4.5", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "treetrail", - "version": "0.4.5", + "version": "0.0.0", "dependencies": { "@angular/animations": "^18.2.6", "@angular/cdk": "^18.2.6", diff --git a/package.json b/package.json index b408455..60a1179 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,15 @@ { - "name": "treetrail-frontend", - "version": "0.4.5", + "name": "treetrail", + "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve --proxy-config proxy.conf.json --port 4201 --serve-path /treetrail --host 0.0.0.0", + "start": "ng serve --proxy-config proxy.conf.json --port 4201", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test", "openapi-ts": "openapi-ts" }, + "private": true, "dependencies": { "@angular/animations": "^18.2.6", "@angular/cdk": "^18.2.6", @@ -60,8 +61,5 @@ "karma-jasmine-html-reporter": "^2.1.0", "typescript": "~5.4.5" }, - "packageManager": "pnpm@9.12.2", - "publishConfig": { - "registry": "http://code.philo.ydns.eu/api/packages/philorg/npm/" - } + "packageManager": "pnpm@9.12.2" } diff --git a/proxy.conf.json b/proxy.conf.json index 7094876..e24d739 100644 --- a/proxy.conf.json +++ b/proxy.conf.json @@ -1,17 +1,17 @@ { - "/treetrail/static": { + "/static": { "target": "http://127.0.0.1:5002", "secure": false }, - "/treetrail/v1": { + "/v1": { "target": "http://127.0.0.1:5002", "secure": false }, - "/treetrail/attachment": { + "/attachment": { "target": "http://127.0.0.1:5002", "secure": false }, - "/treetrail/tiles": { + "/tiles": { "target": "http://127.0.0.1:5002", "secure": false } diff --git a/src/app/about/about.component.html b/src/app/about/about.component.html index 6bd500d..c7e6ba7 100644 --- a/src/app/about/about.component.html +++ b/src/app/about/about.component.html @@ -4,7 +4,7 @@

Version

-

Client: {{ version }}>

+

Client: {{ (configService.conf | async).bootstrap.client.version }}>

Server: {{ (configService.conf | async).bootstrap.server.version }}

\ No newline at end of file diff --git a/src/app/about/about.component.ts b/src/app/about/about.component.ts index 26596b4..edfc557 100644 --- a/src/app/about/about.component.ts +++ b/src/app/about/about.component.ts @@ -1,7 +1,6 @@ -import { Component, OnInit } from '@angular/core' +import { Component, OnInit } from '@angular/core'; import { ConfigService } from '../config.service' -import packageJson from '../../../package.json' @Component({ selector: 'app-about', @@ -13,8 +12,6 @@ export class AboutComponent implements OnInit { public configService: ConfigService, ) { } - public version: string = packageJson.version - ngOnInit(): void { } } diff --git a/src/app/app.component.scss b/src/app/app.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 70dc380..52a84ae 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,7 +1,5 @@ -import { - Component, OnInit, - ChangeDetectorRef, ChangeDetectionStrategy -} from '@angular/core' +import { Component, OnInit, + ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core' import { DataService } from './data.service' import { ActionService } from './action.service' @@ -12,6 +10,7 @@ import { combineLatest } from 'rxjs' @Component({ selector: 'app-root', templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) export class AppComponent implements OnInit { @@ -21,7 +20,7 @@ export class AppComponent implements OnInit { public actionService: ActionService, public appUpdateService: AppUpdateService, public cdr: ChangeDetectorRef, - ) { } + ) {} title = 'treetrail' ngOnInit(): void { diff --git a/src/app/map/map.component.ts b/src/app/map/map.component.ts index 2c81158..fb8a909 100644 --- a/src/app/map/map.component.ts +++ b/src/app/map/map.component.ts @@ -80,7 +80,7 @@ export class MapComponent implements AfterContentInit, OnInit { let conf = this.configService.conf.value let bms = conf.background if (conf.bootstrap.baseMapStyles.embedded.indexOf(bms) >= 0) { - this.styleUrl = `tiles/style/${bms}` + this.styleUrl = `/tiles/style/${bms}` } else { this.styleUrl = conf.bootstrap.baseMapStyles.external[bms] diff --git a/src/app/profile/profile.component.scss b/src/app/profile/profile.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts index c5b8ea6..16fa22f 100644 --- a/src/app/profile/profile.component.ts +++ b/src/app/profile/profile.component.ts @@ -3,6 +3,7 @@ import { Component } from '@angular/core'; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', + styleUrls: ['./profile.component.scss'] }) export class ProfileComponent { diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index 3dd65d4..d1b7a8b 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -40,7 +40,7 @@
Types of zones displayed on the map
+ (change)="configService.setUserPrefValue('showZones', item.key, $event.checked)"> {{ item.key }}
@@ -108,7 +108,7 @@
  • Dave Storey: communication
  • Contact: phil.treetrail at philome.mooo.com

    -

    Version: {{conf.bootstrap?.client.version }}, frontend: {{ version }}

    +

    Version: {{conf.bootstrap?.client.version }}

    diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 9157906..498387d 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -3,7 +3,6 @@ import { Router } from '@angular/router' import { ActionService } from '../action.service' import { ConfigService, Config } from '../config.service' -import packageJson from '../../../package.json' @Component({ selector: 'app-settings', @@ -18,8 +17,6 @@ export class SettingsComponent implements OnInit { public router: Router, ) { } - public version: string = packageJson.version - ngOnInit(): void { this.configService.conf.subscribe( conf => this.conf = conf diff --git a/src/assets/.gitkeep b/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/assets/fonts/.gitignore b/src/assets/fonts/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tsconfig.json b/tsconfig.json index b149b41..78cbf2f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,8 +15,6 @@ "importHelpers": true, "target": "ES2022", "module": "es2020", - //"allowSyntheticDefaultImports": true, - "resolveJsonModule": true, "lib": [ "es2019", "dom"