From 0242c8a3442f3a74f48569dbcdb7a864516afef1 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 18 May 2020 11:35:08 +0200 Subject: [PATCH] packages/cli: add more explanations to installWithLocalDeps + remove console.log --- packages/cli/src/lib/tasks.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/lib/tasks.ts b/packages/cli/src/lib/tasks.ts index 2fa6220f18..721e1a355b 100644 --- a/packages/cli/src/lib/tasks.ts +++ b/packages/cli/src/lib/tasks.ts @@ -118,8 +118,11 @@ const PATCH_PACKAGES = [ 'theme', ]; +// This runs a `yarn install` task, but with special treatment for e2e tests export async function installWithLocalDeps(dir: string) { - // e2e testing needs special treatment + // This makes us install any package inside this repo as a local file dependency. + // For example, instead of trying to fetch @backstage/core from npm, we point it + // to /packages/core. This makes yarn use a simple file copy to install it instead. if (process.env.BACKSTAGE_E2E_CLI_TEST) { Task.section('Linking packages locally for e2e tests'); @@ -163,6 +166,11 @@ export async function installWithLocalDeps(dir: string) { }); }); + // This takes care of pointing all the installed packages from this repo to + // dist instead of the local src. + // For example node_modules/@backstage/core/packages.json is rewritten to point + // types to dist/index.d.ts and the main:src field is removed. + // Without this we get type checking errors in the e2e test if (process.env.BACKSTAGE_E2E_CLI_TEST) { Task.section('Patchling local dependencies for e2e tests'); @@ -177,7 +185,6 @@ export async function installWithLocalDeps(dir: string) { name, 'package.json', ); - console.log('DEBUG: depJsonPath =', depJsonPath); const depJson = await fs.readJson(depJsonPath); // We want dist to be used for e2e tests