diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 9854b53d..ab49e229 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -15,7 +15,6 @@ module.exports = { rules: { "@typescript-eslint/ban-ts-comment": "warn", "prettier/prettier": "error", - "@typescript-eslint/no-explicit-any": "warn" }, ignorePatterns: tsConfig.exclude, }; diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..e18eade2 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +## Objective +What is the goal? + +## Description +What changed, how and why? + +## Acceptance +How were changes tested? + +## Checklist +- [ ] I have added relevant info to the CHANGELOG.md \ No newline at end of file diff --git a/.github/workflows/format-lint.yml b/.github/workflows/format-lint.yml new file mode 100644 index 00000000..3359dd1a --- /dev/null +++ b/.github/workflows/format-lint.yml @@ -0,0 +1,24 @@ +name: Format and Lint + +on: [pull_request] + +jobs: + format-and-lint: + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install Node.js dependencies + run: npm ci + + - name: Formatting with Prettier + run: npm run format + + - name: Linting with ESLint + run: npm run lint \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a2d40e4a..4f8c9739 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,37 +1,77 @@ -# Changelog - -## [v1.1.1](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.1.1) -- VER update to `maplibre-gl@3.1.0` - -## [v1.1.0](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.1.0) -- VER updated from `maplibre-gl@3.0.0-pre.4` to `maplibre-gl@3.0.1` (this includes the switch to WebGL2) -- UP made the few necessary changes acording to updating the ML v3. No braking change for SDK API -- FIX the MapTiler logo rel name and its nofollow feature -- ADD bringing back Map's `options.transformRequest` and `.setTransformRequest()` - - -## [v1.0.12](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.12) -- ADD a new language flag `Language.STYLE_LOCK` to force keep the language form the style and prevent any further update. Can be at a sigle map instance level (via constuctor option `language`) or via global config (`config.primaryLanguage`) -- FIX the fallback language was `{name:latin}`, it is now replaced by `{name}`, which is for the local name (present by default for many places while `latin` is less frequent). - -## [v1.0.11](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.11) -- DOC update for `Map`'s `option.maptilerLogo` that was a bit unclear -- FIX now exporting `MaptilerNavigationControl` - -## [v1.0.10](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.10) -- ADD terrain growing animation on enabling/disabling -- ADD `Map` custom event `loadWithTerrain` -- ADD `Map` lifecycle methods `.onLoadAsync()` and `.onLoadWithTerrainAsync()` -- DOC readme section was added about the event an methods above -- VER updated from `maplibre-gl@3.0.0-pre.3` to `maplibre-gl@3.0.0-pre.4` -- VER updated from `typedoc@0.23.21` to `typedoc@0.24.4`, which changes slightly the look of the reference documentation. -- VER updated from `typescript@4.8.4` to `typescript@5.0.4` -- VER updated from `rollup@2.79.0` to `rollup@3.20.6` as well as all the Rollup plugins - -## [v1.0.9](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.9) -- FIX: if the geolocate option is missing from `Map` constructor, then it's considered `false` - -- FIX: The instance types for the following MapLibre classes are now fully exported: +# MapTiler SDK Changelog + +## DEVEL +### New Features +### Bug Fixes +### Others + +## 1.2.0 +### New Features +- Added the Minimap control https://github.com/maptiler/maptiler-sdk-js/pull/54 +- Added vector layer helpers to create easier: + - point layer (https://github.com/maptiler/maptiler-sdk-js/pull/61) + - heatmap layer (https://github.com/maptiler/maptiler-sdk-js/pull/61) + - polyline layer, including parsing from GPX/KML (https://github.com/maptiler/maptiler-sdk-js/pull/51) + - polygon layer (https://github.com/maptiler/maptiler-sdk-js/pull/56) +- Add the `ColorRamp` class to create and customize color ramps, as well as `ColorRampCollection` with many predefined ones (as part of https://github.com/maptiler/maptiler-sdk-js/pull/61) +- Improved the language management for increased compatibility with [MapTiler Customize](https://cloud.maptiler.com/maps/editor/) (https://github.com/maptiler/maptiler-sdk-js/pull/58) +### Bug Fixes +- Fixed type export (https://github.com/maptiler/maptiler-sdk-js/pull/47) +### Others +- Upgrade to MapLibre v3.5.2 (https://github.com/maptiler/maptiler-sdk-js/pull/63) +- Update of TypeScript configuration `moduleResolution` to `Bundler` (https://github.com/maptiler/maptiler-sdk-js/pull/62) + +## 1.1.2 +### Bug Fixes +- Now using a fixed version of MapLibre GL. No longer use `^` because this caused issues as MapLibre made minor/patch update that were not backward compatible + +## 1.1.1 +### Others +- Update to `maplibre-gl@3.1.0` + +## 1.1.0 +### New Features +- Bringing back Map's `options.transformRequest` and `.setTransformRequest()` +### Bug Fixes +- Fixed the MapTiler logo rel name and its nofollow feature +- Made the few necessary changes acording to updating the ML v3. No braking change for SDK API +### Others +- Updated from `maplibre-gl@3.0.0-pre.4` to `maplibre-gl@3.0.1` (this includes the switch to WebGL2) + + +## 1.0.12 +### New Features +- Added a new language flag `Language.STYLE_LOCK` to force keep the language form the style and prevent any further update. Can be at a sigle map instance level (via constuctor option `language`) or via global config (`config.primaryLanguage`) +### Bug Fixes +- The fallback language was `{name:latin}`, it is now replaced by `{name}`, which is for the local name (present by default for many places while `latin` is less frequent). + +## 1.0.11 +### Bug Fixes +- Now exporting `MaptilerNavigationControl` +### Others +- Documentation update for `Map`'s `option.maptilerLogo` that was a bit unclear + +## 1.0.10 +### New Features +- Terrain growing animation on enabling/disabling +- Added `Map` custom event `loadWithTerrain` +- Added `Map` lifecycle methods `.onLoadAsync()` and `.onLoadWithTerrainAsync()` +### Others +- Readme section was added about the event an methods above +- Updated from `maplibre-gl@3.0.0-pre.3` to `maplibre-gl@3.0.0-pre.4` +- Updated from `typedoc@0.23.21` to `typedoc@0.24.4`, which changes slightly the look of the reference documentation. +- Updated from `typescript@4.8.4` to `typescript@5.0.4` +- Updated from `rollup@2.79.0` to `rollup@3.20.6` as well as all the Rollup plugins + +## 1.0.9 +### New Features +- Added new styles: + - `MapStyle.STREETS.NIGHT` + - `MapStyle.WINTER.DARK` + - `MapStyle.OUTDOOR.DARK` +### Bug Fixes +- If the geolocate option is missing from `Map` constructor, then it's considered `false` +- The instance types for the following MapLibre classes are now fully exported: - `NavigationControl` - `GeolocateControl` - `AttributionControl` @@ -55,8 +95,7 @@ - `VectorTileSource` - `VideoSource` - `MapMLGL` - -- FIX: The following class have been extended to provide greater compatibility with SDK,s MapL +- The following class have been extended to provide greater compatibility with SDK,s MapL - `Popup` - `Marker` - `Style` @@ -75,40 +114,44 @@ - `FullscreenControl` - `TerrainControl` -- ADD: new styles: - - `MapStyle.STREETS.NIGHT` - - `MapStyle.WINTER.DARK` - - `MapStyle.OUTDOOR.DARK` -## [v1.0.8](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.8) -- FIX: Since v1.0.7, the `Map` primary language (when custom) was no longer persistant on style update. +## 1.0.8 +### Bug Fixes +- Since v1.0.7, the `Map` primary language (when custom) was no longer persistant on style update. -## [v1.0.7](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.7) +## 1.0.7 +### New Features - The `apiKey` can now be specified in the `Map` constructor (will propagate to `config`) - The `language` can now be speficifed in the `Map` constructo (will **not** propagete to `config` and will apply only to this specific instance) - `Map` now has the method `.getSdkConfig()` to retrieve the config object. - `Map` now has the method `.getMaptilerSessionId()` to retrieve the MapTiler session ID - Both `.getSdkConfig()` and `.getMaptilerSessionId()` are handy for layers or control built outside of the SDK that still need some of the configuration to interact with the server. Those components do not always have access to the internal of the SDK (especially that the config is scoped) but can access to the `Map` instance to which they are added with the implementation of the `.onAdd()` method. -## [v1.0.6](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.6) +## 1.0.6 +### New Features - Now exposing `MaptilerGeolocateControl` for external initialization if needed - Now exposing `MaptilerTerrain` for external initialization if needed -## [v1.0.5](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.5) +## 1.0.5 +### New Features - Terrain elevation is now using MapTiler's `terrain-rgb-v2` -## [v1.0.4](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.4) +## 1.0.4 +### Others - Improved the geolocate control behavior by not zooming out -## [v1.0.3](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.3) +## 1.0.3 +### Bug Fixes - Fixed the usage of relative path style JSON (in `Map` constructor and `.setStyle()`) -## [v1.0.2](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.2) +## 1.0.2 +### Bug Fixes - Fixed the dependency scheme of MapLibre import. -## [v1.0.1](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.1) +## 1.0.1 +### Others - Reducing the NPM size by ignoring documentation images -## [v1.0.0](https://github.com/maptiler/maptiler-sdk-js/releases/tag/v1.0.0) +## 1.0.0 +### Others - First public version! \ No newline at end of file diff --git a/package.json b/package.json index d8c11cff..83d30d19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maptiler/sdk", - "version": "1.1.2", + "version": "1.2.0", "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud", "module": "dist/maptiler-sdk.mjs", "types": "dist/maptiler-sdk.d.ts", @@ -36,10 +36,12 @@ "scripts": { "build": "rm -rf dist/* && NODE_ENV=production rollup -c", "dev": "rm -rf dist/* && NODE_ENV=development rollup -c -w", - "format": "prettier --write \"src/**/*.{js,ts,tsx}\"", - "lint": "eslint --fix \"src/**/*.{js,ts}\"", + "format:fix": "prettier --write \"src/**/*.{js,ts,tsx}\"", + "format": "prettier -c \"src/**/*.{js,ts,tsx}\"", + "lint:fix": "eslint --fix \"src/**/*.{js,ts}\"", + "lint": "eslint \"src/**/*.{js,ts}\"", "doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/", - "prepare": "npm run format && npm run lint && npm run build && npm run test", + "prepare": "npm run format:fix && npm run lint:fix && npm run build && npm run test", "test:dev": "vitest dev", "test": "vitest run" }, diff --git a/src/Map.ts b/src/Map.ts index 1954e963..79c039eb 100644 --- a/src/Map.ts +++ b/src/Map.ts @@ -747,6 +747,7 @@ export class Map extends maplibregl.Map { setPaintProperty( layerId: string, name: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any, options?: StyleSetterOptions, ): this { @@ -770,6 +771,7 @@ export class Map extends maplibregl.Map { setLayoutProperty( layerId: string, name: string, + // eslint-disable-next-line @typescript-eslint/no-explicit-any value: any, options?: StyleSetterOptions, ): this { diff --git a/src/tools.ts b/src/tools.ts index 48f4cc79..124c5da9 100644 --- a/src/tools.ts +++ b/src/tools.ts @@ -23,6 +23,7 @@ export function enableRTL() { // This comes from: // https://github.com/maplibre/maplibre-gl-js/blob/v2.4.0/src/util/util.ts#L223 +// eslint-disable-next-line @typescript-eslint/no-explicit-any export function bindAll(fns: Array, context: any): void { fns.forEach((fn) => { if (typeof context[fn] !== "function") return;