mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-09 05:19:32 +08:00
fix: Also build entry.ts into dist/entry.mjs.
This commit is contained in:
@@ -11,4 +11,4 @@ if (module.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
|
||||
}
|
||||
}
|
||||
|
||||
await import("./dist/entry.js");
|
||||
await import("./dist/entry.mjs");
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
"docs:bin": "node scripts/build-docs-list.mjs",
|
||||
"docs:dev": "cd docs && mint dev",
|
||||
"docs:build": "cd docs && pnpm dlx --reporter append-only mint broken-links",
|
||||
"build": "pnpm canvas:a2ui:bundle && tsdown && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/write-build-info.ts",
|
||||
"build": "pnpm canvas:a2ui:bundle && tsdown src/index.ts src/entry.ts && node --import tsx scripts/canvas-a2ui-copy.ts && node --import tsx scripts/copy-hook-metadata.ts && node --import tsx scripts/write-build-info.ts",
|
||||
"plugins:sync": "node --import tsx scripts/sync-plugin-versions.ts",
|
||||
"release:check": "node --import tsx scripts/release-check.ts",
|
||||
"ui:install": "node scripts/ui.js install",
|
||||
|
||||
@@ -254,7 +254,7 @@ vi.mock("../daemon/service.js", () => ({
|
||||
isLoaded: async () => true,
|
||||
readRuntime: async () => ({ status: "running", pid: 1234 }),
|
||||
readCommand: async () => ({
|
||||
programArguments: ["node", "dist/entry.js", "gateway"],
|
||||
programArguments: ["node", "dist/entry.mjs", "gateway"],
|
||||
sourcePath: "/tmp/Library/LaunchAgents/bot.molt.gateway.plist",
|
||||
}),
|
||||
}),
|
||||
@@ -267,7 +267,7 @@ vi.mock("../daemon/node-service.js", () => ({
|
||||
isLoaded: async () => true,
|
||||
readRuntime: async () => ({ status: "running", pid: 4321 }),
|
||||
readCommand: async () => ({
|
||||
programArguments: ["node", "dist/entry.js", "node-host"],
|
||||
programArguments: ["node", "dist/entry.mjs", "node-host"],
|
||||
sourcePath: "/tmp/Library/LaunchAgents/bot.molt.node.plist",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -24,7 +24,7 @@ afterEach(() => {
|
||||
describe("resolveGatewayProgramArguments", () => {
|
||||
it("uses realpath-resolved dist entry when running via npx shim", async () => {
|
||||
const argv1 = path.resolve("/tmp/.npm/_npx/63c3/node_modules/.bin/openclaw");
|
||||
const entryPath = path.resolve("/tmp/.npm/_npx/63c3/node_modules/openclaw/dist/entry.js");
|
||||
const entryPath = path.resolve("/tmp/.npm/_npx/63c3/node_modules/openclaw/dist/entry.mjs");
|
||||
process.argv = ["node", argv1];
|
||||
fsMocks.realpath.mockResolvedValue(entryPath);
|
||||
fsMocks.access.mockImplementation(async (target: string) => {
|
||||
@@ -49,10 +49,10 @@ describe("resolveGatewayProgramArguments", () => {
|
||||
// Simulates pnpm global install where node_modules/openclaw is a symlink
|
||||
// to .pnpm/openclaw@X.Y.Z/node_modules/openclaw
|
||||
const symlinkPath = path.resolve(
|
||||
"/Users/test/Library/pnpm/global/5/node_modules/openclaw/dist/entry.js",
|
||||
"/Users/test/Library/pnpm/global/5/node_modules/openclaw/dist/entry.mjs",
|
||||
);
|
||||
const realpathResolved = path.resolve(
|
||||
"/Users/test/Library/pnpm/global/5/node_modules/.pnpm/openclaw@2026.1.21-2/node_modules/openclaw/dist/entry.js",
|
||||
"/Users/test/Library/pnpm/global/5/node_modules/.pnpm/openclaw@2026.1.21-2/node_modules/openclaw/dist/entry.mjs",
|
||||
);
|
||||
process.argv = ["node", symlinkPath];
|
||||
fsMocks.realpath.mockResolvedValue(realpathResolved);
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function resolveControlUiDistIndexPath(
|
||||
}
|
||||
const normalized = path.resolve(argv1);
|
||||
|
||||
// Case 1: entrypoint is directly inside dist/ (e.g., dist/entry.js)
|
||||
// Case 1: entrypoint is directly inside dist/ (e.g., dist/entry.mjs)
|
||||
const distDir = path.dirname(normalized);
|
||||
if (path.basename(distDir) === "dist") {
|
||||
return path.join(distDir, "control-ui", "index.html");
|
||||
|
||||
@@ -74,10 +74,8 @@ function isGatewayArgv(args: string[]): boolean {
|
||||
|
||||
const entryCandidates = [
|
||||
"dist/index.mjs",
|
||||
"dist/index.mjs",
|
||||
"dist/entry.js",
|
||||
"openclaw.mjs",
|
||||
"dist/entry.mjs",
|
||||
"openclaw.mjs",
|
||||
"scripts/run-node.mjs",
|
||||
"src/index.ts",
|
||||
];
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("ports helpers", () => {
|
||||
expect(
|
||||
classifyPortListener(
|
||||
{
|
||||
commandLine: "node /Users/me/Projects/openclaw/dist/entry.js gateway",
|
||||
commandLine: "node /Users/me/Projects/openclaw/dist/entry.mjs gateway",
|
||||
},
|
||||
18789,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user