Skip to content

Commit

Permalink
Merge pull request #375 from headwaymaps/mkirk/update-deps-2024-12-12
Browse files Browse the repository at this point in the history
update deps again
  • Loading branch information
michaelkirk authored Dec 13, 2024
2 parents d3abc38 + b674373 commit 5ac79d4
Show file tree
Hide file tree
Showing 14 changed files with 1,150 additions and 841 deletions.
1 change: 1 addition & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
node-version: 20
- run: npm install --global yarn
- run: yarn install
- run: yarn quasar prepare
- run: yarn lint
- run: yarn format-check
- run: yarn tsc
Expand Down
9 changes: 5 additions & 4 deletions services/frontend/www-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,24 @@
"dev": "quasar dev"
},
"dependencies": {
"@fragaria/address-formatter": "^5.2.1",
"@fragaria/address-formatter": "^6.3.0",
"@quasar/extras": "^1.16.9",
"@types/mime": "4.0.0",
"lodash": "^4.17.21",
"maplibre-gl": "^4.0.0",
"opening_hours": "^3.8.0",
"quasar": "^2.14.3",
"vue": "^3.4.15",
"vue-i18n": "^9.9.1",
"vue-i18n": "^10.0.5",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@eslint/js": "^9.16.0",
"@quasar/app-vite": "^1.7.3",
"@quasar/app-vite": "^2.0.1",
"@quasar/quasar-app-extension-testing": "^2.0.4",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.16",
"@types/node": "^22.10.2",
"autoprefixer": "^10.4.17",
"babel-jest": "^29.7.0",
"eslint": "^9.16.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// Configuration for your app
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js

const { configure } = require('quasar/wrappers');
import { defineConfig } from '#q-app/wrappers';

const HEADWAY_HOST = 'https://maps.earth';

module.exports = configure(function (/* ctx */) {
export default defineConfig((/* ctx */) => {
return {
eslint: {
// fix: true,
Expand Down Expand Up @@ -55,6 +55,12 @@ module.exports = configure(function (/* ctx */) {
node: 'node16',
},

typescript: {
strict: true,
vueShim: true,
// extendsTsConfig (tsConfig) {}
},

vueRouterMode: 'history', // available values: 'hash', 'history'
// Dev: Use this where we don't have mod_rewrite, otherwise refreshing page with path 404's
// vueRouterMode: 'hash',
Expand All @@ -77,22 +83,20 @@ module.exports = configure(function (/* ctx */) {
// extendViteConf (viteConf) {},
// viteVuePluginOptions: {},

chainWebpack: (chain) => {
chain.module
.rule('i18n-resource')
.test(/\.(json5?|ya?ml)$/)
.include.add(path.resolve(__dirname, './src/i18n'))
.end()
.type('javascript/auto')
.use('i18n-resource')
.loader('@intlify/vue-i18n-loader');
chain.module
.rule('i18n')
.resourceQuery(/blockType=i18n/)
.type('javascript/auto')
.use('i18n')
.loader('@intlify/vue-i18n-loader');
},
vitePlugins: [
[
'vite-plugin-checker',
{
vueTsc: true,
eslint: {
lintCommand:
'eslint -c ./eslint.config.js "./src*/**/*.{ts,js,mjs,cjs,vue}"',
useFlatConfig: true,
},
},
{ server: false },
],
],
},

// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/www-app/src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ body.mobile {
.top-card {
border-bottom: solid #ccc 1px;
padding: 16px;
@media screen and (max-width: 799px) {
order: 1;
Expand All @@ -69,7 +70,6 @@ body.mobile {
order: 1;
width: var(--left-panel-width);
}
padding: 16px;
}
.bottom-card {
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/www-app/src/models/OpeningHours.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test('weeklyRanges', () => {

for (const dayInterval of ranges) {
expect(dayInterval.intervals.length).toBe(1);
const interval = dayInterval.intervals[0];
const interval = dayInterval.intervals[0]!;
switch (dayInterval.day) {
case 'Sun':
case 'Mon':
Expand Down
38 changes: 20 additions & 18 deletions services/frontend/www-app/src/models/Place.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ import OSMID from './OSMID';
/// PlaceId can be either a LngLat or a gid (but not both).
type GID = string;
export class PlaceId {
public readonly location?: LngLat;
public readonly gid?: GID;
public readonly location?: LngLat | undefined;
public readonly gid?: GID | undefined;

constructor(location?: LngLat, gid?: GID) {
if (location && gid) {
throw new Error('PlaceId cannot have both location and gid');
}
if (!location && !gid) {
if (location) {
this.location = location;
} else if (gid) {
this.gid = gid;
} else {
throw new Error('PlaceId requires either location or gid');
}

this.location = location;
this.gid = gid;
}

static location(location: LngLat): PlaceId {
Expand Down Expand Up @@ -49,7 +47,11 @@ export class PlaceId {
public static deserialize(serialized: string): PlaceId {
if (/([0-9.-]+,[0-9.-]+)/.test(serialized)) {
const lngLat = serialized.split(',');
const location = new LngLat(parseFloat(lngLat[0]), parseFloat(lngLat[1]));
console.assert!(lngLat.length == 2, 'unexpected length', lngLat);
const location = new LngLat(
parseFloat(lngLat[0]!),
parseFloat(lngLat[1]!),
);
return PlaceId.location(location);
} else {
return PlaceId.gid(serialized);
Expand Down Expand Up @@ -156,13 +158,13 @@ type PlaceProperties = {
export default class Place {
id: PlaceId;
point: LngLat;
bbox?: LngLatBounds;
countryCode?: string;
public address?: string | null;
name?: string;
public phone?: string;
public website?: string;
public openingHours?: string;
bbox?: LngLatBounds | undefined;
countryCode?: string | undefined;
public address?: string | null | undefined;
name?: string | undefined;
public phone?: string | undefined;
public website?: string | undefined;
public openingHours?: string | undefined;

constructor(
id: PlaceId,
Expand Down Expand Up @@ -192,7 +194,7 @@ export default class Place {
const [lng, lat] = geometry.coordinates;
console.assert(lng, 'missing lng');
console.assert(lat, 'missing lat');
const location = new LngLat(lng, lat);
const location = new LngLat(lng!, lat!);

let bbox;
if (feature.bbox?.length == 4) {
Expand Down
9 changes: 6 additions & 3 deletions services/frontend/www-app/src/models/Route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default class Route {
mode: TravelMode,
distanceUnits: DistanceUnits,
): Route {
const viaRoads = substantialRoadNames(route.legs[0].maneuvers, 3);
console.assert(route.legs.length > 0, 'missing legs');
const viaRoads = substantialRoadNames(route.legs[0]!.maneuvers, 3);
return new Route({
mode,
valhallaRoute: route,
Expand All @@ -55,7 +56,8 @@ function substantialRoadNames(
cumulativeRoadLength += length;
if (maneuver.street_names) {
const name = maneuver.street_names[0];
roadLengths.push({ name, length });
console.assert(name, 'missing street name');
roadLengths.push({ name: name!, length });
}
}
roadLengths.sort((a, b) => b.length - a.length).slice(0, limit);
Expand All @@ -67,7 +69,8 @@ function substantialRoadNames(
);

if (substantialRoads.length == 0) {
substantialRoads = [roadLengths[0]];
console.assert(roadLengths.length > 0);
substantialRoads = [roadLengths[0]!];
}

return substantialRoads.map((r) => r.name);
Expand Down
4 changes: 2 additions & 2 deletions services/frontend/www-app/src/models/Trip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ export class TripLeg {
}

get start(): LngLat {
const lngLat = this.geometry.coordinates[0];
return new LngLat(lngLat[0], lngLat[1]);
const lngLat = this.geometry.coordinates[0]!;
return new LngLat(lngLat[0]!, lngLat[1]!);
}

get mode(): TravelMode {
Expand Down
11 changes: 0 additions & 11 deletions services/frontend/www-app/src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ const routes: RouteRecordRaw[] = [
},
],
},
// DEPRECATED ROUTE: will remove eventually
{
path: '/multimodal/:to/:from',
redirect: (route) => {
return {
path: `/directions/transit/${encodeURIComponent(
route.params.to.toString(),
)}/${encodeURIComponent(route.params.from.toString())}`,
};
},
},

// Always leave this as last one,
// but you can also remove it
Expand Down
4 changes: 2 additions & 2 deletions services/frontend/www-app/src/ui/LocationControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ export default class LocationControl extends Evented implements IControl {
currentRotation = 0;
compassMarker: Marker;

mostRecentPosition?: LngLat;
mostRecentPosition?: LngLat | undefined;
mostRecentCompassHeading?: number;
map?: Map;
map?: Map | undefined;

constructor(options: GeolocateControlOptions) {
super();
Expand Down
4 changes: 2 additions & 2 deletions services/frontend/www-app/src/ui/ScaleControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const defaultOptions: ScaleOptions = {
};

export default class ScaleControl implements IControl {
_map?: Map;
_map?: Map | undefined;
containerEl: HTMLElement;
rulerEl: HTMLElement;
textEl: HTMLElement;
Expand Down Expand Up @@ -119,7 +119,7 @@ export default class ScaleControl implements IControl {
// When I try to measure somewhat acurately, I pan the area I want to measure
// near to the ruler. So, I think the most reasonable thing is to make sure
// that the ruler is to scale with the land directly beneath it.
const rulerBounds = this.rulerEl.getClientRects()[0];
const rulerBounds = this.rulerEl.getClientRects()[0]!;
const y = rulerBounds.y;
const left = map.unproject([0, y]);
const right = map.unproject([maxWidth, y]);
Expand Down
12 changes: 6 additions & 6 deletions services/frontend/www-app/src/utils/decodePolyline.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ test('decode', () => {
const result = decodePolyline(input, 6);

expect(result.length).toBe(350);
const firstCoord = result[0];
expect(firstCoord[0]).toBeCloseTo(-122.339216);
expect(firstCoord[1]).toBeCloseTo(47.575836);
const firstCoord = result[0]!;
expect(firstCoord[0]!).toBeCloseTo(-122.339216);
expect(firstCoord[1]!).toBeCloseTo(47.575836);

const lastCoord = result[349];
expect(lastCoord[0]).toBeCloseTo(-122.347199);
expect(lastCoord[1]).toBeCloseTo(47.651048);
const lastCoord = result[349]!;
expect(lastCoord[0]!).toBeCloseTo(-122.347199);
expect(lastCoord[1]!).toBeCloseTo(47.651048);
});
2 changes: 1 addition & 1 deletion services/frontend/www-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@quasar/app-vite/tsconfig-preset",
"extends": "./.quasar/tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
Expand Down
Loading

0 comments on commit 5ac79d4

Please sign in to comment.