Skip to content
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

Merged
merged 14 commits into from Jun 14, 2022

Conversation

dariaterekhova-actionengine
Copy link
Collaborator

No description provided.

@@ -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';
Copy link
Collaborator

@jagerts jagerts Jun 6, 2022

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?

Copy link
Collaborator Author

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

Copy link
Contributor

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';
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

Copy link
Contributor

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.
Copy link
Collaborator

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

Copy link
Collaborator Author

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

@@ -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';
Copy link
Collaborator

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment

@@ -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';
Copy link
Contributor

@heshan0131 heshan0131 Jun 8, 2022

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?

@@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to actions?


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';
Copy link
Contributor

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';
Copy link
Contributor

@heshan0131 heshan0131 Jun 8, 2022

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}) => {
Copy link
Contributor

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?

Copy link
Collaborator Author

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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

const PLUGINS = [
['@babel/plugin-transform-typescript', {isTSX: true, allowDeclareFields: true}],
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-proposal-class-properties',
Copy link
Contributor

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": [
Copy link
Contributor

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

"nyc": {
"sourceMap": false,
"instrument": false,
"exclude": [
Copy link
Contributor

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

"webpack-stats-plugin": "^0.2.1"
},
"peerDependencies": {
"react": ">=16.3",
Copy link
Contributor

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

"typescript": "4.2.3",
"uber-licence": "^3.1.1",
"webpack": "^4.29.0",
"webpack-bundle-analyzer": "^3.3.2",
Copy link
Contributor

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

"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",
Copy link
Contributor

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>
Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
@@ -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
Copy link
Contributor

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>
@delete-merged-branch delete-merged-branch bot deleted the dt/isolation_base branch June 14, 2022 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants