Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Feature Request: Provide hook for executing custom task after build has been completed

未关闭
#490 7 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript

调研方向

Start with the custom task lifecycle configuration described in the issue and the TaskUtil.registerCleanupTask API used by the workaround. Trace how cleanup tasks are scheduled relative to writing the dist folder. Done means a documented lifecycle hook can run after the build completes and access the final physical dist resources.

由索引模型根据 Issue 内容生成。

描述

Is your feature request related to a problem? Please describe.

As of now (Specification Version 2.2) there is no proper way to execute a custom task after the build itself has succeeded.
It is only possible to execute a custom task after other individual build tasks (latest possible point of time is afterTask: generateVersionInfo)
At this point of time the build itself has not been completed, so the dist folder has not been written yet.
But a e.g. task for deployment requires the final dist folder for zipping and uploading.

The @sap/ux-ui5-tooling custom task deploy-to-abap is an example for the lack of this feature.

The custom task can only run afterTask: generateVersionInfo (documentation even states afterTask: replaceVersion, which is way to early btw).

As a workaround the task only considers virtual build resources for deployment.

But only the dist folder contains the final physical resources and one should not rely on any virtual resources.
Some custom tasks might even copy (physical) files from project shims to the dist folder during the build process (e.g. ui5-task-copy-shim-resources).

Describe the solution you'd like

An example config could look like this to register a custom task after the build has completed:

builder:
  customTasks:
  - name: deploy-to-abap
    afterTask: buildCompleted
    configuration:
      some: configurations 

or

tooling:
  lifecycleTasks:
  - name: deploy-to-abap
    after: buildCompleted
    configuration:
      some: configurations 

Describe alternatives you've considered

A workaround for now is to use taskUtil.registerCleanupTask, because this is the only point of time where one can be sure that the build has completed.

module.exports = async ({ taskUtil, options }) => {
  const { configuration = {} } = options
  const { target, credentials, app } = configuration
  const { url, client } = target
  const { username, password } = credentials
  const { transport } = app
  // https://sap.github.io/ui5-tooling/api/module-@ui5_builder.tasks.TaskUtil.html
  taskUtil.registerCleanupTask(async () => {
    await abapDeploy({
      sourceFolder: path.join(process.cwd(), 'dist'),
      targetSystem: url,
      client,
      username,
      password,
      abapTransport: transport
    })
    await cleanup([
      '.ABAPDeployResources',
      'abap-deploy.log',
      'dist.zip'
    ])
  })
}

Additional context

This should be a feature that many projects should require when it comes to delivering for production using the UI5 Tooling.

主要语言
JavaScript
星标
511
派生
83
平均合并
1 天 5 小时
30 天内合并 PR
55

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

UI5/cli 的其他 Issue

查看 UI5/cli 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。