-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace utility functions with dedicated npm packages #766
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
I added just a few minor issues you might want to check.
jest.config.js
Outdated
@@ -1,3 +1,4 @@ | |||
const path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable.
src/index.js
Outdated
import { UndoUtil } from '@terrestris/base-util'; | ||
import { UrlUtil } from '@terrestris/base-util'; | ||
import { WfsFilterUtil } from '@terrestris/ol-util'; | ||
import { Logger } from '@terrestris/base-util'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all util imports should be removed from the index.js
since all classes are imported directly from the corresponding util modules anyway.
webpack.common.config.js
Outdated
@@ -36,5 +36,5 @@ module.exports = { | |||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |||
use: 'file-loader' | |||
}] | |||
} | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove dangling comma.
webpack.common.config.js
Outdated
@@ -36,5 +36,5 @@ module.exports = { | |||
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, | |||
use: 'file-loader' | |||
}] | |||
} | |||
}, | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but please add a newline.
import StringUtil from '../../Util/StringUtil/StringUtil'; | ||
import AnimateUtil from '../../Util/AnimateUtil/AnimateUtil'; | ||
import Logger from '../../Util/Logger'; | ||
import { MapUtil } from '@terrestris/ol-util'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure here, but I think in terms of bundle size it could be smarter to import the classes via the direct path, e.g. @terrestris/ol-util/MapUtil/MapUtil
.
Maybe @amir-ba can verify this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also suggest we stick to the habit of importing through direct paths. at least until we have react-geo
in ES6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor notes.
package.json
Outdated
@@ -90,7 +90,7 @@ | |||
"validator": "10.4.0" | |||
}, | |||
"devDependencies": { | |||
"antd": "3.6.6", | |||
"antd": "^3.7.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the ^
.
package.json
Outdated
@@ -118,7 +118,7 @@ | |||
"less": "3.7.1", | |||
"less-loader": "4.1.0", | |||
"np": "3.0.4", | |||
"ol": "4.6.5", | |||
"ol": "^4.6.5", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the ^
.
59017e0
to
2a9db93
Compare
jest.config.js
Outdated
@@ -27,5 +27,6 @@ module.exports = { | |||
'src/**/*.js', | |||
'!src/**/*example*.*' | |||
], | |||
coverageDirectory: '<rootDir>/coverage' | |||
coverageDirectory: '<rootDir>/coverage', | |||
testURL: 'http://localhost/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testURL
is already present in the current master and can be removed here.
- Remove everything except TestUtil.js from src/Util/ - update dependencies to corresponding npm packages - update tests
Index.js does not import utility modules anymore. Now, needed utilities will be directly imported within the respective classes. Furthermore, minor changes e.g. removing dangling commas were done.
Due to a minor release of jsdom, jest cannot handle default testURL anymore. testURL now needs to be specified explicitely. Here, localhost was used.
Thanks again @jansule! |
…29.0.0 chore(deps-dev): bump jest from 28.1.3 to 29.0.0
BREAKING CHANGE
Description:
Extract utility functions and create dedicated npm packages (@terrestris/base-util, @terrestris/ol-util). Extraction aims at improving reusability of core functions within other projects.
Technically, all files except TestUtil.js were removed from src/Util/. All paths were updated (including *.spec.js) and dependencies to the packages were included.
Further information in this issue.
So far only ES6 version exists.
#762