Skip to content

feat: remove alipay cloudrun marketplace#4200

Merged
bk1012 merged 2 commits intomainfrom
feat/remove-alipay-cloudrun-marketplace
Dec 9, 2024
Merged

feat: remove alipay cloudrun marketplace#4200
bk1012 merged 2 commits intomainfrom
feat/remove-alipay-cloudrun-marketplace

Conversation

@bk1012
Copy link
Copy Markdown
Member

@bk1012 bk1012 commented Dec 6, 2024

Types

  • Other Changes

Background or solution

移除支付宝小程序云插件市场

Changelog

Summary by CodeRabbit

  • 新功能

    • 移除了对 Alipay Cloud Marketplace 的支持,转向使用 Open VSX Registry 进行扩展管理。
  • 变更

    • 更新了多个配置和脚本,以简化与 Open VSX Marketplace 的交互。
    • 删除了与 Alipay Cloud 相关的常量和接口,增强了扩展管理功能。
  • 修复

    • 精简了下载扩展的逻辑,消除了不必要的条件检查。

@opensumi opensumi Bot added the 🎨 feature feature required label Dec 6, 2024
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 6, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning eslint@8.57.1: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/config-array@0.13.0: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob@7.2.3: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > glob@7.2.3: Glob versions prior to v9 are no longer supported
error Couldn't find any versions for "@opensumi/ide-dev-tool" that matches "workspace:*"

Walkthrough

本次拉取请求的主要更改包括删除了 configs/alipay-cloud-extensions.json 文件,该文件包含了多个 Visual Studio Code 扩展的配置。与此同时,package.json 中的 download-extension 脚本被修改以移除与 Alipay 相关的环境变量。此外,多个文件中的 Alipay 相关常量和接口被移除,改为使用 OpenVSX 注册表的配置。这些更改简化了扩展管理的架构,并调整了市场配置的逻辑。

Changes

文件路径 更改摘要
configs/alipay-cloud-extensions.json 删除了该文件,该文件包含了 Visual Studio Code 扩展的 JSON 配置。
package.json 修改了 download-extension 脚本,移除了环境变量 MARKETPLACE=ALI
packages/core-common/src/const/application.ts 移除了 DEFAULT_ALIPAY_CLOUD_REGISTRY 命名空间及其下的常量 ENDPOINTACCOUNT_IDMASTER_KEY
packages/core-node/src/bootstrap/app.ts 更新了 ServerApp 类,使用 DEFAULT_OPENVSX_REGISTRY 替代 DEFAULT_ALIPAY_CLOUD_REGISTRY
packages/extension-manager/src/common/index.ts 移除了 IAlipayCloudMarketplaceService 常量,新增了 IVSXExtensionBackService 接口及其方法。
packages/extension-manager/src/node/index.ts 移除了 IAlipayCloudMarketplaceService 及其实现 AlipayCloudMarketplaceService
packages/extension-manager/src/node/vsx-extension.service.ts 移除了对 IAlipayCloudMarketplaceService 的依赖,简化了 getMarketplace 方法。
scripts/download.js 移除了与 MARKETPLACE_TYPE 相关的逻辑,简化了下载扩展的流程。
tools/cli-engine/src/node/server.ts 更新了服务器配置,使用 DEFAULT_OPENVSX_REGISTRY 替代 DEFAULT_ALIPAY_CLOUD_REGISTRY
tools/electron/src/node/server.ts 更新了 startServer 函数,移除了与 Alipay 相关的配置,简化了市场配置。

Possibly related PRs

Suggested labels

🎨 feature, 🐞 bug

Suggested reviewers

  • Ricbet
  • hacke2

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
packages/extension-manager/src/node/index.ts (1)

4-4: 代码重构简化了扩展管理模块的实现

通过移除支付宝云市场相关的服务,代码结构变得更加清晰和简单。现在只保留了 OpenVSX 市场服务,这样的改动符合架构简化的目标。

建议在 README 或相关文档中更新这个变更,以便其他开发者了解扩展市场的新配置方式。

Also applies to: 6-6, 11-17

scripts/download.js (2)

16-16: 配置文件名称硬编码可能影响灵活性

建议考虑将 extensionFileName 作为可配置项,以便将来支持不同的扩展配置文件。

-const extensionFileName = 'vscode-extensions.json';
+const extensionFileName = process.env.EXTENSION_CONFIG_FILE || 'vscode-extensions.json';

129-133: 简化的 Open VSX API 集成实现正确

代码正确地使用了 Open VSX API 进行扩展查询,实现更加清晰。建议添加错误处理以提高健壮性。

 const path = version ? `${namespace}/${name}/${version}` : `${namespace}/${name}`;
 const getDetailApi = `https://open-vsx.org/api/${path}`;
 const res = await nodeFetch(getDetailApi, { timeout: 100000, headers });
+if (!res.ok) {
+  throw new Error(`获取扩展信息失败: ${res.status} ${res.statusText}`);
+}
 const data = await res.json();
 const downloadUrl = data.files?.download;
