Skip to content

refactor: consolidate monorepo packages (12 -> 8) - #2885

Merged
lzxue merged 4 commits into
masterfrom
refactor/consolidate-packages
Jul 23, 2026
Merged

refactor: consolidate monorepo packages (12 -> 8)#2885
lzxue merged 4 commits into
masterfrom
refactor/consolidate-packages

Conversation

@lzxue

@lzxue lzxue commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

背景

将能合并的包并入上游消费包,以减少包数量、简化依赖图:12 个子包合并为 8 个

合并方案

被合并包 并入目标 说明
@antv/l7-map @antv/l7-maps src/__tests__ 迁入 maps/src/mapbase,maps 直出 map 原语
@antv/l7-renderer @antv/l7-scene DeviceRendererService 并入 scene/src/renderer
@antv/l7-component @antv/l7-scene Popup/Logo/Zoom/Scale 等 UI 控件并入 scene/src/component;scene 切到 babel transformer 以复用 transform-import-css-l7 内联样式,并补 style.d.ts
@antv/l7-source @antv/l7-layers 数据源并入 layers/src/sourceSource 通过 layers 再导出

合并后保留的 8 个包:

```
@antv/l7 (聚合入口)
@antv/l7-core
@antv/l7-utils
@antv/l7-maps (吸收 map)
@antv/l7-scene (吸收 renderer + component)
@antv/l7-layers (吸收 source)
@antv/l7-three
@antv/l7-test-utils (私有)
```

统一改动

  • packages/l7: 删除对 `component`/`source` 的直接依赖与 re-export,改由 `scene`/`layers` 透传
  • tsconfig.json: 移除 `component`/`source` 路径映射
  • site/.dumirc.ts: 修正 `map`/`renderer`/`component`/`source` 的 alias 指向合并后位置
  • 删除零引用的 `maps/legacy`(旧 mapbox-gl v1 fork,已被 mapbase 取代)

验证

  • 构建: `maps`(92) / `scene`(66) / `layers`(255) / `l7`(umbrella+UMD) 全部通过,UMD bundle 含全部 component 控件、Source 及 source side-effect 注册串
  • 测试: 364 pass;31 个 `TestScene` 套件失败为既有问题(headless-gl 在 Node22 下 `gl()` 返回 null),与本次合并无关(未改动的 `scene/tests/index.spec.ts` 同样失败)

影响

  • 规模: 422 文件变更,+2252 / −18281 行

将能合并的包并入上游消费包以减少包数量、简化依赖图:

- map   -> maps    (src/__tests__ 迁入 maps/src/mapbase, maps 直出 map 原语)
- renderer -> scene (DeviceRendererService 并入 scene/src/renderer)
- component -> scene (Popup/Logo/Zoom/Scale 等 UI 控件并入 scene/src/component;
  scene 切到 babel transformer 以复用 transform-import-css-l7 内联样式, 并补 style.d.ts)
- source -> layers (数据源并入 layers/src/source, Source 通过 layers 再导出)

统一改动:
- packages/l7: 删除对 component/source 的直接依赖与 re-export, 改由 scene/layers 透传
- tsconfig.json: 移除 component/source 路径映射
- site/.dumirc.ts: 修正 map/renderer/component/source 的 alias 指向合并后位置
- 删除零引用的 maps/legacy (旧 mapbox-gl v1 fork, 已被 mapbase 取代)

构建验证: maps(92) / scene(66) / layers(255) / l7(umbrella+UMD) 全部通过,
UMD bundle 含全部 component 控件、Source 及 source side-effect 注册串。
测试: 364 pass; 31 个 TestScene 套件失败为既有问题(headless-gl 在 Node22
下 gl() 返回 null),与本次合并无关(未改动的 scene/__tests__/index.spec.ts
同样失败)。
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9a37ac3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

lzxue added 3 commits July 23, 2026 23:38
master 的 @antv/l7-source 渐进式重构(#2882)与本分支搬运(source→layers)冲突,逐类解决:

- layers/src/source 与 __tests__/source 完整采用 master 新结构
  (tile-source/、parser/ndi.ts、base-source.ts、create-source.ts 等)
- relative-coordinates 已由 master 上移至 @antv/l7-utils,保留 utils 版本
- maps 底图迁移:采用 master 的 BaseMap/MapboxBaseMap 新结构,
  @antv/l7-map 引用改 ../mapbase(map 包已并入 maps/src/mapbase)
- BaseLayer: @antv/l7-source → ../source,保留 master 的 processRelativeCoordinates
- 删除被合并包(source/component/map/renderer)残留,版本号同步 master 2.30.0-beta.0
- l7/layers/scene 顶部元数据冲突取 master 版本号;test-utils 保留 peerDependencies
- __tests__/source 测试相对路径同步调整(../src → ../../src/source)

构建验证:layers(271) / maps(88) / scene(66) / l7(UMD 1.4M < 1.7Mb) 全部通过
合并 master 后两处 CI 失败:

1. lint: @antv/l7-scene 的 sideEffects: false 与合并 component 后的样式导入
   冲突(tree-shaking 会丢样式)。参照原 component 包改为
   ["*.css","*.less","*.js","*/iconfont/*"],check-deps 0 error。

2. unit-test: camera.spec.ts 在 __tests__/mapbase/(两层深),
   ../src/map/ 只解析到 __tests__/src(少一级 ../)。
   改为 ../../src/mapbase/map/(并修正 map 包合并后的 mapbase 路径)。
   本地 158 tests pass。
7 个合并引入的文件未通过 format-check:
- maps/src/mapbase/map/handler/{drag_move_state_manager,two_fingers_touch}.ts
- scene/src/component/control/{baseControl/control,baseControl/popperControl,fullscreen}.ts
- scene/src/component/utils/screenfull.ts
- scene/src/renderer/device/utils/typedarray.ts

prettier --write 修复,format-check 全部通过。
@lzxue
lzxue merged commit 18156ea into master Jul 23, 2026
5 checks passed
@lzxue
lzxue deleted the refactor/consolidate-packages branch July 23, 2026 16:05
lzxue added a commit that referenced this pull request Jul 24, 2026
Remove 20 changeset files left stale by the 12->8 package
consolidation (#2885 / 18156ea):

- 18 x refactor-source-*.md reference @antv/l7-source, which was
  merged into @antv/l7-layers by #2885 and no longer exists as a
  workspace package.
- 2 x fix-maps-bmap-tmap-types.md / fix-test-utils-redundant-peerdeps.md
  reference live packages (@antv/l7-maps / @antv/l7-test-utils) but are
  likewise already consumed.

All 20 are already consumed: recorded in .changeset/pre.json
(changesets[]) and released to CHANGELOGs as 2.30.0-beta.0 (commit
471662a). In changeset pre-release mode the .md files are retained on
disk until 'pre exit', but the 18 referencing the merged-away
@antv/l7-source broke tooling:

    changeset status / version -> Error: Found changeset
    refactor-source-01 for package @antv/l7-source which is not in
    the workspace

Purging restores .changeset/ to pending-only + infra state and
unblocks changeset status/version for follow-on P1/P2 entries. Content
history is preserved in CHANGELOGs and pre.json (ids retained).
No version bumps; no runtime change.
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.

1 participant