Skip to content

Commit d1da609

Browse files
committed
fix(core): correctly check a file is package.json
1 parent b90dae4 commit d1da609

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/manifests/manifest-data.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type SetVersion = (name: string, version: string, manifests: IManifest[])
1010
export type SetVersionRange = (range: string, manifests: IManifest[]) => IManifest[];
1111
export type SetVersionsToNewestMismatch = (manifests: IManifest[]) => IManifest[];
1212

13+
const isObject = (value: any) => Boolean(value && typeof value === 'object');
1314
const isValid = (version: string) => semver.valid(version) !== null;
1415
const join = ({ name, version }: IDictionary<string>) => `${name}@${version}`;
1516
const gatherDependencies = (manifest: IManifest) =>
@@ -20,11 +21,9 @@ const gatherDependencies = (manifest: IManifest) =>
2021

2122
const isManifest = (value: any): boolean =>
2223
Boolean(
23-
value &&
24-
typeof value === 'object' &&
25-
'dependencies' in value &&
26-
'devDependencies' in value &&
27-
'peerDependencies' in value
24+
isObject(value) &&
25+
'name' in value &&
26+
('dependencies' in value || 'devDependencies' in value || 'peerDependencies' in value)
2827
);
2928

3029
const getMismatchedVersions: GetMismatchedVersions = (manifests) =>

0 commit comments

Comments
 (0)