mazey
    Preparing search index...

    Function derivePackageMetadata

    • Validate basic package identity and derive reusable package metadata.

      The helper removes an npm scope for bundle naming, converts that unscoped name with toJavaScriptGlobalName, normalizes the supported author fields, and creates an install command for npm, pnpm, or Yarn.

      Usage:

      import { derivePackageMetadata } from "mazey";

      const metadata = derivePackageMetadata(
      {
      name: "@example/my-library",
      version: "1.0.0",
      author: { name: "Example Maintainer" },
      },
      { packageManager: "pnpm" }
      );
      console.log(metadata);

      Output:

      {
        name: "@example/my-library",
        version: "1.0.0",
        description: undefined,
        license: undefined,
        author: { name: "Example Maintainer" },
        unscopedName: "my-library",
        iifeGlobal: "MY_LIBRARY",
        installCommand: "pnpm add @example/my-library"
      }
      

      Parameters

      Returns DerivedPackageMetadata

      Normalized identity, bundle naming, and installation metadata.

      If the manifest, package name, author, optional string fields, or package-manager option is invalid.

      The input manifest and nested author object are not mutated. This helper does not read files, environment variables, or package-manager configuration.