From 40199b61d69a88ba7ae9813ca223968c7cb010d9 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 25 Sep 2021 16:08:10 +0200 Subject: [PATCH] cli: include root package in schema search + update docs Signed-off-by: Patrik Oldsberg --- .changeset/good-cars-confess.md | 5 +++++ docs/conf/defining.md | 7 ++++--- packages/cli/src/lib/config.ts | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .changeset/good-cars-confess.md diff --git a/.changeset/good-cars-confess.md b/.changeset/good-cars-confess.md new file mode 100644 index 0000000000..12ec838544 --- /dev/null +++ b/.changeset/good-cars-confess.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Configuration schema is now also collected from the root `package.json` if it exists. diff --git a/docs/conf/defining.md b/docs/conf/defining.md index f13beb9f77..6462f4f60a 100644 --- a/docs/conf/defining.md +++ b/docs/conf/defining.md @@ -13,9 +13,10 @@ which during validation is stitched together into a single schema. ## Schema Collection and Definition Schemas are collected from all packages and dependencies in each repo that are a -part of the Backstage ecosystem, including transitive dependencies. The current -definition of "part of the ecosystem" is that a package has at least one -dependency in the `@backstage` namespace, but this is subject to change. +part of the Backstage ecosystem, including the root package and transitive +dependencies. The current definition of "part of the ecosystem" is that a +package has at least one dependency in the `@backstage` namespace or a +`"configSchema"` field in `package.json`, but this is subject to change. Each package is searched for a schema at a single point of entry, a top-level `"configSchema"` field in `package.json`. The field can either contain an diff --git a/packages/cli/src/lib/config.ts b/packages/cli/src/lib/config.ts index a93f040122..3688d60089 100644 --- a/packages/cli/src/lib/config.ts +++ b/packages/cli/src/lib/config.ts @@ -39,6 +39,8 @@ export async function loadCliConfig(options: Options) { const schema = await loadConfigSchema({ dependencies: localPackageNames, + // Include the package.json in the project root if it exists + packagePaths: [paths.resolveTargetRoot('package.json')], }); const appConfigs = await loadConfig({