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

Migrate to Vite, Vitest, Add Linter #262

Merged
merged 15 commits into from
Jul 23, 2022
Merged

Conversation

rasyidf
Copy link
Contributor

@rasyidf rasyidf commented Jul 21, 2022

Pre-flight checklist

Update Dependencies and use vite to speed up development.

  • React 18
  • material-ui/core -> mui/material
  • react scripts to vite
  • jest to vitest.
  • Unit tests for all non-trivial changes
  • Tested locally

@SkalskiP
Copy link
Owner

Hi @rasyidf, that's a lot of changes :) I know, that most of them are related to adding linter, but I still need to go through that. I'll try to put any PR-related comments today.

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 22, 2022

Hello, I'm sorry that was a bulk changes. the reason I changed many things, It's mostly because, I've been struggling to develop the app. then trying to fix it by replacing some components with newer one, changing the build tools. and testing tools.

so it will be able to run without any error when using newer npm.

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 22, 2022

the huge changelog is mostly because of package-lock.json

@SkalskiP
Copy link
Owner

I understand, I actually did some of these changes on a separate branch this week, but it is not merged. I'm traveling today for 3 hours. I hope that will be enough to go through all the changes and review them.

.github/workflows/coverage.yml Show resolved Hide resolved
index.html Show resolved Hide resolved
index.html Show resolved Hide resolved
index.html Show resolved Hide resolved
src/index.tsx Outdated Show resolved Hide resolved
src/staticModels/EditorModel.ts Outdated Show resolved Hide resolved
src/utils/RectUtil.ts Outdated Show resolved Hide resolved
src/views/PopupView/ImportLabelPopup/ImportLabelPopup.tsx Outdated Show resolved Hide resolved
@SkalskiP
Copy link
Owner

Hi, @rasyidf I see a lot of cool changes here. I definitely like:

  • Upgrading React to version 18
  • Adding linter! This is great!
  • Vitt is really fast!

Problems that I see that are the main blockers for me now:

  • Code coverage seems not to work properly
  • Upgrading MUI caused the removal of input styles in the LabelName popup
  • Upgrading Scrollbars caused scrolls to be visible when you zoom the image and drag it.

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 22, 2022

I can work with the coverge asap.

that's a regression. and the label i guess it's because of breaking changes. I can fix that

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 22, 2022

image
the TextField is fixed. solving another bug.

@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2022

Codecov Report

Merging #262 (5c0a26f) into develop (d6e03cb) will increase coverage by 1.51%.
The diff coverage is 6.97%.

@@             Coverage Diff             @@
##           develop     #262      +/-   ##
===========================================
+ Coverage    12.63%   14.14%   +1.51%     
===========================================
  Files          135      149      +14     
  Lines         4030     4361     +331     
  Branches       719      792      +73     
===========================================
+ Hits           509      617     +108     
- Misses        3521     3741     +220     
- Partials         0        3       +3     
Impacted Files Coverage Δ
src/ai/ObjectDetector.ts 26.66% <0.00%> (+26.66%) ⬆️
src/ai/PoseDetector.ts 26.66% <0.00%> (+26.66%) ⬆️
src/logic/import/yolo/YOLOImporter.ts 39.21% <0.00%> (+13.02%) ⬆️
src/logic/import/yolo/YOLOUtils.ts 80.95% <ø> (+2.00%) ⬆️
src/staticModels/EditorModel.ts 100.00% <ø> (ø)
src/utils/CanvasUtil.ts 5.88% <0.00%> (+5.88%) ⬆️
src/utils/RectUtil.ts 11.11% <0.00%> (+2.97%) ⬆️
src/utils/VirtualListUtil.ts 0.00% <0.00%> (ø)
src/views/Common/VirtualList/VirtualList.tsx 0.00% <ø> (ø)
src/views/EditorView/Editor/Editor.tsx 0.00% <ø> (-1.93%) ⬇️
... and 162 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6e03cb...5c0a26f. Read the comment docs.

@SkalskiP
Copy link
Owner

