@abapify/adt-plugin-abapgit

中文文档
0.4.34发布于 2026/11/03MITTypeScriptES Module构建来源已验证近 30 天下载 3113

abapGit serialization plugin for adt-cli — round-trips ADT objects to/from the abapGit on-disk format

原始使用文档
文档目录15 节
  1. Pure materialization
  2. Architecture Overview
  3. Key Design Decisions
  4. 1. XSD Schemas as Single Source of Truth
  5. 2. ts-xsd for Type-Safe XML Handling
  6. 3. ADK as Client-Agnostic Facade
  7. 4. Handlers Don't Touch File System
  8. Supported Object Types
  9. File Structure
  10. Development
  11. Building
  12. Testing
  13. Regenerating Schemas
  14. Contributing
  15. See Also

@abapify/adt-plugin-abapgit

version

abapGit format plugin for ADT — serializes ABAP objects to Git-compatible XML/ABAP files.

Pure materialization

The registered abapgitFormatPlugin can produce a desired object tree without filesystem, ADT, or Git side effects. Explicit source components override mutable ADK source getters, while existing XSD-backed handlers continue to produce metadata:

const { files } = await abapgitFormatPlugin.materialize({
  object: adkClass,
  objectType: 'CLAS',
  packagePath: ['ZROOT', 'ZROOT_FEATURE'],
  sources: {
    main: selectedMainSource,
    definitions: selectedLocalDefinitions,
  },
  formatOptions: { folderLogic: 'prefix' },
});

Paths are rooted below src/, ordered deterministically, and annotated with their semantic role and source-component identity. Existing filesystem import and Git-to-SAP export APIs remain unchanged.

Architecture Overview

┌─────────────────────────────────────────────────────────────────────┐
│                        adt-plugin-abapgit                           │
├─────────────────────────────────────────────────────────────────────┤
│  XSD Schemas (xsd/)          →  ts-xsd codegen  →  TypeScript types │
│  (XML structure definition)     (build time)       + parser/builder │
├─────────────────────────────────────────────────────────────────────┤
│  Object Handlers (handlers/)                                        │
│  ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐       │
│  │  CLAS   │ │  INTF   │ │  DEVC   │ │  DTEL   │ │  DOMA   │       │
│  │ handler │ │ handler │ │ handler │ │ handler │ │ handler │       │
│  └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘       │
│       └──────────┬┴──────────┬┴──────────┬┴──────────┘             │
│                  ▼           ▼           ▼                          │
│            createHandler (factory)                                  │
│            - Auto-registration                                      │
│            - Default serialize logic                                │
│            - File naming conventions                                │
├─────────────────────────────────────────────────────────────────────┤
│  ADK Facade (@abapify/adk)                                          │
│  - AdkClass, AdkInterface, AdkPackage...                            │
│  - Client-agnostic object model                                     │
│  - Source code retrieval via getSource()/getIncludeSource()         │
└─────────────────────────────────────────────────────────────────────┘

Key Design Decisions

1. XSD Schemas as Single Source of Truth

Why XSD?

  • XML Schema Definition (XSD) is the industry standard for XML structure validation
  • Can be used outside our tools (e.g., xmllint --schema intf.xsd file.xml)
  • Provides formal contract for abapGit XML format
  • Enables automated validation in CI/CD pipelines
# Validate any abapGit XML file against our schema
xmllint --schema xsd/intf.xsd myinterface.intf.xml --noout

2. ts-xsd for Type-Safe XML Handling

Why ts-xsd?

Unlike typical XML codegen tools that only generate types, ts-xsd provides:

  • TypeScript types with full type inference
  • XML parser that returns typed objects
  • XML builder that accepts typed objects
  • Schema object for runtime validation
// Generated from XSD - fully typed parse/build
import { intf } from './schemas/generated';

const data = intf.parse(xmlString); // → AbapGitIntf (typed)
const xml = intf.build(data); // → string (valid XML)

3. ADK as Client-Agnostic Facade

Why not implement ADT client features in the plugin?

The plugin only consumes the ADK facade:

  • ADK handles all SAP communication details
  • Plugin focuses purely on serialization format
  • Same plugin works with any ADT client implementation
  • Clear separation of concerns
// Plugin receives ADK objects, doesn't care how they were fetched
getSources: (cls) =>
  cls.includes.map((inc) => ({
    suffix: ABAPGIT_SUFFIX[inc.includeType],
    content: cls.getIncludeSource(inc.includeType), // ADK handles this
  }));

4. Handlers Don't Touch File System

Why delegate file operations to base class?

Object handlers only define mappings:

  • toAbapGit() - ADK data → abapGit XML structure
  • getSource() / getSources() - which source files to create

The createHandler factory handles:

  • File creation with correct naming
  • XML building with proper envelope
  • Promise resolution for async sources
  • Empty content filtering

Supported Object Types

TypeStatusHandlerNotes
CLAS✅clas.tsMultiple includes (main, locals_def, locals_imp, testclasses, macros)
INTF✅intf.tsSingle source file
DEVC✅devc.tsFixed filename package.devc.xml
DTEL✅dtel.tsMetadata only (no source)
DOMA✅doma.tsCustom serialize for fixed values

File Structure

src/
├── zcl_example.clas.abap              # Main class source
├── zcl_example.clas.locals_def.abap   # Local type definitions
├── zcl_example.clas.locals_imp.abap   # Local implementations
├── zcl_example.clas.testclasses.abap  # Test classes
├── zcl_example.clas.xml               # Class metadata
├── zif_example.intf.abap              # Interface source
├── zif_example.intf.xml               # Interface metadata
├── ztest_dtel.dtel.xml                # Data element (no source)
├── ztest_doma.doma.xml                # Domain (no source)
└── package.devc.xml                   # Package definition

Development

Building

npx nx build adt-plugin-abapgit

Testing

npx nx test adt-plugin-abapgit

Regenerating Schemas

After modifying XSD files:

npx nx codegen adt-plugin-abapgit

Contributing

See CONTRIBUTING.md for detailed guidelines on:

  • Adding new object type support
  • XSD schema conventions
  • Handler implementation patterns
  • Testing requirements

See Also

版本与发布记录

@abapify/adt-plugin-abapgit 共发布 30 个版本,首次发布于 2026/04/21;过去 12 个月发布了 30 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.34latest2026/11/034 天前
0.4.332026/11/025 天前
0.4.322026/11/025 天前
0.4.312026/11/016 天前
0.4.292026/10/308 天前
0.4.282026/10/308 天前

关于 @abapify/adt-plugin-abapgit 的常见问题

@abapify/adt-plugin-abapgit 是什么?

abapGit serialization plugin for adt-cli — round-trips ADT objects to/from the abapGit on-disk format

如何安装 @abapify/adt-plugin-abapgit?

在项目目录运行 npm install @abapify/adt-plugin-abapgit,或使用 pnpm add / yarn add / bun add。

@abapify/adt-plugin-abapgit 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@abapify/adt-plugin-abapgit 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@abapify/adt-plugin-abapgit 可以商用吗?

@abapify/adt-plugin-abapgit 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@abapify/adt-plugin-abapgit 的下载量有多少?

根据 npm 官方下载统计,@abapify/adt-plugin-abapgit 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,113 次,日均约 104 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@abapify/adt-plugin-abapgit 还在维护吗?

最新版本 0.4.34 发布于 2026/11/03(4 天前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。