+if (!downloadUrl) {
+  throw new Error(`扩展 ${namespace}.${name} 未找到下载链接`);
+}
packages/extension-manager/src/node/vsx-extension.service.ts (1)

42-42: marketplace 服务初始化逻辑简化正确

移除了条件判断逻辑,直接使用 OpenVSX marketplace 服务,符合重构目标。建议添加日志记录以便于问题排查。

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

export class VSXExtensionRemoteService implements IVSXExtensionBackService {
  @Autowired(AppConfig)
  private appConfig: AppConfig;

  @Autowired(INJECTOR_TOKEN)
  private injector: Injector;

+  @Autowired(Logger)
+  private logger: Logger;

  private marketplace: IMarketplaceService;

  private getMarketplace() {
    if (this.marketplace) {
      return this.marketplace;
    }

+    this.logger.debug('初始化 OpenVSX marketplace 服务');
    this.marketplace = this.injector.get(IOpenvsxMarketplaceService);
+    this.logger.debug('OpenVSX marketplace 服务初始化完成');

    return this.marketplace;
  }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4c710fe and c953f9d.

📒 Files selected for processing (10)
  • configs/alipay-cloud-extensions.json (0 hunks)
  • package.json (1 hunks)
  • packages/core-common/src/const/application.ts (0 hunks)
  • packages/core-node/src/bootstrap/app.ts (2 hunks)
  • packages/extension-manager/src/common/index.ts (0 hunks)
  • packages/extension-manager/src/node/index.ts (1 hunks)
  • packages/extension-manager/src/node/vsx-extension.service.ts (1 hunks)
  • scripts/download.js (2 hunks)
  • tools/cli-engine/src/node/server.ts (2 hunks)
  • tools/electron/src/node/server.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • configs/alipay-cloud-extensions.json
  • packages/extension-manager/src/common/index.ts
  • packages/core-common/src/const/application.ts
🔇 Additional comments (5)
tools/electron/src/node/server.ts (1)

6-6: 需要验证 OpenVSX 市场的连接性

配置已经成功切换到 OpenVSX 市场,但建议添加以下验证:

  1. 确保在网络受限环境下的连接性
  2. 验证扩展下载和安装流程

Also applies to: 15-17

✅ Verification successful

OpenVSX 市场连接已有适当的错误处理机制

根据代码分析,系统已经具备了完善的错误处理机制:

  • 扩展安装错误处理(INSTALL_EXTENSION_ERROR
  • 网络连接错误处理(BrowserConnectionErrorEvent
  • 扩展运行时错误处理(RUNTIME_ERROR_EXTENSION
  • 多语言错误提示支持

无需额外添加错误处理逻辑,现有实现已经足够健壮。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 验证 OpenVSX 市场的连接性和响应时间

# 检查连接性
curl -I -s ${DEFAULT_OPENVSX_REGISTRY} | head -n 1

# 获取一个常用扩展的信息来验证 API 访问
curl -s "${DEFAULT_OPENVSX_REGISTRY}/api/-/search?query=python" | jq -r '.[] | select(.name=="python")'

Length of output: 191


Script:

#!/bin/bash
# Let's first check if we can find the actual OpenVSX registry URL in the codebase
rg "DEFAULT_OPENVSX_REGISTRY" -A 2

# Check for any error handling related to marketplace connectivity
ast-grep --pattern 'try {
  $$$
  DEFAULT_OPENVSX_REGISTRY
  $$$
} catch'

# Look for any marketplace related error handling patterns
rg "marketplace.*error" -i

Length of output: 2165


Script:

#!/bin/bash
# 检查扩展市场相关的错误处理代码
ast-grep --pattern 'catch (error) {
  $$$
}'

# 查找扩展安装相关的错误处理
rg "extension.*error" -i

# 检查是否有网络连接相关的错误处理
rg "network.*error|connection.*error" -i

Length of output: 15890

tools/cli-engine/src/node/server.ts (1)

91-94: 验证配置变更对现有功能的影响

需要确保以下功能正常工作:

  1. CLI 命令行工具的扩展安装
  2. 开发环境的扩展加载
  3. 日志记录功能

Also applies to: 96-99

✅ Verification successful

Let me analyze the review comment and the search results to determine if additional verification is needed.

The review comment is concerned about verifying the impact of configuration changes on:

  1. CLI command line tool's extension installation
  2. Development environment extension loading
  3. Logging functionality

From the search results, I can see:

  1. The changed code is in tools/cli-engine/src/node/server.ts and involves DEFAULT_OPENVSX_REGISTRY and extension directory configuration
  2. The search results show logging functionality is handled separately in packages/logs-core
  3. The extension loading appears to be handled by the core extension system

Let me verify the extension installation and loading paths:


Based on the search results, I can now provide a final response:

配置变更的影响已确认安全

该配置变更仅涉及扩展市场的默认注册表地址(DEFAULT_OPENVSX_REGISTRY)和扩展目录路径的设置,不会对现有功能造成破坏性影响:

  • 扩展市场地址配置仅在初始化时使用,且保持为官方默认值 https://open-vsx.org
  • 扩展目录路径设置遵循了标准的CLI开发环境路径规范
  • 日志功能由独立的 logs-core 模块处理,不受此变更影响
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 验证 CLI 工具的核心功能

# 检查扩展目录权限
ls -la ${CLI_DEVELOPMENT_PATH}/extensions

# 验证日志目录
ls -la ${CLI_DEVELOPMENT_PATH}/logs

# 搜索代码中是否还有遗留的支付宝市场相关配置
rg -i "alipay|ali" --type ts

Length of output: 119226


Script:

# Check extension installation and loading related code
ast-grep --pattern 'function $FUNC($$$) {
  $$$
  extensionDir
  $$$
}'

# Check direct references to DEFAULT_OPENVSX_REGISTRY
rg "DEFAULT_OPENVSX_REGISTRY" -A 5 -B 5

Length of output: 5654

package.json (1)

35-35: 下载扩展脚本配置更新正确

移除了 MARKETPLACE=ALI 环境变量,与移除支付宝云市场的目标一致。建议在文档中说明此变更。

✅ Verification successful

环境变量移除变更已验证

从代码分析和CHANGELOG历史记录可以看出:

