From c7bb60c8ebabe691d4d6a495062e9ec501644ec8 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Sat, 22 Jun 2024 10:27:29 +0100 Subject: [PATCH 1/3] stop checking devDependencies when checking requested range of a package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I noticed this when I was linking a package that had a peerDependency range wider than it's devDependencies (ember-showdown-prism) i don't understand why we would ever want to check the requested range of a dev depdency of a package 🤔 but perhaps there is a nuance that I don't understand here and we need to encode that nuance into the question that is being asked --- packages/ember-auto-import/ts/package.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ember-auto-import/ts/package.ts b/packages/ember-auto-import/ts/package.ts index 0ce0fe3f..e41a9cd4 100644 --- a/packages/ember-auto-import/ts/package.ts +++ b/packages/ember-auto-import/ts/package.ts @@ -254,7 +254,6 @@ export default class Package { let { pkg } = this; return ( pkg.dependencies?.[packageName] || - pkg.devDependencies?.[packageName] || pkg.peerDependencies?.[packageName] ); } From 698f371f4fa523ae018ca623acafecc140d8c81b Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Sat, 22 Jun 2024 10:31:52 +0100 Subject: [PATCH 2/3] fix lint --- packages/ember-auto-import/ts/package.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/ember-auto-import/ts/package.ts b/packages/ember-auto-import/ts/package.ts index e41a9cd4..4ce9f83b 100644 --- a/packages/ember-auto-import/ts/package.ts +++ b/packages/ember-auto-import/ts/package.ts @@ -253,8 +253,7 @@ export default class Package { requestedRange(packageName: string): string | undefined { let { pkg } = this; return ( - pkg.dependencies?.[packageName] || - pkg.peerDependencies?.[packageName] + pkg.dependencies?.[packageName] || pkg.peerDependencies?.[packageName] ); } From ee0cb687b40ea24197d834a9d6b5e9ac5c319743 Mon Sep 17 00:00:00 2001 From: Chris Manson Date: Mon, 24 Jun 2024 15:17:15 +0100 Subject: [PATCH 3/3] check devDeps if we're in an app --- packages/ember-auto-import/ts/package.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/ember-auto-import/ts/package.ts b/packages/ember-auto-import/ts/package.ts index 4ce9f83b..64e49668 100644 --- a/packages/ember-auto-import/ts/package.ts +++ b/packages/ember-auto-import/ts/package.ts @@ -252,9 +252,15 @@ export default class Package { // package.json requestedRange(packageName: string): string | undefined { let { pkg } = this; - return ( - pkg.dependencies?.[packageName] || pkg.peerDependencies?.[packageName] - ); + let result = + pkg.dependencies?.[packageName] || pkg.peerDependencies?.[packageName]; + + // only include devDeps if the package is an app + if (!result && !this.isAddon) { + result = pkg.devDependencies?.[packageName]; + } + + return result; } private hasNonDevDependency(name: string): boolean {