@pnpm/workspace.read-manifest
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -13,6 +13,4 @@ "use strict"; | ||
const manifest = await readManifestRaw(dir); | ||
if (validateWorkspaceManifest(manifest)) { | ||
return manifest; | ||
} | ||
return undefined; | ||
validateWorkspaceManifest(manifest); | ||
return manifest; | ||
} | ||
@@ -33,7 +31,6 @@ exports.readWorkspaceManifest = readWorkspaceManifest; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
function validateWorkspaceManifest(manifest) { | ||
if (manifest === undefined || manifest === null) { | ||
// Empty or null manifest is ok | ||
return true; | ||
return; | ||
} | ||
@@ -48,4 +45,8 @@ if (typeof manifest !== 'object') { | ||
// manifest content `{}` is ok | ||
return true; | ||
return; | ||
} | ||
assertValidWorkspaceManifestPackages(manifest); | ||
checkWorkspaceManifestAssignability(manifest); | ||
} | ||
function assertValidWorkspaceManifestPackages(manifest) { | ||
if (!manifest.packages) { | ||
@@ -66,4 +67,10 @@ throw new InvalidWorkspaceManifestError('packages field missing or empty'); | ||
} | ||
return true; | ||
} | ||
/** | ||
* Empty function to ensure TypeScript has narrowed the manifest object to | ||
* something assignable to the {@see WorkspaceManifest} interface. This helps | ||
* make sure the validation logic in this file is correct as it's refactored in | ||
* the future. | ||
*/ | ||
function checkWorkspaceManifestAssignability(_manifest) { } | ||
class InvalidWorkspaceManifestError extends error_1.PnpmError { | ||
@@ -70,0 +77,0 @@ constructor(message) { |
{ | ||
"name": "@pnpm/workspace.read-manifest", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Reads a workspace manifest file", | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@pnpm/workspace.read-manifest": "1.0.1" | ||
"@pnpm/workspace.read-manifest": "1.0.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7200
80
1