Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dist.svelte
*.sw?

*.tgz
src/info.json
48 changes: 24 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maptiler/geocoding-control",
"version": "2.1.1",
"version": "2.1.2",
"description": "The Javascript & TypeScript Map Control component for MapTiler Geocoding service. Easy to be integrated into any JavaScript mapping application.",
"type": "module",
"author": {
Expand Down Expand Up @@ -32,7 +32,7 @@
],
"scripts": {
"dev": "vite --host",
"build": "npm run check && concurrently --names \"SVELTE ,MAPLIBRE,MAPTILER,MAPLIB-C,LEAFLET ,LEAFLE-C,OL ,OL-C ,REACT ,TYPES ,VANILLA \" \"npm run build-svelte\" \"npm run build-maplibre\" \"npm run build-maptilersdk\" \"npm run build-maplibre-controller\" \"npm run build-leaflet\" \"npm run build-leaflet-controller\" \"npm run build-openlayers\" \"npm run build-openlayers-controller\" \"npm run build-react\" \"npm run build-vanilla\" \"npm run build-types\" && cp LICENSE README.md package.json dist && cp -r dist.svelte dist/svelte",
"build": "node sync-info.js run && npm run check && concurrently --names \"SVELTE ,MAPLIBRE,MAPTILER,MAPLIB-C,LEAFLET ,LEAFLE-C,OL ,OL-C ,REACT ,TYPES ,VANILLA \" \"npm run build-svelte\" \"npm run build-maplibre\" \"npm run build-maptilersdk\" \"npm run build-maplibre-controller\" \"npm run build-leaflet\" \"npm run build-leaflet-controller\" \"npm run build-openlayers\" \"npm run build-openlayers-controller\" \"npm run build-react\" \"npm run build-vanilla\" \"npm run build-types\" && cp LICENSE README.md package.json dist && cp -r dist.svelte dist/svelte",
"build-svelte": "svelte-package -i src -o dist.svelte && VITE_LIB_VERSION=$npm_package_version node replace-env-vars.js",
"build-maptilersdk": "FLAVOUR=maptilersdk vite build",
"build-maplibre": "FLAVOUR=maplibre vite build",
Expand Down Expand Up @@ -109,13 +109,13 @@
"@types/geojson": "^7946.0.15",
"@types/leaflet": "^1.9.16",
"@types/node": "^22.10.5",
"@types/react": "^19.0.3",
"@types/react": "^19.0.4",
"@types/react-dom": "^19.0.2",
"concurrently": "^9.1.2",
"dotenv": "^16.4.7",
"eslint": "^9.17.0",
"eslint-plugin-svelte": "^2.46.1",
"esm-env": "^1.2.1",
"esm-env": "^1.2.2",
"globals": "^15.14.0",
"husky": "^9.1.7",
"leaflet": "^1.9.4",
Expand All @@ -130,10 +130,10 @@
"replace-in-file": "^8.3.0",
"sass": "^1.83.1",
"svelte": "^4.2.19",
"svelte-check": "^4.1.1",
"svelte-check": "^4.1.3",
"svelte-preprocess": "^6.0.3",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript": "^5.7.3",
"typescript-eslint": "^8.19.1",
"vite": "^5.4.11"
},
Expand Down
2 changes: 1 addition & 1 deletion src/maptilersdk.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as maptilersdk from "@maptiler/sdk";
import type * as maplibregl from "maplibre-gl";
import type { Map } from "maplibre-gl";
import { name, version } from "../package.json";
import {
crateClasses,
type MapLibreBaseControlOptions,
} from "./MapLibreBasedGeocodingControl";
import { name, version } from "./info.json";

export { createMapLibreGlMapController } from "./maplibregl-controller";

Expand Down
21 changes: 21 additions & 0 deletions sync-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import fs from "fs";
import path from "path";
import { argv } from "process";

export function syncInfo() {
const packageJson = JSON.parse(
fs.readFileSync(path.resolve(import.meta.dirname, "package.json"), "utf-8"),
);

fs.writeFileSync(
path.resolve(import.meta.dirname, "src/info.json"),
JSON.stringify({
name: packageJson.name,
version: packageJson.version,
}),
);
}

if (argv[2] === "run") {
syncInfo();
}
3 changes: 1 addition & 2 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
"resolveJsonModule": true
},
"include": ["src/*.d.ts", "src/*.ts", "src/*.js", "src/*.svelte"],
"references": [{ "path": "./tsconfig.node.json" }],
"resolveJsonModule": true
"references": [{ "path": "./tsconfig.node.json" }]
}
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
import process from "node:process";
import { sveltePreprocess } from "svelte-preprocess";
import { BuildOptions, defineConfig } from "vite";
import { syncInfo } from "./sync-info";

const libs = {
leaflet: {
Expand Down Expand Up @@ -109,6 +110,10 @@ if (flavour) {
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
{
name: "sync-info",
buildStart: syncInfo,
},
svelte({
preprocess: sveltePreprocess(),
}),
Expand Down