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

fix: 适配Windows环境 #3090

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open

fix: 适配Windows环境 #3090

wants to merge 2 commits into from

Conversation

Alexzjt
Copy link
Contributor

@Alexzjt Alexzjt commented Feb 2, 2025

👀 PR includes

✨ Feature

  • New feature

🎨 Enhance

  • Code style optimization
  • Refactoring
  • Change the UI
  • Improve the performance
  • Type optimization

🐛 Bugfix

🔧 Chore

  • Test case
  • Docs / demos update
  • CI / workflow
  • Release version
  • Other ()

📝 Description

兼容Windows环境下的package.json中的命令,主要是pnpm install和 pnpm run build。

  1. rsync 在windows下不兼容,考虑使用一个跨平台的文件复制工具,比如 copyfiles(或类似工具),它支持 Windows、macOS 和 Linux,无需写额外的脚本。这样只需要在 package.json 中改动同步命令,而不用区分操作系统。
  2. 在 Windows 下运行基于 pnpm workspace 的过滤命令时出现 No projects matched the filters 错误,通常是由于 路径格式不兼容 或 通配符解析差异 导致的。--filter 的路径匹配规则在跨平台时需严格遵循 pnpm 的语法,而非操作系统原生路径格式。
  3. 统一使用跨平台工具:
    替换 rm -rf → rimraf
    替换 NODE_OPTIONS='...' → cross-env NODE_OPTIONS=...
  4. 规范路径和引号:
    使用双引号 " 替代单引号 '
    统一路径分隔符为 /

🖼️ Screenshot

Before After
image image
image image

🔗 Related issue link

#2679

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

Copy link
Contributor

github-actions bot commented Feb 2, 2025

你好 @Alexzjt,非常感谢你的贡献.
为了让代码更健壮, 请根据 贡献指南 补充相应单元测试 (文档改动或其他特殊场景除外), 如果有 API 改动, 请修改 相应的文档.
同时请检查 linttest 相关 CI 是否通过, 如果失败, 请点击 [Details] 按钮查看, 并根据日志修复.

Hello, @Alexzjt, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes.
At the same time, please check whether the CI related to lint and test passes. If the CI fails, please click [Details] button to check and repair according to the log.

@github-actions github-actions bot added the next 2.0-next 版本的问题 label Feb 2, 2025
@github-actions github-actions bot added the pr(fix) bug fix label Feb 2, 2025
Copy link

概述

此PR旨在解决Windows环境下package.json中的命令兼容性问题,主要涉及pnpm installpnpm run build。通过使用跨平台工具替换不兼容的命令,确保在不同操作系统下的一致性。

变更

文件 概要
package.json 替换不兼容的命令,如rm -rf替换为rimrafNODE_OPTIONS使用cross-env,并调整路径和引号格式。
packages/s2-core/package.json, packages/s2-react-components/package.json, packages/s2-react/package.json, packages/s2-vue/package.json 更新依赖以支持跨平台兼容性。
pnpm-lock.yaml 锁定文件更新以反映依赖项的变更。

@@ -28,8 +28,8 @@
"bootstrap": "pnpm install",
"bootstrap:ci": "pnpm bootstrap --frozen-lockfile",
"prepare": "husky install",
"clean": "pnpm -r --parallel exec rm -rf node_modules && rm -rf node_modules",
"clean:lock-file": "rm -rf pnpm-lock.yaml",
"clean": "pnpm -r --parallel exec rimraf node_modules && rimraf node_modules",

Choose a reason for hiding this comment

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

The command rm -rf has been replaced with rimraf to ensure compatibility across different operating systems, including Windows.

"build:umd": "pnpm -r --filter './packages/*' --stream build:umd",
"build:size-limit": "pnpm -r --filter './packages/*' --stream build:size-limit",
"build:size-limit-json": "pnpm -r --filter './packages/*' --stream build:size-limit-json",
"build": "pnpm -r --filter \"{packages/**}\" --stream build",

Choose a reason for hiding this comment

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

The filter syntax has been updated to use double quotes and curly braces for cross-platform compatibility with pnpm.

"lint:fix": "run-s lint:fix-script lint:fix-style lint:fix-docs lint:fix-word",
"lint:fix-word": "pnpm lint:word --fix",
"lint:fix-script": "pnpm lint:script --fix",
"lint:fix-style": "pnpm lint:style --fix",
"lint:fix-docs": "pnpm lint:docs --fix",
"site:start": "pnpm --filter @antv/s2-site start",
"site:build": "NODE_OPTIONS='--max-old-space-size=4096' pnpm --filter @antv/s2-site build",
"site:build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 pnpm --filter @antv/s2-site build",

Choose a reason for hiding this comment

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

The NODE_OPTIONS environment variable is now set using cross-env to ensure it works on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 pr(fix) bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛next版本window10安装依赖异常,无法参与贡献
1 participant