sumlyzer 0.1.0 → 0.1.1

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/bin/sumlyzer.mjs CHANGED
@@ -15,8 +15,8 @@ try {
15
15
  }));
16
16
  }
17
17
  catch (error) {
18
- if (error.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
19
- console.error(`${error.message}. Run "sumlyzer --help" for usage.`);
18
+ if (error.code?.startsWith("ERR_PARSE_ARGS")) {
19
+ console.info(`${error.message}. Run "sumlyzer --help" for usage.`);
20
20
  }
21
21
  process.exit(1);
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumlyzer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Run every npm workspace's test script, only show output for the ones that fail, and finish with an aggregated pass/fail summary.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -38,5 +38,8 @@
38
38
  "bugs": {
39
39
  "url": "https://github.com/ErwanRaulo/sumlyzer/issues"
40
40
  },
41
- "homepage": "https://github.com/ErwanRaulo/sumlyzer#readme"
41
+ "homepage": "https://github.com/ErwanRaulo/sumlyzer#readme",
42
+ "devDependencies": {
43
+ "@types/node": "^26.1.1"
44
+ }
42
45
  }
package/src/run.mjs CHANGED
@@ -28,10 +28,8 @@ export function workspaceName(wsPath) {
28
28
  return (wsPath ?? "").replace(/^workspaces[\\/]/, "");
29
29
  }
30
30
 
31
- function listWorkspaces(root, scriptName) {
32
- const rootPkg = readJson(path.join(root, "package.json"));
33
-
34
- return (rootPkg.workspaces ?? []).filter((wsPath) => {
31
+ function listEligibleWorkspaces(root, workspaces, scriptName) {
32
+ return workspaces.filter((wsPath) => {
35
33
  const pkgFile = path.join(root, wsPath, "package.json");
36
34
  try {
37
35
  return Boolean(readJson(pkgFile).scripts?.[scriptName]);
@@ -132,10 +130,18 @@ function summaryRow(workspace, status, duration, counts) {
132
130
  }
133
131
 
134
132
  export async function main({ root, scriptName, ff }) {
135
- const workspaces = listWorkspaces(root, scriptName);
133
+
134
+ const { workspaces } = readJson(path.join(root, "package.json"));
135
+
136
+ if (!workspaces || workspaces.length === 0) {
137
+ console.info("Your project does not have any workspaces.");
138
+ process.exit(1);
139
+ }
140
+
141
+ const workspacesToRun = listEligibleWorkspaces(root, workspaces, scriptName);
136
142
  const results = [];
137
143
 
138
- for (const wsPath of workspaces) {
144
+ for (const wsPath of workspacesToRun) {
139
145
  const name = workspaceName(wsPath);
140
146
  process.stdout.write(dim(`running ${name}\n`));
141
147
 
@@ -167,7 +173,7 @@ export async function main({ root, scriptName, ff }) {
167
173
  }
168
174
 
169
175
  const failed = results.filter((result) => result.exitCode !== 0);
170
- const skipped = workspaces.slice(results.length);
176
+ const skipped = workspacesToRun.slice(results.length);
171
177
 
172
178
  console.log(bold("\nSummary"));
173
179
  console.table([