-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #826 from ahennr/typescript
Move ol-util to typescript
- Loading branch information
Showing
46 changed files
with
2,329 additions
and
2,146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,12 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended" | ||
"@terrestris/eslint-config-typescript" | ||
], | ||
"plugins": [], | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
}, | ||
"parser": "@babel/eslint-parser", | ||
"globals": { | ||
"Promise": false | ||
}, | ||
"plugins": ["simple-import-sort"], | ||
"rules": { | ||
"no-console": "error", | ||
"indent": ["error", 2, { "SwitchCase": 1 }], | ||
"linebreak-style": ["error", "unix"], | ||
"quotes": ["error", "single", { "allowTemplateLiterals": true }], | ||
"semi": ["error", "always"], | ||
"one-var": ["error", "never"], | ||
"no-confusing-arrow": "error", | ||
"no-unused-vars": ["error", { | ||
"ignoreRestSiblings": true | ||
}], | ||
"key-spacing": ["error", { | ||
"beforeColon": false, | ||
"afterColon": true | ||
}], | ||
"require-jsdoc": ["error", { | ||
"require": { | ||
"FunctionDeclaration": true, | ||
"MethodDefinition": true, | ||
"ClassDeclaration": true, | ||
"ArrowFunctionExpression": true | ||
} | ||
}], | ||
"space-infix-ops": ["error", {"int32Hint": false}] | ||
"@typescript-eslint/member-ordering": "off", | ||
"no-underscore-dangle": "off", | ||
"simple-import-sort/exports": "warn", | ||
"simple-import-sort/imports": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
node-version: [16.x] | ||
|
||
steps: | ||
- name: Checkout sources | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ node_modules/ | |
dist/ | ||
|
||
coverage/ | ||
|
||
# Ignore IntelliJ iml files | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# [8.0.0] | ||
|
||
### :rotating_light: BREAKING CHANGES :rotating_light: | ||
|
||
* Adds typings for all util functions. This may lead to type conflicts in certain projects | ||
* `CapabilitiesUtil.parseWmsCapabilities(…)` has been removed. Can be replaced by `CapabilitiesUtil.getWmsCapabilities(…)` | ||
* `GeomtryUtil` | ||
* Use `ProjectionLike` (OpenLayers ype) instead of `string` for projections | ||
* `separateGeometries` can either handle simple geometry or geometry array now | ||
* `MapUtil` | ||
* remove `getInteractionsByClass` in MapUtils - Instead: | ||
* set name to interaction and use `getInteractionByName` | ||
* filter interactions using `typeof` in your project | ||
* `ProjectionUtil`: | ||
* Crs definitions are typed now and `defaultProj4CrsDefinitions` moved to an array of `CrsDefinition` | ||
* if custom definitions are used in `initProj4Definitions` these have to migrated in the following way: | ||
```javascript | ||
{ | ||
'EPSG:25832': '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs', | ||
'EPSG:25833': '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' | ||
} | ||
``` | ||
has to be migrated to | ||
```typescript | ||
[{ | ||
crsCode: 'EPSG:25832', | ||
definition: '+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs' | ||
}, { | ||
crsCode: 'EPSG:25833', | ||
definition: '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'} | ||
}] | ||
``` | ||
* Crs mappings are typed now and `defaultProj4CrsMappings` moved to an array of `CrsMapping` | ||
* if custom definitions are used in `initProj4DefinitionMappings` these have to migrated in the following way: | ||
```javascript | ||
{ | ||
'urn:ogc:def:crs:EPSG::25832': 'EPSG:25832', | ||
'urn:ogc:def:crs:EPSG::25833': 'EPSG:25833' | ||
} | ||
``` | ||
has to be migrated to | ||
```typescript | ||
[{ | ||
alias: 'urn:ogc:def:crs:EPSG::25832', | ||
mappedCode: 'EPSG:25832' | ||
}, { | ||
alias: 'urn:ogc:def:crs:EPSG::25833', | ||
mappedCode: 'EPSG:25833' | ||
}] | ||
``` | ||
* `WfsFilterUtil` as completely been overhauled: | ||
* in contrast to the migrated `WfsFilterUtil`, from now on the search / filter has to be configured using new type `SearchConfig`. | ||
* For example: a filter creation for an exact search of `my search term` in attribute `name` of feature type `TEST:MYTYPE` look slike this: | ||
```typescript | ||
const attributeDetails: AttributeDetails [] = [{ | ||
type: 'string', | ||
exactSearch: true, | ||
attributeName: 'name' | ||
}]; | ||
const searchTerm = 'my search term'; | ||
const filter = WfsFilterUtil.createWfsFilter(searchTerm, attributeDetails); | ||
}; | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
module.exports = { | ||
'presets': [ | ||
'@babel/env', | ||
'@babel/react', | ||
presets: [ | ||
[ | ||
'@babel/preset-env', { | ||
targets: { | ||
node: 'current' | ||
} | ||
} | ||
], | ||
'@babel/preset-typescript' | ||
], | ||
'plugins': [ | ||
'@babel/plugin-proposal-function-bind', | ||
'@babel/plugin-transform-modules-commonjs', | ||
'@babel/plugin-transform-runtime', | ||
'@babel/plugin-transform-typescript', | ||
['@babel/plugin-proposal-class-properties', { 'loose': false }], | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
module.exports = { | ||
testEnvironment: 'jsdom', | ||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'], | ||
moduleFileExtensions: [ | ||
'js' | ||
], | ||
moduleDirectories: [ | ||
'node_modules' | ||
'ts', | ||
'js', | ||
'json' | ||
], | ||
transform: { | ||
'^.+\\.js$': '<rootDir>/node_modules/babel-jest', | ||
'^.+\\.ts$': '<rootDir>/node_modules/babel-jest' | ||
}, | ||
transformIgnorePatterns: [ | ||
'node_modules/(?!(ol)/)' | ||
'<rootDir>/node_modules/(?!(ol|@babel|jest-runtime|@terrestris))' | ||
], | ||
setupFiles: [ | ||
'<rootDir>/jest/__mocks__/shim.js', | ||
'<rootDir>/jest/setup.js' | ||
], | ||
testEnvironment: 'jsdom', | ||
collectCoverage: false, | ||
testRegex: '/src/.*\\.spec.(ts|js)$', | ||
collectCoverageFrom: [ | ||
'src/**/*.js', | ||
'!src/TestUtil.js' | ||
'src/**/*.{ts,js}', | ||
'!src/spec/**/*.{ts,js}' | ||
], | ||
coverageDirectory: '<rootDir>/coverage' | ||
roots: [ | ||
'./src' | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global.fetch = jest.fn(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.