libraryName

tcmts.cli.libraries.libraryName · #b7jag4cm · term · runs anywhere

What a library is called unless it's said: its package's name, without its scope or version, as a name can be (@alice/geo-tools@1.2.0: geo_tools).

export function libraryName(release: string): string {
  const at = release.lastIndexOf("@");
  const pkg = at > 0 ? release.slice(0, at) : release;
  return pkg
    .replace(/^@[^/]*\//, "")
    .replace(/[^\w$]/g, "_")
    .replace(/^(\d)/, "_$1");
}

used by