-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Chore]: Technical: constants and types modules isolation #1840
Conversation
72bef9c
to
bb00809
Compare
@@ -29,7 +29,8 @@ import {Button} from 'components/common/styled-components'; | |||
import {DatasetSquare} from 'components'; | |||
import Typeahead from 'components/common/item-selector/typeahead'; | |||
import Accessor from 'components/common/item-selector/accessor'; | |||
import {Datasets, RGBColor} from 'reducers'; | |||
import {Datasets} from 'reducers'; |
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.
Shouldn't it been moved to @kepler.gl/types as well? Datasets is used in different modules - utils, components, etc.
May be we should move all types there..? @heshan0131 what do you think about it?
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.
Let's do it with utils isolation
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.
yea move it to types
would be ideal
@@ -27,8 +27,8 @@ import ColorPalette from './color-palette'; | |||
import {StyledPanelDropdown} from 'components/common/styled-components'; | |||
import onClickOutside from 'react-onclickoutside'; | |||
import {ColorUI} from 'layers/layer-factory'; | |||
import {ColorRange} from 'constants/color-ranges'; | |||
import {NestedPartial, RGBColor} from 'reducers'; | |||
import {ColorRange} from '@kepler.gl/constants/color-ranges'; |
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.
It should be only '@kepler.gl/constants' here?
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.
No, I added export of all other paths, so we now can keep imports like this and save some time on future isolations
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.
better to import it from @kepler.gl/constants
so when we are building kepler from src in studio, we don't need to add additional path resolver to our webpack config
@@ -1,77 +0,0 @@ | |||
// Copyright (c) 2022 Uber Technologies, Inc. |
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.
Looks like this file should be moved to ./src, but it is deleted
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.
It has a lot of changes in it, so git decided that index.ts in src folder is taken form src/layers/types.ts
src/constants/src/index.ts
Outdated
@@ -18,20 +18,16 @@ | |||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
// THE SOFTWARE. | |||
|
|||
import keyMirror from 'keymirror'; |
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.
And this file should be deleted?
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.
See previous comment
src/actions/actions.ts
Outdated
@@ -18,11 +18,11 @@ | |||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
// THE SOFTWARE. | |||
|
|||
import ActionTypes from 'constants/action-types'; | |||
import {ActionTypes} from '@kepler.gl/constants'; |
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.
is it possible to move this to actions
? or define as emun
and move it to types
?
src/actions/provider-actions.ts
Outdated
@@ -19,7 +19,7 @@ | |||
// THE SOFTWARE. | |||
|
|||
import {createAction} from '@reduxjs/toolkit'; | |||
import {ACTION_PREFIX} from 'constants/action-types'; | |||
import {ACTION_PREFIX} from '@kepler.gl/constants'; |
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.
move it to actions?
src/components/editor/editor.tsx
Outdated
|
||
import {DEFAULT_RADIUS, getStyle as getFeatureStyle} from './feature-styles'; | ||
import {getStyle as getEditHandleStyle, getEditHandleShape} from './handle-style'; | ||
import KeyEvent from 'constants/keyevent'; | ||
import {KeyEvent} from '@kepler.gl/constants'; |
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.
combine these 2 imports from '@kepler.gl/constants';
@@ -21,7 +21,7 @@ | |||
import React, {useMemo, useCallback} from 'react'; | |||
import ItemSelector from 'components/common/item-selector/item-selector'; | |||
import {Layer} from 'layers'; | |||
import {LAYER_TYPES} from 'layers/types'; | |||
import {LAYER_TYPES} from '@kepler.gl/constants'; |
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.
ideally move this to layers
filter, | ||
layers | ||
]); | ||
const PolygonFilter: React.FC<PolygonFilterProps> = React.memo(({filter, layers, setLayers}) => { |
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.
why are these styling changed? is there a prettier version upgrade?
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.
No, I haven't upgraded prettier or it's configuration... But I've checked now and prettier has changed noting so should I return the previous format there manually?
@@ -29,8 +29,8 @@ import {VertDots, Trash} from 'components/common/icons'; | |||
import ColorPalette from './color-palette'; | |||
import CustomPicker from './custom-picker'; | |||
import {arrayMove} from 'utils/data-utils'; | |||
import {ColorRange} from 'constants/color-ranges'; | |||
import {NestedPartial} from 'reducers'; | |||
import {ColorRange} from '@kepler.gl/constants/color-ranges'; |
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.
same
src/constants/babel.config.js
Outdated
const PLUGINS = [ | ||
['@babel/plugin-transform-typescript', {isTSX: true, allowDeclareFields: true}], | ||
'@babel/plugin-transform-modules-commonjs', | ||
'@babel/plugin-proposal-class-properties', |
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.
do you need this for constants? are we exporting and class from constant
?
"build:types": "tsc --project ./tsconfig.production.json", | ||
"prepublish": "uber-licence && yarn build && yarn build:umd && yarn build:types" | ||
}, | ||
"files": [ |
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.
you probably don't need any of this here
src/constants/package.json
Outdated
"nyc": { | ||
"sourceMap": false, | ||
"instrument": false, | ||
"exclude": [ |
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.
no need for these excludes
src/constants/package.json
Outdated
"webpack-stats-plugin": "^0.2.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.3", |
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.
don't need these peerDependencies
src/constants/package.json
Outdated
"typescript": "4.2.3", | ||
"uber-licence": "^3.1.1", | ||
"webpack": "^4.29.0", | ||
"webpack-bundle-analyzer": "^3.3.2", |
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.
don't need these webpack
plugins
src/constants/package.json
Outdated
"name": "@kepler.gl/constants", | ||
"author": "Shan He <shan@uber.com>", | ||
"version": "2.5.5", | ||
"description": "kepler.gl is a webgl based application to visualize large scale location data in the browser", |
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.
edit description:
kepler.gl constants used by kepler.gl components, actions and reducers
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
bb00809
to
756e1d0
Compare
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
src/constants/src/action-types.ts
Outdated
@@ -183,6 +183,6 @@ const ActionTypes = { | |||
START_SAVE_STORAGE: `${ACTION_PREFIX}START_SAVE_STORAGE` | |||
}; | |||
|
|||
const assignType = <T>(obj: T): { [K in keyof T]: `${typeof ACTION_PREFIX}${string & K}`; } => obj as any | |||
const assignType = <T>(obj: T): { [K in keyof T]: `${typeof ACTION_PREFIX}${string & K}`; } => obj as any // eslint-disable-line |
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.
preferably move this to top of this line
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
No description provided.