Skip to content

Commit

Permalink
check devDeps if we're in an app
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Jun 24, 2024
1 parent 698f371 commit efa57b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions packages/ember-auto-import/ts/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,19 @@ export default class Package {

// the semver range of the given package that our package requests in
// package.json
requestedRange(packageName: string): string | undefined {
requestedRange(
packageName: string,
includeDevDeps: boolean
): string | undefined {
let { pkg } = this;
return (
pkg.dependencies?.[packageName] || pkg.peerDependencies?.[packageName]
);
let result =
pkg.dependencies?.[packageName] || pkg.peerDependencies?.[packageName];

if (!result && includeDevDeps) {
result = pkg.devDependencies?.[packageName];
}

return result;
}

private hasNonDevDependency(name: string): boolean {
Expand Down
3 changes: 2 additions & 1 deletion packages/ember-auto-import/ts/splitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ export default class Splitter {
}

let requestedRange = nextImport.package.requestedRange(
nextTarget.packageName
nextTarget.packageName,
!nextImport.package.isAddon // only include devDeps if the package is an app
);
if (!requestedRange) {
// this is probably an error condition, but it's not the error condition
Expand Down

0 comments on commit efa57b4

Please sign in to comment.