Skip to content

Commit 734ebc3

Browse files
committed
warn during dev if imports take more than 1s
1 parent ec6c4db commit 734ebc3

File tree

3 files changed

+636
-1
lines changed

3 files changed

+636
-1
lines changed

packages/cli-v3/src/commands/dev.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ResolvedConfig } from "@trigger.dev/core/v3/build";
2-
import { Command } from "commander";
2+
import { Command, Option as CommandOption } from "commander";
33
import { z } from "zod";
44
import { CommonCommandOptions, commonOptions, wrapCommandAction } from "../cli/common.js";
55
import { watchConfig } from "../config.js";
@@ -24,6 +24,8 @@ const DevCommandOptions = CommonCommandOptions.extend({
2424
maxConcurrentRuns: z.coerce.number().optional(),
2525
mcp: z.boolean().default(false),
2626
mcpPort: z.coerce.number().optional().default(3333),
27+
analyze: z.boolean().default(false),
28+
disableWarnings: z.boolean().default(false),
2729
});
2830

2931
export type DevCommandOptions = z.infer<typeof DevCommandOptions>;
@@ -54,6 +56,10 @@ export function configureDevCommand(program: Command) {
5456
)
5557
.option("--mcp", "Start the MCP server")
5658
.option("--mcp-port", "The port to run the MCP server on", "3333")
59+
.addOption(
60+
new CommandOption("--analyze", "Analyze the build output and import timings").hideHelp()
61+
)
62+
.addOption(new CommandOption("--disable-warnings", "Suppress warnings output").hideHelp())
5763
).action(async (options) => {
5864
wrapCommandAction("dev", DevCommandOptions, options, async (opts) => {
5965
await devCommand(opts);

packages/cli-v3/src/dev/devOutput.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { eventBus, EventBusEventArgs } from "../utilities/eventBus.js";
2626
import { logger } from "../utilities/logger.js";
2727
import { Socket } from "socket.io-client";
2828
import { BundleError } from "../build/bundle.js";
29+
import { analyzeWorker } from "../utilities/analyze.js";
2930

3031
export type DevOutputOptions = {
3132
name: string | undefined;
@@ -71,6 +72,8 @@ export function startDevOutput(options: DevOutputOptions) {
7172
const backgroundWorkerInitialized = (
7273
...[worker]: EventBusEventArgs<"backgroundWorkerInitialized">
7374
) => {
75+
analyzeWorker(worker, options.args.analyze, options.args.disableWarnings);
76+
7477
const logParts: string[] = [];
7578

7679
const testUrl = `${dashboardUrl}/projects/v3/${config.project}/test?environment=dev`;

0 commit comments

Comments
 (0)