Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(turbo-ignore): don’t fail on single package repos #8177

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/turbo-ignore/__tests__/ignore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,4 +677,26 @@ describe("turboIgnore()", () => {

mockExec.mockRestore();
});

it("allows build if packages is missing", () => {
const mockExec = jest
.spyOn(child_process, "exec")
.mockImplementation((command, options, callback) => {
if (callback) {
return callback(
null,
'{"tasks":[]}',
"stderr"
) as unknown as ChildProcess;
}
return {} as unknown as ChildProcess;
});

turboIgnore(undefined, {
directory: "__fixtures__/app",
});

expectBuild(mockExit);
mockExec.mockRestore();
});
});
5 changes: 5 additions & 0 deletions packages/turbo-ignore/src/ignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ export function turboIgnore(
return continueBuild();
}
const { packages } = parsed;
if (!packages) {
info(`Detected single package repo`);
return continueBuild();
}

if (packages.length > 0) {
if (packages.length === 1) {
info(`This commit affects "${workspace}"`);
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo-types/src/types/dry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface DryRun {
version: string;
turboVersion: string;
monorepo: boolean;
packages: Array<string>;
packages?: Array<string>;
frameworkInference: boolean;
}
Loading