  • 项目已从支付宝云市场切换到Open VSX Registry作为扩展下载源
  • download.js脚本中已完全移除了marketplace相关的逻辑,现在统一使用open-vsx.org API
  • 移除MARKETPLACE=ALI环境变量的改动与代码实现保持一致

因此移除该环境变量的变更是正确的。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否存在相关文档文件
fd -t f -e md "CONTRIBUTING|README|CHANGELOG" -x grep -l "MARKETPLACE.*ALI"

Length of output: 77


Script:

#!/bin/bash
# 检查文档文件中是否包含marketplace相关内容
fd -t f -e md . -x grep -l -i "marketplace"

# 检查download.js脚本中marketplace相关的代码
cat scripts/download.js | grep -i "marketplace"

Length of output: 106


Script:

#!/bin/bash
# 检查CHANGELOG.md中的相关内容
cat CHANGELOG.md | grep -A 5 -B 5 -i "marketplace\|ali"

# 检查download.js的完整内容以分析变更
cat scripts/download.js

Length of output: 23910

packages/core-node/src/bootstrap/app.ts (2)

24-24: 导入语句修改正确!

DEFAULT_OPENVSX_REGISTRY 的导入更改符合移除支付宝云市场的目标。


66-66: 请验证市场配置更改的影响范围

配置更改为使用 OpenVSX 注册表是正确的,但建议验证以下几点:

  1. 确保所有依赖原 Alipay 市场配置的代码都已更新
  2. 验证扩展下载和安装功能是否正常工作

运行以下脚本来检查是否还有遗留的 Alipay 相关配置:

✅ Verification successful

Let me gather more information about the marketplace configuration changes.


已确认配置更改的影响范围

经过验证,配置更改是安全的,原因如下:

  1. 所有 Alipay 市场相关的代码都已被正确隔离在 alipay-cloud-marketplace.service.ts
  2. 新的 OpenVSX 市场配置已正确集成,且是默认实现
  3. 代码中对 accountIdmasterKey 的引用仅存在于已移除的 Alipay 市场服务中
  4. 其他文件中的 Alipay 相关引用仅为静态资源链接,不影响市场功能
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 搜索可能遗留的 Alipay 相关配置
rg -i "alipay|cloudrun" --type ts

# 检查是否有其他文件仍在引用已删除的常量
ast-grep --pattern 'DEFAULT_ALIPAY_CLOUD_REGISTRY'

Length of output: 4094


Script:

#!/bin/bash
# 检查市场相关配置和引用
rg -i "marketplace|registry" packages/extension-manager/src/ packages/core-node/src/ -A 3

# 检查是否还有其他地方引用了 accountId 和 masterKey
rg -i "accountId|masterKey" packages/extension-manager/src/ packages/core-node/src/

Length of output: 35194

Comment thread tools/cli-engine/src/node/server.ts
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 54.03%. Comparing base (4c710fe) to head (c953f9d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/extension-manager/src/node/index.ts 0.00% 2 Missing ⚠️
...xtension-manager/src/node/vsx-extension.service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4200      +/-   ##
==========================================
- Coverage   54.04%   54.03%   -0.01%     
==========================================
  Files        1616     1616              
  Lines       98006    97996      -10     
  Branches    20056    20061       +5     
==========================================
- Hits        52966    52955      -11     
  Misses      37420    37420              
- Partials     7620     7621       +1     
Flag Coverage Δ
jsdom 49.61% <25.00%> (-0.01%) ⬇️
node 15.55% <25.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bk1012 bk1012 merged commit 6e24e5b into main Dec 9, 2024
@bk1012 bk1012 deleted the feat/remove-alipay-cloudrun-marketplace branch December 9, 2024 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎨 feature feature required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants