Skip to main content

项目Backstage结构

Backstage 是一个复杂的项目,GitHub 仓库中包含许多不同的文件和文件夹。 本文档旨在阐明这些文件和文件夹的用途。

通用文件和文件夹

在项目根目录下,有一组文件和文件夹,它们本身并不属于项目的一部分,对于查看代码的人来说可能熟悉,也可能不熟悉。

  • .changeset/ - This folder contains files outlining which changes occurred in the project since the last release. These files are added manually, but managed by changesets and will be removed at every new release. They are essentially building-blocks of a CHANGELOG. * .github/ - Standard GitHub folder. It contains - amongst other things - our workflow definitions and templates. Worth noting is the vale sub-folder which is used for a markdown spellchecker. * .yarn/ - Backstage ships with its own yarn implementation. This allows us to have better control over our yarn.lock file and hopefully avoid problems due to yarn versioning differences. * [contrib/](https://github.com/backstage/backstage/tree/master/co

Monorepo Packages

两个文件夹中的每个文件夹packages/plugins/中定义的 monorepo 设置中。软件包.json:

"workspaces": {
"packages": [
"packages/*",
"plugins/*"
]
},

让我们逐个来看。

packages/

这些是我们在项目中使用的所有软件包。插件请参见下面的内容。

  • app/ - This is our take on how an App could look like, bringing together a set of packages and plugins into a working Backstage App. This is not a published package, and the main goals are to provide a demo of what an App could look like and to enable local development. * backend/ - Every standalone Backstage project will have both an app and a backend package. The backend uses plugins to construct a working backend that the frontend (app) can use. * backend-common/ - There are no "core" packages in the backend. Instead we have backend-common which contains helper middleware and other utils. * catalog-client - An isomorphic client to interact with the Software Catalog. Backend plugins can use the pa

`plugins/``

Backstage应用程序的大部分功能都来自插件,甚至核心功能也可以是插件,比如编目为例。

我们可以将插件分为三种不同类型;前端,后端图形QL我们在给这些插件命名时,会用 dash- 后缀来区分它们。-backend表示这是一个后端插件,以此类推。

拆分插件的一个原因是其依赖性,另一个原因是为了明确分离关注点。

看看我们的插件目录或浏览插件文件夹。

monorepo 之外的软件包

为方便起见,我们在项目中加入了不属于 monorepo 设置的软件包。

  • microsite/ - 该文件夹包含 backstage.io 的源代码。它是用 Docusaurus 构建的。由于依赖关系的原因,该文件夹不是 monorepo 的一部分。请查看 microsite README,了解如何在本地运行它。

app专门使用的根文件

这些文件保存在项目根目录下主要是出于历史原因,其中一些文件可能会在将来的某个时候被移出根目录。

  • .npmrc - 公司拥有自己的 npm 注册表很常见,该文件确保此文件夹始终使用公共注册表。 * .yarnrc.yml - 执行 "我们的 "Yarn 版本。 * app-config.yaml - 应用程序的配置,包括前端和后端。 * catalog-info.yaml - 以 Backstage Entity 格式描述 Backstage。 * lerna.json - Lerna monorepo 配置。我们使用 "yarn 工作空间",因此该文件仅用于执行脚本。