@pnpm/workspace.read-manifest
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -0,4 +1,16 @@ | ||
import { type WorkspaceCatalog, type WorkspaceNamedCatalogs } from './catalogs'; | ||
export interface WorkspaceManifest { | ||
packages: string[]; | ||
/** | ||
* The default catalog. Package manifests may refer to dependencies in this | ||
* definition through the `catalog:default` specifier or the `catalog:` | ||
* shorthand. | ||
*/ | ||
catalog?: WorkspaceCatalog; | ||
/** | ||
* A dictionary of named catalogs. Package manifests may refer to dependencies | ||
* in this definition through the `catalog:<name>` specifier. | ||
*/ | ||
catalogs?: WorkspaceNamedCatalogs; | ||
} | ||
export declare function readWorkspaceManifest(dir: string): Promise<WorkspaceManifest | undefined>; |
@@ -9,5 +9,6 @@ "use strict"; | ||
const constants_1 = require("@pnpm/constants"); | ||
const error_1 = require("@pnpm/error"); | ||
const node_path_1 = __importDefault(require("node:path")); | ||
const read_yaml_file_1 = __importDefault(require("read-yaml-file")); | ||
const catalogs_1 = require("./catalogs"); | ||
const InvalidWorkspaceManifestError_1 = require("./errors/InvalidWorkspaceManifestError"); | ||
async function readWorkspaceManifest(dir) { | ||
@@ -38,6 +39,6 @@ const manifest = await readManifestRaw(dir); | ||
if (typeof manifest !== 'object') { | ||
throw new InvalidWorkspaceManifestError(`Expected object but found - ${typeof manifest}`); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError(`Expected object but found - ${typeof manifest}`); | ||
} | ||
if (Array.isArray(manifest)) { | ||
throw new InvalidWorkspaceManifestError('Expected object but found - array'); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError('Expected object but found - array'); | ||
} | ||
@@ -49,2 +50,4 @@ if (Object.keys(manifest).length === 0) { | ||
assertValidWorkspaceManifestPackages(manifest); | ||
(0, catalogs_1.assertValidWorkspaceManifestCatalog)(manifest); | ||
(0, catalogs_1.assertValidWorkspaceManifestCatalogs)(manifest); | ||
checkWorkspaceManifestAssignability(manifest); | ||
@@ -54,14 +57,14 @@ } | ||
if (!manifest.packages) { | ||
throw new InvalidWorkspaceManifestError('packages field missing or empty'); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError('packages field missing or empty'); | ||
} | ||
if (!Array.isArray(manifest.packages)) { | ||
throw new InvalidWorkspaceManifestError('packages field is not an array'); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError('packages field is not an array'); | ||
} | ||
for (const pkg of manifest.packages) { | ||
if (!pkg) { | ||
throw new InvalidWorkspaceManifestError('Missing or empty package'); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError('Missing or empty package'); | ||
} | ||
const type = typeof pkg; | ||
if (type !== 'string') { | ||
throw new InvalidWorkspaceManifestError(`Invalid package type - ${type}`); | ||
throw new InvalidWorkspaceManifestError_1.InvalidWorkspaceManifestError(`Invalid package type - ${type}`); | ||
} | ||
@@ -77,7 +80,2 @@ } | ||
function checkWorkspaceManifestAssignability(_manifest) { } | ||
class InvalidWorkspaceManifestError extends error_1.PnpmError { | ||
constructor(message) { | ||
super('INVALID_WORKSPACE_CONFIGURATION', message); | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@pnpm/workspace.read-manifest", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Reads a workspace manifest file", | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@pnpm/workspace.read-manifest": "2.1.0" | ||
"@pnpm/workspace.read-manifest": "2.2.0" | ||
}, | ||
@@ -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
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
14040
12
169