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

Function main

scripts/publish-packages.ts:361–392  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

359};
360
361const main = async () => {
362 const { dryRun, prepareOnly } = parseArgs(process.argv.slice(2));
363
364 // Each package's own version determines its dist-tag (pre-release versions
365 // with `-` publish to `beta`, everything else to `latest`). Packages are
366 // only skipped when their current version is already on npm.
367 const mode = prepareOnly ? " [prepare-only]" : dryRun ? " [dry-run]" : "";
368 console.log(`Publishing ${PACKAGE_SCOPE} packages${mode}`);
369
370 await $`bun run build:packages`.cwd(repoRoot);
371
372 // Snapshot the public package names and versions up front so public
373 // workspace dependencies can be written as exact versions in packed tarballs.
374 const publishable = new Set<string>();
375 const publishableVersions = new Map<string, string>();
376 for (const relDir of PUBLIC_PACKAGE_DIRS) {
377 const pkg = await readPackageMeta(join(repoRoot, relDir));
378 publishable.add(pkg.name);
379 publishableVersions.set(pkg.name, pkg.version);
380 }
381
382 if (prepareOnly) {
383 for (const relDir of PUBLIC_PACKAGE_DIRS) {
384 await prepareOnePackage(join(repoRoot, relDir), publishable, publishableVersions);
385 }
386 return;
387 }
388
389 for (const relDir of PUBLIC_PACKAGE_DIRS) {
390 await publishPackage(join(repoRoot, relDir), dryRun, publishable, publishableVersions);
391 }
392};
393
394await main();

Callers 1

Calls 6

readPackageMetaFunction · 0.85
prepareOnePackageFunction · 0.85
publishPackageFunction · 0.85
logMethod · 0.80
setMethod · 0.80
parseArgsFunction · 0.70

Tested by

no test coverage detected