开发策略

使用未来标志逐步采用功能

¥Gradual Feature Adoption with Future Flags

在我们的软件开发方法中,我们的目标是在主要版本中实现以下目标:

¥In our approach to software development, we aim to achieve the following goals for major releases:

  1. 增量功能采用:开发者可以灵活地逐一选择和集成新功能和变更,因为它们会在当前主要版本中可用。这与将所有更改打包到单个新主要版本中的传统方法不同。

    ¥Incremental Feature Adoption: Developers have the flexibility to choose and integrate new features and changes one by one, as they become available in the current major version. This is a departure from the traditional method of bundling all changes into a single new major release.

  2. 无缝版本升级:通过提前选择性地引入新功能,开发者可以平稳过渡到新的主要版本,而无需修改现有的应用代码。

    ¥Seamless Version Upgrades: By selectively incorporating new features ahead of time, developers can smoothly transition to new major versions without the need to modify their existing application code.

不稳定的 API 和未来标志

¥Unstable APIs and Future Flags

我们在当前版本中引入了新功能,并使用了一个类似 unstable_someFeature 的未来标志。你可以在 vite.config.ts 文件中的 Remix Vite 插件 future 选项中指定以下标志:

¥We introduce new features into the current release with a future flag that looks something like unstable_someFeature. You can specify these flags in the Remix Vite Plugin future option in your vite.config.ts file:

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    remix({
      future: {
        unstable_someFeature: true,
      },
    }),
  ],
});

如果你尚未使用 Vite,你可以通过 remix.config.js future 选项提供 Future Flags

  • 一旦某个不稳定的功能达到稳定状态,我们会删除特殊前缀,并在下一个次要版本中将其纳入。此时,API 的结构在后续的小版本中保持一致。

    ¥Once an unstable feature reaches a stable state, we remove the special prefix and include the feature in the next minor release. At this point, the API's structure remains consistent throughout subsequent minor releases.

  • 这种方法使我们能够与早期采用者协作改进 API,在不稳定阶段纳入必要的更改,而不会影响所有用户。稳定版本可以受益于这些改进,而不会造成中断。

    ¥This approach allows us to refine the API collaboratively with early adopters, incorporating necessary changes in the unstable phase without affecting all users. The stable releases then benefit from these improvements without disruptions.

  • 如果你正在使用标有 unstable_* 标志的功能,请务必查看每个次要版本的发行说明。这是因为这些功能的行为或结构可能会发生变化。在此阶段,你的反馈对于在最终发布之前增强功能至关重要!

    ¥If you're utilizing features labeled with unstable_* flags, it's crucial to review the release notes for each minor release. This is because the behavior or structure of these features might evolve. Your feedback during this phase is invaluable in enhancing the feature before the final release!

使用 Future 标志管理重大变更

¥Managing Breaking Changes with Future Flags

当我们引入重大更改时,我们会在当前主要版本的上下文中进行,并将其隐藏在未来的标志后面。例如,如果我们在 v2 中,则重大变更可能会被放置在名为 v3_somethingDifferent 的未来标志下。

¥When we introduce breaking changes, we do so within the context of the current major version, and we hide them behind future flags. For instance, if we're in v2, a breaking change might be placed under a future flag named v3_somethingDifferent.

import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    remix({
      future: {
        v3_someFeature: true,
      },
    }),
  ],
});
  • 现有的 v2 行为和新的 v3_somethingDifferent 行为同时共存。

    ¥Both the existing v2 behavior and the new v3_somethingDifferent behavior coexist simultaneously.

  • 应用可以逐步适应变化,一次一个步骤,而不必在下一个主要版本中一次性适应大量变化。

    ¥Applications can adopt changes incrementally, one step at a time, instead of having to adjust to a multitude of changes all at once in the next major release.

  • 如果所有 v3_* 的未来标志都已启用,则理想情况下,过渡到 v3 不需要对代码库进行任何更改。

    ¥If all the v3_* future flags are enabled, transitioning to v3 should ideally not require any changes to your codebase.

  • 一些未来会导致重大变更的标志最初以 unstable_* 标志开始。这些库可能会在小版本发布期间进行修改。一旦它们成为 v3_* 的未来标志,相应的 API 就会被设置,并且不会再更改。

    ¥Some future flags that bring about breaking changes initially start as unstable_* flags. These might undergo modifications during minor releases. Once they become v3_* future flags, the corresponding API is set and won't change further.

摘要

¥Summary

我们的开发策略侧重于逐步采用功能以及主要版本的无缝版本升级。这使得开发者能够选择性地集成新功能,避免在版本转换期间进行大量的代码调整。通过 unstable_* 标志引入新功能,我们与早期采用者协作改进 API,同时确保稳定版本能够从增强功能中受益。通过使用 v3_* 标志仔细管理重大更改,我们提供了逐步采用更改的灵活性,从而促进了主要版本之间的更平稳过渡。虽然这增加了开发 Remix 框架的复杂性,但这种以开发者为中心的方法极大地简化了使用 Remix 的应用开发,最终提高了软件质量和(希望如此!)开发者满意度。

¥Our development strategy focuses on gradual feature adoption and seamless version upgrades for major releases. This empowers developers to selectively integrate new features, avoiding the need for extensive code adjustments during version transitions. By introducing features through unstable_* flags, we refine the API collaboratively with early adopters while ensuring stable releases benefit from enhancements. Through careful management of breaking changes using v3_* flags, we provide the flexibility to adopt changes incrementally, facilitating a smoother transition between major versions. While this increases the complexity of developing Remix the framework, this developer-centric approach greatly simplifies application development with Remix, ultimately leading to improved software quality and (hopefully!) developer satisfaction.

Remix v2.17 中文网 - 粤ICP备13048890号