Updated circle ci
This commit is contained in:
parent
e220e23b24
commit
dedeea470f
@ -17,7 +17,7 @@ jobs:
|
|||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Install Dependancies
|
name: Install Dependancies
|
||||||
command: yarn
|
command: npm install
|
||||||
|
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: v1-dependencies-{{ checksum "package.json" }}
|
key: v1-dependencies-{{ checksum "package.json" }}
|
||||||
@ -26,7 +26,7 @@ jobs:
|
|||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Build
|
name: Build
|
||||||
command: yarn build --prod
|
command: npm run build --prod
|
||||||
|
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: ~/repo
|
root: ~/repo
|
||||||
@ -51,7 +51,7 @@ jobs:
|
|||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Deploy
|
name: Deploy
|
||||||
command: yarn deploy
|
command: npm run deploy
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
|
2143
functions/package-lock.json
generated
Normal file
2143
functions/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
functions/package.json
Normal file
26
functions/package.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "functions",
|
||||||
|
"scripts": {
|
||||||
|
"lint": "tslint --project tsconfig.json",
|
||||||
|
"build": "tsc",
|
||||||
|
"serve": "npm run build && firebase serve --only functions",
|
||||||
|
"shell": "npm run build && firebase functions:shell",
|
||||||
|
"start": "npm run shell",
|
||||||
|
"deploy": "firebase deploy --only functions",
|
||||||
|
"logs": "firebase functions:log"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "8"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"cors": "^2.8.1",
|
||||||
|
"firebase-admin": "^8.0.0",
|
||||||
|
"firebase-functions": "^3.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"tslint": "^5.12.0",
|
||||||
|
"typescript": "^3.2.2"
|
||||||
|
},
|
||||||
|
"private": true
|
||||||
|
}
|
15
functions/tsconfig.json
Normal file
15
functions/tsconfig.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"outDir": "lib",
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true,
|
||||||
|
"target": "es2017"
|
||||||
|
},
|
||||||
|
"compileOnSave": true,
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
]
|
||||||
|
}
|
115
functions/tslint.json
Normal file
115
functions/tslint.json
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
{
|
||||||
|
"rules": {
|
||||||
|
// -- Strict errors --
|
||||||
|
// These lint rules are likely always a good idea.
|
||||||
|
|
||||||
|
// Force function overloads to be declared together. This ensures readers understand APIs.
|
||||||
|
"adjacent-overload-signatures": true,
|
||||||
|
|
||||||
|
// Do not allow the subtle/obscure comma operator.
|
||||||
|
"ban-comma-operator": true,
|
||||||
|
|
||||||
|
// Do not allow internal modules or namespaces . These are deprecated in favor of ES6 modules.
|
||||||
|
"no-namespace": true,
|
||||||
|
|
||||||
|
// Do not allow parameters to be reassigned. To avoid bugs, developers should instead assign new values to new vars.
|
||||||
|
"no-parameter-reassignment": true,
|
||||||
|
|
||||||
|
// Force the use of ES6-style imports instead of /// <reference path=> imports.
|
||||||
|
"no-reference": true,
|
||||||
|
|
||||||
|
// Do not allow type assertions that do nothing. This is a big warning that the developer may not understand the
|
||||||
|
// code currently being edited (they may be incorrectly handling a different type case that does not exist).
|
||||||
|
"no-unnecessary-type-assertion": true,
|
||||||
|
|
||||||
|
// Disallow nonsensical label usage.
|
||||||
|
"label-position": true,
|
||||||
|
|
||||||
|
// Disallows the (often typo) syntax if (var1 = var2). Replace with if (var2) { var1 = var2 }.
|
||||||
|
"no-conditional-assignment": true,
|
||||||
|
|
||||||
|
// Disallows constructors for primitive types (e.g. new Number('123'), though Number('123') is still allowed).
|
||||||
|
"no-construct": true,
|
||||||
|
|
||||||
|
// Do not allow super() to be called twice in a constructor.
|
||||||
|
"no-duplicate-super": true,
|
||||||
|
|
||||||
|
// Do not allow the same case to appear more than once in a switch block.
|
||||||
|
"no-duplicate-switch-case": true,
|
||||||
|
|
||||||
|
// Do not allow a variable to be declared more than once in the same block. Consider function parameters in this
|
||||||
|
// rule.
|
||||||
|
"no-duplicate-variable": [true, "check-parameters"],
|
||||||
|
|
||||||
|
// Disallows a variable definition in an inner scope from shadowing a variable in an outer scope. Developers should
|
||||||
|
// instead use a separate variable name.
|
||||||
|
"no-shadowed-variable": true,
|
||||||
|
|
||||||
|
// Empty blocks are almost never needed. Allow the one general exception: empty catch blocks.
|
||||||
|
"no-empty": [true, "allow-empty-catch"],
|
||||||
|
|
||||||
|
// Functions must either be handled directly (e.g. with a catch() handler) or returned to another function.
|
||||||
|
// This is a major source of errors in Cloud Functions and the team strongly recommends leaving this rule on.
|
||||||
|
"no-floating-promises": true,
|
||||||
|
|
||||||
|
// Do not allow any imports for modules that are not in package.json. These will almost certainly fail when
|
||||||
|
// deployed.
|
||||||
|
"no-implicit-dependencies": true,
|
||||||
|
|
||||||
|
// The 'this' keyword can only be used inside of classes.
|
||||||
|
"no-invalid-this": true,
|
||||||
|
|
||||||
|
// Do not allow strings to be thrown because they will not include stack traces. Throw Errors instead.
|
||||||
|
"no-string-throw": true,
|
||||||
|
|
||||||
|
// Disallow control flow statements, such as return, continue, break, and throw in finally blocks.
|
||||||
|
"no-unsafe-finally": true,
|
||||||
|
|
||||||
|
// Expressions must always return a value. Avoids common errors like const myValue = functionReturningVoid();
|
||||||
|
"no-void-expression": [true, "ignore-arrow-function-shorthand"],
|
||||||
|
|
||||||
|
// Disallow duplicate imports in the same file.
|
||||||
|
"no-duplicate-imports": true,
|
||||||
|
|
||||||
|
|
||||||
|
// -- Strong Warnings --
|
||||||
|
// These rules should almost never be needed, but may be included due to legacy code.
|
||||||
|
// They are left as a warning to avoid frustration with blocked deploys when the developer
|
||||||
|
// understand the warning and wants to deploy anyway.
|
||||||
|
|
||||||
|
// Warn when an empty interface is defined. These are generally not useful.
|
||||||
|
"no-empty-interface": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Warn when an import will have side effects.
|
||||||
|
"no-import-side-effect": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Warn when variables are defined with var. Var has subtle meaning that can lead to bugs. Strongly prefer const for
|
||||||
|
// most values and let for values that will change.
|
||||||
|
"no-var-keyword": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Prefer === and !== over == and !=. The latter operators support overloads that are often accidental.
|
||||||
|
"triple-equals": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Warn when using deprecated APIs.
|
||||||
|
"deprecation": {"severity": "warning"},
|
||||||
|
|
||||||
|
// -- Light Warnings --
|
||||||
|
// These rules are intended to help developers use better style. Simpler code has fewer bugs. These would be "info"
|
||||||
|
// if TSLint supported such a level.
|
||||||
|
|
||||||
|
// prefer for( ... of ... ) to an index loop when the index is only used to fetch an object from an array.
|
||||||
|
// (Even better: check out utils like .map if transforming an array!)
|
||||||
|
"prefer-for-of": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Warns if function overloads could be unified into a single function with optional or rest parameters.
|
||||||
|
"unified-signatures": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Prefer const for values that will not change. This better documents code.
|
||||||
|
"prefer-const": {"severity": "warning"},
|
||||||
|
|
||||||
|
// Multi-line object literals and function calls should have a trailing comma. This helps avoid merge conflicts.
|
||||||
|
"trailing-comma": {"severity": "warning"}
|
||||||
|
},
|
||||||
|
|
||||||
|
"defaultSeverity": "error"
|
||||||
|
}
|
@ -38,6 +38,7 @@
|
|||||||
"leaflet-polylinedecorator": "^1.6.0",
|
"leaflet-polylinedecorator": "^1.6.0",
|
||||||
"leaflet-rotatedmarker": "^0.2.0",
|
"leaflet-rotatedmarker": "^0.2.0",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
|
"momentjs": "^2.0.0",
|
||||||
"ng-click-outside": "^5.0.0",
|
"ng-click-outside": "^5.0.0",
|
||||||
"ngx-color-picker": "^8.1.0",
|
"ngx-color-picker": "^8.1.0",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "~6.4.0",
|
||||||
|
@ -53,6 +53,10 @@ export interface Polyline extends MapSymbol {
|
|||||||
weight?: number;
|
weight?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Position extends Marker {
|
||||||
|
timestamp?: Date;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Rectangle extends MapSymbol {
|
export interface Rectangle extends MapSymbol {
|
||||||
latlng: LatLng;
|
latlng: LatLng;
|
||||||
latlng2: LatLng;
|
latlng2: LatLng;
|
||||||
|
@ -1,21 +1,20 @@
|
|||||||
export const Nouns = [
|
export const Nouns = [
|
||||||
'puma',
|
'Puma',
|
||||||
'otter',
|
'Otter',
|
||||||
'chimpanzee',
|
'Chimpanzee',
|
||||||
'crab',
|
'Crab',
|
||||||
'elephant',
|
'Elephant',
|
||||||
'lizard',
|
'Lizard',
|
||||||
'lemur',
|
'Lemur',
|
||||||
'ram',
|
'Ram',
|
||||||
'mandrill',
|
'Raccoon',
|
||||||
'raccoon',
|
'Crocodile',
|
||||||
'crocodile',
|
'Hedgehog',
|
||||||
'hedgehog',
|
'Hippopotamus',
|
||||||
'hippopotamus',
|
'Badger',
|
||||||
'badger',
|
'Iguana',
|
||||||
'iguana',
|
'Camel',
|
||||||
'camel',
|
'Frog',
|
||||||
'frog',
|
'Cougar',
|
||||||
'cougar',
|
'Ferret'
|
||||||
'ferret'
|
|
||||||
];
|
];
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import {Injectable} from "@angular/core";
|
import {Injectable} from "@angular/core";
|
||||||
import {AngularFirestore, AngularFirestoreDocument} from "@angular/fire/firestore";
|
import {AngularFirestore, AngularFirestoreDocument} from "@angular/fire/firestore";
|
||||||
import {BehaviorSubject, combineLatest, Subscription} from "rxjs";
|
import {BehaviorSubject, combineLatest, Subscription} from "rxjs";
|
||||||
import {Circle, MapData, MapSymbol, Marker, Measurement, Polygon, Polyline, Rectangle} from "../models/mapSymbol";
|
import {Circle, MapData, MapSymbol, Marker, Measurement, Polygon, Polyline, Position, Rectangle} from "../models/mapSymbol";
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import {map} from "rxjs/operators";
|
import {map} from "rxjs/operators";
|
||||||
|
import * as firebase from "firebase";
|
||||||
|
|
||||||
export const LOCATION_COLLECTION = 'Users';
|
export const LOCATION_COLLECTION = 'Users';
|
||||||
export const MAP_COLLECTION = 'Maps';
|
export const MAP_COLLECTION = 'Maps';
|
||||||
@ -49,7 +50,8 @@ export class SyncService {
|
|||||||
this.addMapSymbol(measurement, 'measurements');
|
this.addMapSymbol(measurement, 'measurements');
|
||||||
}
|
}
|
||||||
|
|
||||||
addMyLocation(location: Marker) {
|
addMyLocation(location: Position) {
|
||||||
|
location.timestamp = new Date();
|
||||||
let markForSave = this.location == null;
|
let markForSave = this.location == null;
|
||||||
if(!this.locationChanged) this.locationChanged = !_.isEqual(this.location, location);
|
if(!this.locationChanged) this.locationChanged = !_.isEqual(this.location, location);
|
||||||
if(this.locationChanged) this.location = location;
|
if(this.locationChanged) this.location = location;
|
||||||
@ -78,9 +80,9 @@ export class SyncService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
load(mapCode: string, username: string) {
|
load(mapCode: string, username: string) {
|
||||||
let ignore = this.unload();
|
|
||||||
this.mapDoc = this.db.collection(MAP_COLLECTION).doc(mapCode);
|
this.mapDoc = this.db.collection(MAP_COLLECTION).doc(mapCode);
|
||||||
this.locationDoc = this.mapDoc.collection(LOCATION_COLLECTION).doc(username);
|
this.locationDoc = this.mapDoc.collection(LOCATION_COLLECTION).doc(username);
|
||||||
|
firebase.database().ref(`${MAP_COLLECTION}/mapCode/${LOCATION_COLLECTION}/username`).onDisconnect().remove();
|
||||||
|
|
||||||
this.mapSub = combineLatest(this.mapDoc.valueChanges(), this.mapDoc.collection(LOCATION_COLLECTION).snapshotChanges())
|
this.mapSub = combineLatest(this.mapDoc.valueChanges(), this.mapDoc.collection(LOCATION_COLLECTION).snapshotChanges())
|
||||||
.pipe(map(data => {
|
.pipe(map(data => {
|
||||||
|
@ -4790,6 +4790,11 @@ mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimist "0.0.8"
|
minimist "0.0.8"
|
||||||
|
|
||||||
|
momentjs@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/momentjs/-/momentjs-2.0.0.tgz#73df904b4fa418f6e3c605e831cef6ed5518ebd4"
|
||||||
|
integrity sha1-c9+QS0+kGPbjxgXoMc727VUY69Q=
|
||||||
|
|
||||||
morgan@^1.8.2:
|
morgan@^1.8.2:
|
||||||
version "1.9.1"
|
version "1.9.1"
|
||||||
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59"
|
resolved "https://registry.yarnpkg.com/morgan/-/morgan-1.9.1.tgz#0a8d16734a1d9afbc824b99df87e738e58e2da59"
|
||||||
|
Loading…
Reference in New Issue
Block a user