Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Nov 11, 2024
1 parent 25d203d commit b3e3072
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/type-syncer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe('type syncer', () => {
result.syncedFiles[2].newTypings.map((x) => x.typingsName).sort(),
).toEqual(['package3'])
expect(result.syncedFiles[3].package.devDependencies).toStrictEqual(
undefined, // Why does this work!? In practice, it's `{}`.
undefined,
)
})

Expand Down
9 changes: 4 additions & 5 deletions src/type-syncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ export function createTypeSyncer(
): Promise<ISyncedFile> {
const { ignoreDeps, ignorePackages } = opts

const packageFile = file
const allLocalPackages = Object.values(IDependencySection)
.map((dep) => {
const section = getDependenciesBySection(packageFile, dep)
const section = getDependenciesBySection(file, dep)
if (!section) return []

const ignoredSection = ignoreDeps?.includes(dep)
Expand Down Expand Up @@ -187,9 +186,9 @@ export function createTypeSyncer(
}
}),
).then(mergeObjects)
const devDeps = packageFile.devDependencies
const devDeps = file.devDependencies
if (!dryRun) {
const newPackageFile: IPackageFile = { ...packageFile }
const newPackageFile: IPackageFile = { ...file }

if (Object.keys(devDepsToAdd).length > 0) {
newPackageFile.devDependencies = orderObject({
Expand All @@ -204,7 +203,7 @@ export function createTypeSyncer(
return {
filePath,
newTypings: used,
package: packageFile,
package: file,
}
}
}
Expand Down

0 comments on commit b3e3072

Please sign in to comment.