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

refactor: add @opensumi/ide-utils module #784

Merged
merged 23 commits into from
Apr 27, 2022
Merged

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Apr 2, 2022

Types

  • 🪚 Refactors

Background or solution

抽取了一部分 ide-core-commonide-components 中的公共 utils 新建了一个 @opensumi/ide-utils 模块,统一维护,解决循环引用,重复代码等问题的同时对全局 utils 方法进行归类,让代码更精简。

相关问题:

修改内容如下:

  • 对位于 packages/extension/src/common/vscodepackages/components/src/browser/utils 下的工具方法进行规整,后续直接依赖 @opensumi/ide-utils
  • 移除重复的工具方法, 如 core-common/src/utils 中重复定义的方法
  • 解决工具方法中存在的循环引用问题,如 import { Event, Uri } from '..';. 等写法
  • 统一对 utils 模块进行单元测试覆盖,让模块功能更纯粹

Changelog

add @opensumi/ide-utils module

@erha19
Copy link
Member Author

erha19 commented Apr 2, 2022

针对部分工具方法可能存在重复方法问题,如 strings, objects, arrays, path 等方法,后续需要通过如下方式获取具体的方法:

import { path } from '@opensumi/ide-core-common';

const { Path } = path;

详细改动见:utils/src/index.ts

@erha19 erha19 changed the title WIP: refactor: add @opensumi/ide-utils module refactor: add @opensumi/ide-utils module Apr 6, 2022
@erha19 erha19 force-pushed the refactor/use-common-utils branch from e6def14 to b1bf9e7 Compare April 6, 2022 03:41
@erha19 erha19 force-pushed the refactor/use-common-utils branch from cd8d025 to 98d38e1 Compare April 6, 2022 06:26
@erha19 erha19 force-pushed the refactor/use-common-utils branch 2 times, most recently from c2f4f35 to 6118b6d Compare April 6, 2022 08:07
@erha19
Copy link
Member Author

erha19 commented Apr 6, 2022

@erha19 erha19 force-pushed the refactor/use-common-utils branch from 6118b6d to a6f2f05 Compare April 6, 2022 10:24
@erha19 erha19 mentioned this pull request Apr 7, 2022
64 tasks
@yantze
Copy link
Member

yantze commented Apr 7, 2022

import { path } from '@opensumi/ide-core-common';

const { Path } = path;

这种集成方式嵌了太多套了

@erha19
Copy link
Member Author

erha19 commented Apr 7, 2022

这种集成方式嵌了太多套了

只有部分方法这样嵌套,因为本身方法名重复度太高了,这个是兼容的写法,如果不希望嵌套,可以直接从 @opensumi/ide-utils/lib/path 里面引入

@erha19
Copy link
Member Author

erha19 commented Apr 7, 2022

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2022

🎉 Pre-Release version 2.16.7-next-1649304413.0 publish successful! You can install prerelease version via npm install package@2.16.7-next-1649304413.0 @erha19

@erha19
Copy link
Member Author

erha19 commented Apr 7, 2022

/publish

1 similar comment
@erha19
Copy link
Member Author

erha19 commented Apr 7, 2022

/publish

@github-actions
Copy link
Contributor

github-actions bot commented Apr 7, 2022

🎉 Pre-Release version 2.16.7-next-1649326301.0 publish successful! You can install prerelease version via npm install package@2.16.7-next-1649326301.0 @erha19

@erha19 erha19 added this to the 2.18 milestone Apr 18, 2022
@codecov
Copy link

codecov bot commented Apr 26, 2022

Codecov Report

Merging #784 (a13bc45) into main (86df90f) will decrease coverage by 0.13%.
The diff coverage is 80.67%.

@@            Coverage Diff             @@
##             main     #784      +/-   ##
==========================================
- Coverage   58.62%   58.48%   -0.14%     
==========================================
  Files        1216     1220       +4     
  Lines       75477    75099     -378     
  Branches    15708    15616      -92     
==========================================
- Hits        44248    43922     -326     
+ Misses      28464    28417      -47     
+ Partials     2765     2760       -5     
Impacted Files Coverage Δ
...kages/components/src/recycle-tree/types/watcher.ts 100.00% <ø> (ø)
...s/core-browser/src/preferences/preference-proxy.ts 63.93% <ø> (ø)
...es/core-browser/src/services/status-bar-service.ts 100.00% <ø> (ø)
packages/core-browser/src/utils/json.ts 93.40% <ø> (ø)
packages/core-common/src/const/index.ts 0.00% <0.00%> (-100.00%) ⬇️
packages/core-common/src/electron.ts 100.00% <ø> (ø)
...kages/core-common/src/event-bus/event-bus-types.ts 100.00% <ø> (ø)
...re-common/src/keyboard/keyboard-layout-provider.ts 100.00% <ø> (ø)
packages/core-common/src/log.ts 92.68% <ø> (ø)
packages/core-common/src/markdown.ts 100.00% <ø> (ø)
... and 295 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 86df90f...a13bc45. Read the comment docs.

@bytemain bytemain mentioned this pull request Apr 27, 2022
1 task
Copy link
Member

@bytemain bytemain left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bytemain bytemain left a comment

Choose a reason for hiding this comment

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

LGTM

@erha19 erha19 merged commit 3340fa8 into main Apr 27, 2022
@erha19 erha19 deleted the refactor/use-common-utils branch April 27, 2022 12: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