diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..f6940d1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@flare:registry=https://lab.code-rove.com/public-node-registry diff --git a/Dockerfile b/Dockerfile index 938cc39..ebade20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM node:24.9-alpine3.21 AS builder WORKDIR /app # Copy workspace configuration +COPY .npmrc .npmrc COPY package*.json ./ # Copy workspace package files @@ -13,6 +14,7 @@ COPY src/frontend/package*.json ./src/frontend/ # Install all dependencies (including devDependencies for build) RUN npm ci +RUN rm -f .npmrc # Copy source code COPY src/ ./src/ diff --git a/content/ReleaseNotes.json b/content/ReleaseNotes.json index a2259ba..d90b2d6 100644 --- a/content/ReleaseNotes.json +++ b/content/ReleaseNotes.json @@ -1,5 +1,43 @@ { "releases": [ + { + "version": "1.0.4", + "date": "2025-10-05T20:30:00Z", + "title": "Dependency Optimization - @flare/utiliyo Integration", + "summary": "Replaced local pathCombine utility with battle-tested @flare/utiliyo package, reducing code duplication and leveraging shared utilities.", + "sections": [ + { + "title": "Overview", + "content": "Version 1.0.4 optimizes frontend dependencies by integrating @flare/utiliyo, a shared utility package from the @flare ecosystem. This change eliminates duplicate code by replacing the local pathCombine implementation with a well-tested, maintained alternative from the custom npm registry." + }, + { + "title": "Dependency Management", + "items": [ + "**@flare/utiliyo Integration** - Added @flare/utiliyo v1.2.2 as frontend dependency", + "**Custom Registry Configuration** - Configured .npmrc for @flare scoped packages", + "**Code Deduplication** - Removed local pathCombine implementation (33 lines)", + "**Shared Utilities** - Leverages battle-tested path manipulation utilities" + ] + }, + { + "title": "Technical Changes", + "items": [ + "Added `.npmrc` in project root with `@flare:registry=https://lab.code-rove.com/public-node-registry`", + "Updated frontend package.json with `@flare/utiliyo: ^1.2.2` dependency" + ] + }, + { + "title": "Benefits", + "items": [ + "**Reduced Maintenance** - No need to maintain local path utilities", + "**Bug Fixes** - Automatic bug fixes from upstream package updates", + "**Feature Updates** - Access to new utilities as they're added", + "**Consistency** - Same path handling across multiple @flare projects", + "**Testing** - Leverages comprehensive test suite from utiliyo package" + ] + } + ] + }, { "version": "1.0.3", "date": "2025-10-05T16:30:00Z", diff --git a/package-lock.json b/package-lock.json index 3ee8c25..df1e18c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bitip", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bitip", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "workspaces": [ "src/backend", @@ -977,6 +977,12 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@flare/utiliyo": { + "version": "1.2.2", + "resolved": "https://lab.code-rove.com/public-node-registry/@flare/utiliyo/-/utiliyo-1.2.2.tgz", + "integrity": "sha512-NTre0lTmxZXkNM9sS8T28jhHjftycYDRGzpDh6aq1aOjbXQyzfn0VdexK/B82zvnv95Ba0jbQoqdoLia/62yXg==", + "license": "MIT" + }, "node_modules/@hapi/address": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-5.1.1.tgz", @@ -6646,7 +6652,7 @@ }, "src/backend": { "name": "bitip-backend", - "version": "1.0.2", + "version": "1.0.3", "dependencies": { "@maxmind/geoip2-node": "^6.1.0", "compression": "^1.7.4", @@ -7135,8 +7141,9 @@ }, "src/frontend": { "name": "bitip-frontend", - "version": "1.0.2", + "version": "1.0.3", "dependencies": { + "@flare/utiliyo": "^1.2.2", "axios": "^1.12.2", "leaflet": "^1.9.4", "lucide-react": "^0.544.0", diff --git a/package.json b/package.json index 352f8d8..7dfff32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bitip", - "version": "1.0.3", + "version": "1.0.4", "description": "Bitip - GeoIP Lookup Service with REST API and Web Interface", "main": "dist/backend/index.js", "scripts": { diff --git a/src/backend/package.json b/src/backend/package.json index c0fd3a3..99a5d01 100644 --- a/src/backend/package.json +++ b/src/backend/package.json @@ -1,6 +1,6 @@ { "name": "bitip-backend", - "version": "1.0.3", + "version": "1.0.4", "description": "Bitip Backend - GeoIP REST API Service", "type": "module", "main": "dist/index.js", diff --git a/src/frontend/package.json b/src/frontend/package.json index 5995794..2e7cf23 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -1,6 +1,6 @@ { "name": "bitip-frontend", - "version": "1.0.3", + "version": "1.0.4", "description": "Bitip Frontend - GeoIP Web Interface", "type": "module", "scripts": { @@ -12,6 +12,7 @@ "clean": "rimraf dist" }, "dependencies": { + "@flare/utiliyo": "^1.2.2", "axios": "^1.12.2", "leaflet": "^1.9.4", "lucide-react": "^0.544.0", diff --git a/src/frontend/public/env.js b/src/frontend/public/env.js new file mode 100644 index 0000000..3c6d70f --- /dev/null +++ b/src/frontend/public/env.js @@ -0,0 +1,8 @@ +// Runtime configuration generated at container startup +// DO NOT EDIT - This file is automatically generated +// eslint-disable-next-line no-undef +window.env = { + "BASE_PATH": "/", + "FRONTEND_API_KEY": "frontend-dev-key", + "DEBOUNCE_MS": 2000 +}; diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index c12a154..d67989a 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -7,7 +7,7 @@ import ExternalLinks from './components/ExternalLinks'; import BitipAPI from './services/api'; import './App.css'; import config from '@/services/config'; -import { pathCombine } from './utils'; +import { pathCombine } from '@flare/utiliyo'; interface VersionInfo { version: string; diff --git a/src/frontend/src/services/api.ts b/src/frontend/src/services/api.ts index 55dfaa0..3160436 100644 --- a/src/frontend/src/services/api.ts +++ b/src/frontend/src/services/api.ts @@ -8,7 +8,7 @@ import { OverviewResponse, } from '../types'; import config from './config'; -import { pathCombine } from '@/utils/paths'; +import { pathCombine } from '@flare/utiliyo'; const isDevelopment = config.MODE === 'development'; const BASE_URL = isDevelopment diff --git a/src/frontend/src/utils/index.ts b/src/frontend/src/utils/index.ts deleted file mode 100644 index 4a38559..0000000 --- a/src/frontend/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './paths'; diff --git a/src/frontend/src/utils/paths.ts b/src/frontend/src/utils/paths.ts deleted file mode 100644 index 5a98a69..0000000 --- a/src/frontend/src/utils/paths.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Combines multiple URL segments, ensuring proper slash handling - * @param segments - URL segments to combine (e.g., 'http://localhost:5172', '/api', 'health') - * @returns Combined URL path with proper slash separators - * @example - * pathCombine('http://localhost:5172', '/api', 'health') // 'http://localhost:5172/api/health' - * pathCombine('/base', 'api/', '/endpoint') // '/base/api/endpoint' - * pathCombine('/', '/api') // '/api' - */ -const pathCombine = (...segments: string[]): string => { - // Filter out null, undefined, and empty strings - const validSegments = segments.filter( - seg => seg !== null && seg !== undefined && seg !== '' - ); - - if (validSegments.length === 0) return ''; - if (validSegments.length === 1) return validSegments[0]; - - // Process first segment (keep leading slash or protocol) - let result = validSegments[0].replace(/\/+$/, ''); - - // Process middle and last segments - for (let i = 1; i < validSegments.length; i++) { - const segment = validSegments[i].replace(/^\/+|\/+$/g, ''); // Remove leading and trailing slashes - if (segment) { - // Only add non-empty segments - result += `/${segment}`; - } - } - - return result; -}; - -export { pathCombine };