workspace-utils 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 pnpmono
3
+ Copyright (c) 2024 wsu
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.js CHANGED
@@ -15219,6 +15219,24 @@ Failed packages:`));
15219
15219
 
15220
15220
  // src/commands/build.ts
15221
15221
  var import_picocolors4 = __toESM(require_picocolors(), 1);
15222
+ function collectPackagesWithDependencies(packages, packageMap) {
15223
+ const queue = [...packages];
15224
+ const collected = new Map;
15225
+ while (queue.length > 0) {
15226
+ const pkg = queue.shift();
15227
+ if (!pkg || collected.has(pkg.name))
15228
+ continue;
15229
+ collected.set(pkg.name, pkg);
15230
+ const dependencies = [...pkg.dependencies, ...pkg.devDependencies];
15231
+ for (const depName of dependencies) {
15232
+ const depPackage = packageMap.get(depName);
15233
+ if (depPackage && !collected.has(depName)) {
15234
+ queue.push(depPackage);
15235
+ }
15236
+ }
15237
+ }
15238
+ return Array.from(collected.values());
15239
+ }
15222
15240
  async function buildCommand(options) {
15223
15241
  try {
15224
15242
  Output.build(`Building packages in dependency order...
@@ -15233,18 +15251,24 @@ async function buildCommand(options) {
15233
15251
  targetPackages = parser2.filterPackages(workspace.packages, options.filter);
15234
15252
  Output.log(`Filtered to ${targetPackages.length} packages matching "${options.filter}"`, "magnifying", "yellow");
15235
15253
  }
15236
- const { valid: packagesWithBuild, invalid: packagesWithoutBuild } = validatePackagesHaveScript(targetPackages, "build");
15237
- if (packagesWithoutBuild.length > 0) {
15254
+ const { valid: buildableTargets, invalid: targetPackagesWithoutBuild } = validatePackagesHaveScript(targetPackages, "build");
15255
+ if (buildableTargets.length === 0) {
15256
+ Output.error('No packages found with a "build" script.');
15257
+ process.exit(1);
15258
+ }
15259
+ const packagesWithDependencies = collectPackagesWithDependencies(buildableTargets, workspace.packageMap);
15260
+ const { valid: packagesWithBuild, invalid: packagesWithoutBuild } = validatePackagesHaveScript(packagesWithDependencies, "build");
15261
+ const missingBuildScriptPackages = new Map;
15262
+ [...targetPackagesWithoutBuild, ...packagesWithoutBuild].forEach((pkg) => {
15263
+ missingBuildScriptPackages.set(pkg.name, pkg);
15264
+ });
15265
+ if (missingBuildScriptPackages.size > 0) {
15238
15266
  Output.warning(`The following packages don't have a "build" script:`);
15239
- packagesWithoutBuild.forEach((pkg) => {
15267
+ Array.from(missingBuildScriptPackages.values()).forEach((pkg) => {
15240
15268
  Output.listItem(pkg.name);
15241
15269
  });
15242
15270
  console.log();
15243
15271
  }
15244
- if (packagesWithBuild.length === 0) {
15245
- Output.error('No packages found with a "build" script.');
15246
- process.exit(1);
15247
- }
15248
15272
  Output.log("Building dependency graph...", "chart", "blue");
15249
15273
  const dependencyGraph = buildDependencyGraph(packagesWithBuild);
15250
15274
  const packageNames = packagesWithBuild.map((pkg) => pkg.name);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-utils",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A CLI tool to orchestrate scripts across monorepo workspaces (Bun, pnpm, npm) with parallel execution and dependency-aware builds.",
5
5
  "module": "index.ts",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspace-utils",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A CLI tool to orchestrate scripts across monorepo workspaces (Bun, pnpm, npm) with parallel execution and dependency-aware builds.",
5
5
  "module": "index.ts",
6
6
  "type": "module",