From 1e90413f6b592c1f6f1eaba5b0ffd3a498689748 Mon Sep 17 00:00:00 2001 From: Alexander Trakhimenok <533159+trakhimenok@users.noreply.github.com> Date: Fri, 10 Jun 2022 19:23:43 +0100 Subject: [PATCH] feat(core): throw graceful error in runNxMigration() if no collection (#10655) --- packages/nx/src/command-line/migrate.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/nx/src/command-line/migrate.ts b/packages/nx/src/command-line/migrate.ts index 6f457ecb03b8c..adddfc926c9b3 100644 --- a/packages/nx/src/command-line/migrate.ts +++ b/packages/nx/src/command-line/migrate.ts @@ -1040,6 +1040,12 @@ async function runNxMigration(root: string, packageName: string, name: string) { const collection = readJsonFile(collectionPath); const g = collection.generators || collection.schematics; + if (!g[name]) { + const source = collection.generators ? 'generators' : 'schematics'; + throw new Error( + `Unable to determine implementation path for "${collectionPath}:${name}" using collection.${source}` + ); + } const implRelativePath = g[name].implementation || g[name].factory; let implPath: string;