Skip to content

Commit

Permalink
Fix declarations files generation (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebstryczek authored Jan 8, 2025
1 parent 9b377e6 commit 634f10a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@maptiler/elevation-profile-control",
"version": "3.0.0",
"version": "3.0.1",
"description": "Elevation profile control for MapTiler SDK",
"module": "dist/maptiler-elevation-profile-control.js",
"types": "dist/maptiler-elevation-profile-control.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/elevationprofilecontrol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import elevationIcon from "./images/elevation-icon.svg";
import elevationFillIcon from "./images/elevation_fill-icon.svg";
import type { GeoJsonObject } from "geojson";

import packagejson from "../package.json";
import { name, version } from "../package.json";

/**
* Elevation profile control options
Expand Down Expand Up @@ -84,7 +84,7 @@ export class ElevationProfileControl implements IControl {
}

onAdd(map: MapSDK): HTMLElement {
map.telemetry.registerModule(packagejson.name, packagejson.version);
map.telemetry.registerModule(name, version);

this.map = map;

Expand Down
13 changes: 7 additions & 6 deletions vite.config-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import dts from 'vite-plugin-dts';

const isProduction = process.env.NODE_ENV === "production";

const plugins = [
dts({insertTypesEntry: true}),
];

export default defineConfig({
mode: isProduction ? "production" : "development",
build: {
Expand Down Expand Up @@ -41,5 +37,10 @@ export default defineConfig({
},
},
},
plugins,
})
plugins: [
dts({
insertTypesEntry: true,
entryRoot: "src",
}),
],
});
19 changes: 6 additions & 13 deletions vite.config-umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,31 @@ import { defineConfig } from 'vite';

const isProduction = process.env.NODE_ENV === "production";

const plugins = [];


export default defineConfig({
mode: isProduction ? "production" : "development",
build: {
outDir: "build",
minify: isProduction,
sourcemap: !isProduction,
sourcemap: true,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'src/maptiler-elevation-profile-control.ts'),
name: 'maptilerelevationprofilecontrol',
// the proper extensions will be added
fileName: (format, entryName) => `${entryName}.${format}.js`,
fileName: (format, entryName) => `${entryName}.${format}.min.js`,
formats: ['umd'],
},

rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
// make sure to externalize deps that shouldn't be bundled into your library
external: [
"@maptiler/sdk"
],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
// Provide global variables to use in the UMD build for externalized deps
globals: {
"@maptiler/sdk": "maptilersdk",
},
},
},
},
plugins,
})
plugins: [],
});

0 comments on commit 634f10a

Please sign in to comment.