Merge pull request #39 from trails-cool/fix-planner-production-server
This commit is contained in:
commit
0bab72dcd7
18 changed files with 38 additions and 43 deletions
|
|
@ -8,8 +8,6 @@
|
||||||
"exclude": ["build", "node_modules"],
|
"exclude": ["build", "node_modules"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDirs": [".", "./.react-router/types"],
|
"rootDirs": [".", "./.react-router/types"],
|
||||||
"noEmit": true,
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./app/*"]
|
"~/*": ["./app/*"]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { electHost } from "./host-election";
|
import { electHost } from "./host-election.ts";
|
||||||
|
|
||||||
function makeStates(
|
function makeStates(
|
||||||
entries: Array<{ id: number; user?: boolean; role?: string }>,
|
entries: Array<{ id: number; user?: boolean; role?: string }>,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { checkRateLimit } from "./rate-limit";
|
import { checkRateLimit } from "./rate-limit.ts";
|
||||||
|
|
||||||
describe("checkRateLimit", () => {
|
describe("checkRateLimit", () => {
|
||||||
it("allows requests within limit", () => {
|
it("allows requests within limit", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import * as Y from "yjs";
|
import * as Y from "yjs";
|
||||||
import type { YjsState } from "./use-yjs";
|
import type { YjsState } from "./use-yjs.ts";
|
||||||
import { electHost } from "./host-election";
|
import { electHost } from "./host-election.ts";
|
||||||
|
|
||||||
interface RouteStats {
|
interface RouteStats {
|
||||||
distance?: number;
|
distance?: number;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,15 @@
|
||||||
import { createRequestHandler } from "@react-router/node";
|
import { createRequestListener } from "@react-router/node";
|
||||||
import { createServer } from "node:http";
|
import { createServer } from "node:http";
|
||||||
import { setupYjsWebSocket } from "./app/lib/yjs-server.ts";
|
import { setupYjsWebSocket } from "./app/lib/yjs-server.ts";
|
||||||
|
|
||||||
const port = Number(process.env.PORT ?? 3001);
|
const port = Number(process.env.PORT ?? 3001);
|
||||||
|
|
||||||
const handler = createRequestHandler(
|
const listener = createRequestListener({
|
||||||
// @ts-expect-error - build output types
|
build: () => import("./build/server/index.js") as never,
|
||||||
await import("./build/server/index.js"),
|
|
||||||
);
|
|
||||||
|
|
||||||
const server = createServer((req, res) => {
|
|
||||||
handler(req, res);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const server = createServer(listener);
|
||||||
|
|
||||||
setupYjsWebSocket(server);
|
setupYjsWebSocket(server);
|
||||||
|
|
||||||
server.listen(port, () => {
|
server.listen(port, () => {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,6 @@
|
||||||
"exclude": ["build", "node_modules", "server.ts"],
|
"exclude": ["build", "node_modules", "server.ts"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"rootDirs": [".", "./.react-router/types"],
|
"rootDirs": [".", "./.react-router/types"],
|
||||||
"noEmit": true,
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./app/*"]
|
"~/*": ["./app/*"]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { reactRouter } from "@react-router/dev/vite";
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { yjsDevPlugin } from "./app/lib/vite-yjs-plugin";
|
import { yjsDevPlugin } from "./app/lib/vite-yjs-plugin.ts";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss(), reactRouter(), yjsDevPlugin()],
|
plugins: [tailwindcss(), reactRouter(), yjsDevPlugin()],
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { drizzle } from "drizzle-orm/postgres-js";
|
import { drizzle } from "drizzle-orm/postgres-js";
|
||||||
import postgres from "postgres";
|
import postgres from "postgres";
|
||||||
import * as plannerSchema from "./schema/planner";
|
import * as plannerSchema from "./schema/planner.ts";
|
||||||
import * as journalSchema from "./schema/journal";
|
import * as journalSchema from "./schema/journal.ts";
|
||||||
|
|
||||||
export function createDb(connectionString?: string) {
|
export function createDb(connectionString?: string) {
|
||||||
const client = postgres(
|
const client = postgres(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { generateGpx } from "./generate";
|
import { generateGpx } from "./generate.ts";
|
||||||
import { parseGpx } from "./parse";
|
import { parseGpx } from "./parse.ts";
|
||||||
|
|
||||||
describe("generateGpx", () => {
|
describe("generateGpx", () => {
|
||||||
it("generates valid GPX with name", () => {
|
it("generates valid GPX with name", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Waypoint } from "@trails-cool/types";
|
import type { Waypoint } from "@trails-cool/types";
|
||||||
import type { TrackPoint } from "./types";
|
import type { TrackPoint } from "./types.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a GPX XML string from waypoints and track points.
|
* Generate a GPX XML string from waypoints and track points.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export { parseGpx, parseGpxAsync } from "./parse";
|
export { parseGpx, parseGpxAsync } from "./parse.ts";
|
||||||
export { generateGpx } from "./generate";
|
export { generateGpx } from "./generate.ts";
|
||||||
export type { GpxData, TrackPoint, ElevationProfile } from "./types";
|
export type { GpxData, TrackPoint, ElevationProfile } from "./types.ts";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import { parseGpx } from "./parse";
|
import { parseGpx } from "./parse.ts";
|
||||||
|
|
||||||
const sampleGpx = `<?xml version="1.0" encoding="UTF-8"?>
|
const sampleGpx = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<gpx version="1.1" creator="test" xmlns="http://www.topografix.com/GPX/1/1">
|
<gpx version="1.1" creator="test" xmlns="http://www.topografix.com/GPX/1/1">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Waypoint } from "@trails-cool/types";
|
import type { Waypoint } from "@trails-cool/types";
|
||||||
import type { GpxData, TrackPoint, ElevationProfile } from "./types";
|
import type { GpxData, TrackPoint, ElevationProfile } from "./types.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a GPX XML string into structured data.
|
* Parse a GPX XML string into structured data.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import { initReactI18next } from "react-i18next";
|
import { initReactI18next } from "react-i18next";
|
||||||
import LanguageDetector from "i18next-browser-languagedetector";
|
import LanguageDetector from "i18next-browser-languagedetector";
|
||||||
import en from "./locales/en";
|
import en from "./locales/en.ts";
|
||||||
import de from "./locales/de";
|
import de from "./locales/de.ts";
|
||||||
|
|
||||||
export const defaultNS = "common";
|
export const defaultNS = "common";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
export { MapView } from "./MapView";
|
export { MapView } from "./MapView.tsx";
|
||||||
export type { MapViewProps } from "./MapView";
|
export type { MapViewProps } from "./MapView.tsx";
|
||||||
export { RouteLayer } from "./RouteLayer";
|
export { RouteLayer } from "./RouteLayer.tsx";
|
||||||
export type { RouteLayerProps } from "./RouteLayer";
|
export type { RouteLayerProps } from "./RouteLayer.tsx";
|
||||||
export { baseLayers } from "./layers";
|
export { baseLayers } from "./layers.ts";
|
||||||
export type { TileLayerConfig } from "./layers";
|
export type { TileLayerConfig } from "./layers.ts";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { describe, it, expect } from "vitest";
|
import { describe, it, expect } from "vitest";
|
||||||
import type { Waypoint, Route } from "./index";
|
import type { Waypoint, Route } from "./index.ts";
|
||||||
|
|
||||||
describe("types", () => {
|
describe("types", () => {
|
||||||
it("Waypoint type accepts valid data", () => {
|
it("Waypoint type accepts valid data", () => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
export { Button } from "./Button";
|
export { Button } from "./Button.tsx";
|
||||||
export type { ButtonProps } from "./Button";
|
export type { ButtonProps } from "./Button.tsx";
|
||||||
export { Input } from "./Input";
|
export { Input } from "./Input.tsx";
|
||||||
export type { InputProps } from "./Input";
|
export type { InputProps } from "./Input.tsx";
|
||||||
export { Card } from "./Card";
|
export { Card } from "./Card.tsx";
|
||||||
export type { CardProps } from "./Card";
|
export type { CardProps } from "./Card.tsx";
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"noUncheckedIndexedAccess": true
|
"noUncheckedIndexedAccess": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"allowImportingTsExtensions": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "build", "dist"]
|
"exclude": ["node_modules", "build", "dist"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue