Skip to content

Commit

Permalink
Merge branch 'vue3'
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Mar 29, 2024
2 parents aaf5d13 + 9aa954c commit 64c9a2f
Show file tree
Hide file tree
Showing 886 changed files with 30,385 additions and 22,799 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
node_modules
*/node_modules
*/dist
*/out
*/out.node
docs
.github
.github
Dockerfile
36 changes: 31 additions & 5 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import'],
extends: ['plugin:import/typescript'],
ignorePatterns: ["**/dist/*", "**/out/*", "**/out.*/*"],
parserOptions: {
parser: "@typescript-eslint/parser",
project: ["*/tsconfig.json", "*/tsconfig.node.json"],
extraFileExtensions: [".vue"]
},
plugins: ["@typescript-eslint", "import"],
extends: [
"plugin:import/typescript",
"plugin:vue/vue3-essential"
],
overrides: [
{
extends: ["plugin:@typescript-eslint/disable-type-checked"],
files: ["**/*.js", "**/*.cjs"]
}
],
env: {
node: true
},
rules: {
"@typescript-eslint/explicit-module-boundary-types": ["warn", { "allowArgumentsExplicitlyTypedAsAny": true }],
"import/no-unresolved": ["error", { "ignore": [ "geojson" ], "caseSensitive": true }],
"import/no-unresolved": ["error", { "ignore": [ "geojson", "virtual:icons" ], "caseSensitive": true }],
"import/no-extraneous-dependencies": ["error"],
"@typescript-eslint/no-unused-vars": ["warn", { "args": "none" }],
"import/no-named-as-default": ["warn"],
Expand All @@ -21,6 +36,11 @@ module.exports = {
"@typescript-eslint/prefer-as-const": ["error"],
"no-restricted-globals": ["error", "$"],
"no-restricted-imports": ["error", "vue/types/umd"],
"vue/multi-word-component-names": ["off"],
"@typescript-eslint/no-base-to-string": ["error"],
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
"vue/return-in-computed-property": ["off"],
"@typescript-eslint/no-floating-promises": ["error"],

"constructor-super": ["error"],
"for-direction": ["error"],
Expand Down Expand Up @@ -57,7 +77,6 @@ module.exports = {
"no-obj-calls": ["error"],
"no-octal": ["error"],
"no-prototype-builtins": ["error"],
"no-redeclare": ["error"],
"no-regex-spaces": ["error"],
"no-self-assign": ["error"],
"no-setter-return": ["error"],
Expand All @@ -75,5 +94,12 @@ module.exports = {
"require-yield": ["error"],
"use-isnan": ["error"],
"valid-typeof": ["error"]
},
"settings": {
"import/resolver": {
"typescript": {
"project": ["tsconfig.json", "*/tsconfig.json"],
}
},
}
};
56 changes: 46 additions & 10 deletions .github/workflows/docker-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,74 @@ on:
branches:
- 'main'

env:
TAG: facilmap/facilmap:latest

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Start integration test components in background
run: docker compose -f ./integration-tests/docker-compose.yml up -d --quiet-pull mysql postgres &

-
name: Build and push (FacilMap)
id: docker_build_facilmap
uses: docker/build-push-action@v2
name: Build docker image
uses: docker/build-push-action@v5
with:
push: true
context: .
tags: facilmap/facilmap:latest
load: true
tags: |
${{env.TAG}}
facilmap-ci
-
name: Start integration test components
run: |
docker compose -f ./integration-tests/docker-compose.yml up --wait
status="$?"
if (( status != 0 )); then
docker compose -f ./integration-tests/docker-compose.yml logs
exit "$status"
fi
-
name: Run integration tests
run: >-
docker run --rm -u root --add-host host.docker.internal:host-gateway facilmap-ci sh -c "
yarn workspaces focus facilmap-integration-tests &&
FACILMAP_URL=http://host.docker.internal:8080 yarn workspace facilmap-integration-tests run integration-tests &&
FACILMAP_URL=http://host.docker.internal:8081 yarn workspace facilmap-integration-tests run integration-tests
"
-
name: Push docker image
run: docker push "$TAG"

-
name: Build and push (Docs)
id: docker_build_docs
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
context: ./docs
Expand Down
53 changes: 11 additions & 42 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,41 @@ on:
types: [published]

jobs:
docker:
push_to_registry:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: facilmap/facilmap
tags: type=semver,pattern={{major}}.{{minor}}

-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3

-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

-
name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: facilmap/facilmap

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ config.env
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/versions
out
out.*
30 changes: 16 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
FROM node:15.12-alpine
FROM node:21-alpine
MAINTAINER Candid Dauth <[email protected]>

CMD yarn run server
CMD yarn run prod-server
EXPOSE 8080
ENV CACHE_DIR=/opt/facilmap/cache
HEALTHCHECK --start-period=60s --start-interval=3s --timeout=5s --retries=1 \
CMD wget -O/dev/null 'http://127.0.0.1:8080/socket.io/?EIO=4&transport=polling' || exit 1

RUN apk add --no-cache yarn

RUN adduser -D -h /opt/facilmap -s /bin/sh facilmap
RUN mkdir /opt/facilmap && adduser -D -H -h /opt/facilmap -s /bin/sh facilmap

WORKDIR /opt/facilmap/server
WORKDIR /opt/facilmap

COPY ./ ../
COPY ./ ./

RUN chown -R facilmap:facilmap /opt/facilmap
RUN yarn install && \
yarn check-types && \
yarn lint && \
yarn test && \
yarn run build:frontend:app && \
yarn run build:server && \
yarn workspaces focus -A --production

USER facilmap

RUN cd .. && yarn install

RUN cd .. && yarn run build

USER root
RUN chown -R root:root /opt/facilmap && chown -R facilmap:facilmap /opt/facilmap/server/cache
RUN mkdir -p "$CACHE_DIR" && chown -R facilmap:facilmap "$CACHE_DIR"

USER facilmap
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Smartphone-friendly interface and Progressive Web App
* Create collaborative maps, add markers, lines and routes and collaborate live through a share link
* View GPX/KML/OSM/GeoJSON files or import them to a collaborative map
* Export collaborative maps to GPX or GeoJSON to import them into Osmand or other apps
* Export collaborative maps to GPX or GeoJSON to import them into OsmAnd or other apps
* Link or embed a read-only or editable version of a collaborative map on your website
* Define different types of markers/lines with custom form fields to be filled out
* Create custom views where markers/lines are shown/hidden based on their form field values
Expand Down
28 changes: 13 additions & 15 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "3.4.0",
"description": "A library that acts as a client to FacilMap and makes it possible to retrieve and modify objects on a collaborative map.",
"keywords": [
"webpack",
"maps",
"osm",
"facilmap"
Expand All @@ -14,7 +13,9 @@
},
"license": "AGPL-3.0",
"author": "Candid Dauth <[email protected]>",
"main": "./dist/client.js",
"main": "./dist/facilmap-client.mjs",
"type": "module",
"types": "./dist/facilmap-client.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/FacilMap/facilmap.git"
Expand All @@ -26,23 +27,20 @@
"tsconfig.json"
],
"scripts": {
"build": "webpack",
"watch": "webpack --watch",
"build": "vite build",
"clean": "rimraf dist",
"dev-server": "webpack-dev-server --mode development"
"dev-server": "vite",
"check-types": "tsc -b --emitDeclarationOnly"
},
"dependencies": {
"facilmap-types": "3.4.0",
"socket.io-client": "^4.1.2"
"facilmap-types": "workspace:^",
"socket.io-client": "^4.7.4"
},
"devDependencies": {
"@types/geojson": "^7946.0.7",
"rimraf": "^3.0.2",
"source-map-loader": "^4.0.1",
"ts-loader": "^9.4.4",
"typescript": "^5.2.2",
"webpack": "^5.88.2",
"webpack-bundle-analyzer": "^4.9.1",
"webpack-cli": "^5.1.4"
"@types/geojson": "^7946.0.14",
"rimraf": "^5.0.5",
"typescript": "^5.4.2",
"vite": "^5.1.5",
"vite-plugin-dts": "^3.7.3"
}
}
Loading

0 comments on commit 64c9a2f

Please sign in to comment.