@rasyidf I'll take a look at the changes today. I need to take care of a few things now, but I'll be back in more or less 2 hours.

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

@rasyidf I'll take a look at the changes today. I need to take care of a few things now, but I'll be back in more or less 2 hours.

take your time.

@SkalskiP
Copy link
Owner

SkalskiP commented Jul 23, 2022

Hi, @rasyidf I took a look at your progress and I'm super excited about that PR! 🚀 I decided to create a checklist, to make our life easier.

  • Upgrading React to v18
  • Adding linter
  • Fix test code coverage
  • Upgrading MUI
    • Fix text input in InsertLabelNamesPopup
    • Fix StyledTooltip background color is changed. You can see that if you hover over the GitHub or Medium icon on the main site. It used to be darker now it light gray.
  • Fix scrollbars. When you zoom the image and start to drag it you see scrollbars, we want to prevent that.
  • Problems with loading COCO JSON from disk. JSON files are grayed out.

  • I noticed that the loading SSD model does not work. It may not be related to your PR. I'll need to take a look at that later.

src/staticModels/EditorModel.ts Outdated Show resolved Hide resolved
src/views/MainView/MainView.scss Show resolved Hide resolved
src/views/MainView/MainView.tsx Outdated Show resolved Hide resolved
@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

Somehow I can't reproduce the scrollbar bug. the app is working fine in my localhost

@SkalskiP
Copy link
Owner

@rasyidf Please set public static viewPortActionsDisabled as false. And I guess we could try to merge. I'll try to figure out those scrollbars on my own later ;)

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

I've done changing. I guess that's everything @SkalskiP .

@SkalskiP
Copy link
Owner

@rasyidf great! So in that case I'm merging to develop. Changes should be on develop in a few minutes if everything works out ok. 🤞

@SkalskiP SkalskiP merged commit 49bc1cf into SkalskiP:develop Jul 23, 2022
@SkalskiP
Copy link
Owner

@rasyidf develop build failed. I'll try to understand why.

@SkalskiP
Copy link
Owner

@rasyidf I managed to build it, and it seems that it even deployed. But when I go to https://develop.makesense.ai/ the website is empty there is nothing in root div.

@SkalskiP
Copy link
Owner

@rasyidf I managed to replicate the same empty root div locally. I did according to this tutorial: https://vitejs.dev/guide/static-deploy.html. Added preview script and than run:

$ npm run build
$ npm run preview

Same result, empty page. Any ideas how to fix that?

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

@rasyidf I managed to replicate the same empty root div locally. I did according to this tutorial: https://vitejs.dev/guide/static-deploy.html. Added preview script and than run:

$ npm run build
$ npm run preview

Same result, empty page. Any ideas how to fix that?

may i know what hosting type are you using?

@SkalskiP
Copy link
Owner

@rasyidf I managed to replicate the same empty root div locally. I did according to this tutorial: https://vitejs.dev/guide/static-deploy.html. Added preview script and than run:

$ npm run build
$ npm run preview

Same result, empty page. Any ideas how to fix that?

may i know what hosting type are you using?

Sure, Amplify

@SkalskiP
Copy link
Owner

I think it is because of chanking. When I overwrite the current vite.config.js.

import { defineConfig } from 'vite'
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()]
})

It loads properly.

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

aha, that's something I missed.

there's build error I skipped.
image
i guess this is also another reason.

image
the app can't find aws nock.

@SkalskiP
Copy link
Owner

Yup, I was also thinking about it. You think it is not chunking issue?

@rasyidf
Copy link
Contributor Author

rasyidf commented Jul 23, 2022

I've fixed it by adding mock-aws-s3, aws-sdk and nock ad devDependency

image

@SkalskiP
Copy link
Owner

SkalskiP commented Jul 23, 2022

I committed changes to develop, adding those dependencies. Let's see if it'll work. It worked locally.

@SkalskiP
Copy link
Owner

@rasyidf take a look at: https://develop.makesense.ai I think everything works now! Thank you very much for your contribution 🚀🚀🚀 I'm very happy and excited!

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