Skip to content

Commit a4604dc

Browse files
committed
Fix for entry point detection on windows
1 parent 253d961 commit a4604dc

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

packages/cli-v3/src/build/packageModules.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
import { BuildTarget } from "@trigger.dev/core/v3";
12
import { join } from "node:path";
23
import { sourceDir } from "../sourceDir.js";
3-
import { BuildTarget } from "@trigger.dev/core/v3";
4-
import { logger } from "../utilities/logger.js";
54

65
export const devRunWorker = join(sourceDir, "entryPoints", "dev-run-worker.js");
76
export const devIndexWorker = join(sourceDir, "entryPoints", "dev-index-worker.js");
@@ -26,54 +25,58 @@ export const esmShimPath = join(sourceDir, "shims", "esm.js");
2625

2726
export const shims = [esmShimPath];
2827

28+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
2929
function isDevRunWorker(entryPoint: string) {
3030
return (
31-
entryPoint.includes(join("dist", "esm", "entryPoints", "dev-run-worker.js")) ||
32-
entryPoint.includes(join("src", "entryPoints", "dev-run-worker.ts"))
31+
entryPoint.includes("dist/esm/entryPoints/dev-run-worker.js") ||
32+
entryPoint.includes("src/entryPoints/dev-run-worker.ts")
3333
);
3434
}
3535

36+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
3637
function isDevIndexWorker(entryPoint: string) {
3738
return (
38-
entryPoint.includes(join("dist", "esm", "entryPoints", "dev-index-worker.js")) ||
39-
entryPoint.includes(join("src", "entryPoints", "dev-index-worker.ts"))
39+
entryPoint.includes("dist/esm/entryPoints/dev-index-worker.js") ||
40+
entryPoint.includes("src/entryPoints/dev-index-worker.ts")
4041
);
4142
}
4243

44+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
4345
function isDeployIndexController(entryPoint: string) {
4446
return (
45-
entryPoint.includes(join("dist", "esm", "entryPoints", "deploy-index-controller.js")) ||
46-
entryPoint.includes(join("src", "entryPoints", "deploy-index-controller.ts"))
47+
entryPoint.includes("dist/esm/entryPoints/deploy-index-controller.js") ||
48+
entryPoint.includes("src/entryPoints/deploy-index-controller.ts")
4749
);
4850
}
4951

52+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
5053
function isDeployIndexWorker(entryPoint: string) {
5154
return (
52-
entryPoint.includes(join("dist", "esm", "entryPoints", "deploy-index-worker.js")) ||
53-
entryPoint.includes(join("src", "entryPoints", "deploy-index-worker.ts"))
55+
entryPoint.includes("dist/esm/entryPoints/deploy-index-worker.js") ||
56+
entryPoint.includes("src/entryPoints/deploy-index-worker.ts")
5457
);
5558
}
5659

5760
function isDeployRunController(entryPoint: string) {
5861
return (
59-
entryPoint.includes(join("dist", "esm", "entryPoints", "deploy-run-controller.js")) ||
60-
entryPoint.includes(join("src", "entryPoints", "deploy-run-controller.ts"))
62+
entryPoint.includes("dist/esm/entryPoints/deploy-run-controller.js") ||
63+
entryPoint.includes("src/entryPoints/deploy-run-controller.ts")
6164
);
6265
}
6366

67+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
6468
function isDeployRunWorker(entryPoint: string) {
6569
return (
66-
entryPoint.includes(join("dist", "esm", "entryPoints", "deploy-run-worker.js")) ||
67-
entryPoint.includes(join("src", "entryPoints", "deploy-run-worker.ts"))
70+
entryPoint.includes("dist/esm/entryPoints/deploy-run-worker.js") ||
71+
entryPoint.includes("src/entryPoints/deploy-run-worker.ts")
6872
);
6973
}
7074

75+
// IMPORTANT: this may look like it should not work on Windows, but it does (and changing to using path.join will break stuff)
7176
export function isLoaderEntryPoint(entryPoint: string) {
72-
logger.debug("isLoaderEntryPoint", entryPoint, join("src", "entryPoints", "loader.ts"));
73-
7477
return (
75-
entryPoint.includes(join("dist", "esm", "entryPoints", "loader.js")) ||
76-
entryPoint.includes(join("src", "entryPoints", "loader.ts"))
78+
entryPoint.includes("dist/esm/entryPoints/loader.js") ||
79+
entryPoint.includes("src/entryPoints/loader.ts")
7780
);
7881
}
7982

0 commit comments

Comments
 (0)