Skip to content

Commit beeb2fc

Browse files
committed
Fix add a changeset link for single-package repos
1 parent e8b0703 commit beeb2fc

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

get-changed-packages.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,28 +150,24 @@ export let getChangedPackages = async ({
150150
}
151151
}
152152

153-
if (
154-
!tool ||
155-
!(
156-
Array.isArray(tool.globs) &&
157-
tool.globs.every((x) => typeof x === "string")
158-
)
159-
) {
160-
throw new Error("globs are not valid");
161-
}
162-
163153
let rootPackageJsonContent = await rootPackageJsonContentsPromise;
164154

165155
let packages: Packages = {
166156
root: {
167157
dir: "/",
168158
packageJson: rootPackageJsonContent,
169159
},
170-
tool: tool.tool,
160+
tool: tool ? tool.tool : "root",
171161
packages: [],
172162
};
173163

174164
if (tool) {
165+
if (
166+
!Array.isArray(tool.globs) ||
167+
!tool.globs.every((x) => typeof x === "string")
168+
) {
169+
throw new Error("globs are not valid: " + JSON.stringify(tool.globs));
170+
}
175171
let matches = micromatch(potentialWorkspaceDirectories, tool.globs);
176172

177173
packages.packages = await Promise.all(
@@ -181,7 +177,7 @@ export let getChangedPackages = async ({
181177
packages.packages.push(packages.root);
182178
}
183179
if (hasErrored) {
184-
throw new Error("an error occurred");
180+
throw new Error("an error occurred when fetching files");
185181
}
186182

187183
const releasePlan = assembleReleasePlan(

0 commit comments

Comments
 (0)