返回提示词目录第 1180 页

迁移构建工具并验证产物一致性

梳理旧构建职责并生成新配置,通过产物对比验证一致性,给出分阶段切换与回退方案。

完整提示词

<context>
An engineer is moving a project's build to {{target_tool}}. Build migrations look done once the app starts locally, and then break in production: a missing polyfill or browser target, environment variables exposed under a different prefix or not at all, different asset paths and hashing, source maps gone, a plugin that silently did something (code generation, licence headers, resource filtering, compiler flags), or a CI cache that no longer applies. The expert approach maps every responsibility of the old build first, writes the new config to match it, and proves parity by comparing outputs, not by "it runs".
</context>

<task>
<current_config>
{{current_config}}
</current_config>

1. Map every responsibility of the current build, including what plugins and scripts do implicitly: entry points, outputs and their paths, loaders or source sets, code generation, resource processing, environment variables and how they are injected, dev server and proxy settings, test integration, compiler or language level flags, optimisation and minification, source maps, targets (browsers, JVM release, compilers and architectures), dependency management and repositories, publishing and versioning. For each, the equivalent in {{target_tool}}: built in, plugin (name it only if sure it exists, otherwise describe what to look for), or custom.
2. Write the new configuration for the mapped features, idiomatic for the target rather than a line-by-line copy.
3. Environment and conventions: the target's rules for environment variables (prefixes, build-time versus run-time), file locations (for example `index.html` at the root for some bundlers), module format assumptions (CommonJS versus ESM), and anything developers must change in their habits.
4. Parity checks: compare old and new artifacts on the same commit. Frontend: file list, bundle sizes per chunk, environment values in the bundle, source maps, browser support, and a smoke test of the built app. JVM: dependency tree diff, artifact contents and manifest, test counts. Native: compiler and linker flags per target, symbol and size comparison, test results.
5. Rollout: both builds run in CI for a period (the new one non-blocking first, then blocking), developers switch local scripts, then the deploy uses the new artifact behind a quick revert, then the old config is deleted.
</task>

<constraints>
- Do not invent plugin names, options or defaults. If unsure, describe the needed behaviour and say what to verify in the docs.
- Keep the produced artifacts equivalent unless the user asks for changes; list intentional differences.
- If the config references files not shown (custom loaders, scripts, parent POMs, included makefiles), list them and ask.
{{> guardrails/scope-discipline}}
{{> output/uncertainty}}
</constraints>

<output_format>
## Feature mapping
Table: responsibility | current implementation | target equivalent | status (built in, plugin, custom, to verify).

## New configuration
The new config files in code blocks, plus changed scripts.

## Environment and conventions
Bullets.

## Parity checks
Checklist with the commands to compare outputs.

## Rollout
Numbered phases with exit criteria and the revert path.

## Risks and open questions
Bullets.
</output_format>

可替换内容

  • {{target_tool}}
  • {{current_config}}
  • {{> guardrails/scope-discipline}}
  • {{> output/uncertainty}}

分类与标签

编程开发、构建工具迁移、产物对比、持续集成、回退方案

前往 AI 图片创作