MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / readPackageMeta

Function readPackageMeta

scripts/publish-packages.ts:65–81  ·  view source on GitHub ↗
(pkgDir: string)

Source from the content-addressed store, hash-verified

63const resolveChannel = (version: string): Channel => (version.includes("-") ? "beta" : "latest");
64
65const readPackageMeta = async (pkgDir: string) => {
66 const pkgJsonPath = join(pkgDir, "package.json");
67 const pkg = (await Bun.file(pkgJsonPath).json()) as {
68 name?: string;
69 version?: string;
70 private?: boolean;
71 };
72
73 if (!pkg.name || !pkg.version) {
74 throw new Error(`Missing name/version in ${pkgJsonPath}`);
75 }
76 if (pkg.private === true) {
77 throw new Error(`${pkg.name} is marked private and cannot be published`);
78 }
79
80 return { name: pkg.name, version: pkg.version };
81};
82
83const packageAlreadyPublished = async (name: string, version: string): Promise<boolean> => {
84 const proc = Bun.spawn(["npm", "view", `${name}@${version}`, "version"], {

Callers 3

publishPackageFunction · 0.85
prepareOnePackageFunction · 0.85
mainFunction · 0.85

Calls 1

jsonMethod · 0.65

Tested by

no test coverage detected