Skip to content

Commit f9f3d71

Browse files
committed
fix build
1 parent 67c793a commit f9f3d71

8 files changed

Lines changed: 36 additions & 18 deletions

File tree

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clux",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"private": true,
55
"license": "MIT",
66
"description": "Clux — tmux session multiplexer with web dashboard and CLI.",
@@ -10,7 +10,7 @@
1010
"packages/web"
1111
],
1212
"scripts": {
13-
"build": "npm run build:core && npm run build:cli && npm run build:web",
13+
"build": "npm run build:core && npm run build:web && npm run build:cli",
1414
"build:core": "npm run build -w packages/core",
1515
"build:cli": "npm run build -w packages/cli",
1616
"build:web": "npm run build -w packages/web",

packages/cli/esbuild.mjs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
import * as esbuild from 'esbuild';
22
import path from 'path';
3+
import fs from 'fs';
34
import { fileURLToPath } from 'url';
45

56
const __dirname = path.dirname(fileURLToPath(import.meta.url));
67

8+
const workspaceResolve = {
9+
name: 'workspace-resolve',
10+
setup(build) {
11+
build.onResolve({ filter: /^@clux-cli\// }, (args) => {
12+
if (args.path === '@clux-cli/core') {
13+
return { path: path.resolve(__dirname, '../core/dist/index.js') };
14+
}
15+
if (
16+
args.path === '@clux-cli/web' ||
17+
args.path === '@clux-cli/web/dist/server'
18+
) {
19+
return { path: path.resolve(__dirname, '../web/dist/server.js') };
20+
}
21+
});
22+
},
23+
};
24+
725
await esbuild.build({
826
entryPoints: [path.join(__dirname, 'dist/index.js')],
927
bundle: true,
@@ -12,9 +30,10 @@ await esbuild.build({
1230
outfile: path.join(__dirname, 'dist/index.js'),
1331
allowOverwrite: true,
1432
external: ['better-sqlite3'],
15-
alias: {
16-
'@clux-cli/core': path.join(__dirname, '..', 'core', 'dist', 'index.js'),
17-
'@clux-cli/web/dist/server': path.join(__dirname, '..', 'web', 'dist', 'server.js'),
18-
'@clux-cli/web': path.join(__dirname, '..', 'web', 'dist', 'server.js'),
19-
},
33+
plugins: [workspaceResolve],
2034
});
35+
36+
// Copy web public assets into CLI dist so they're available at runtime
37+
const srcPublic = path.resolve(__dirname, '../web/dist/public');
38+
const destPublic = path.resolve(__dirname, 'dist/public');
39+
fs.cpSync(srcPublic, destPublic, { recursive: true });

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clux-cli/cli",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"license": "MIT",
55
"main": "dist/index.js",
66
"bin": {

packages/cli/src/commands/web.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function registerWebCommand(program: Command, _manager: TmuxSessionManage
1010
.action((opts) => {
1111
process.env.PORT = opts.port;
1212
process.env.HOST = opts.host;
13-
// eslint-disable-next-line @typescript-eslint/no-require-imports
1413
require('@clux-cli/web/dist/server');
1514
});
1615
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clux-cli/core",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"private": true,
55
"license": "MIT",
66
"main": "dist/index.js",

packages/web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clux-cli/web",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"private": true,
55
"license": "MIT",
66
"main": "dist/server.js",
@@ -11,7 +11,7 @@
1111
"directory": "packages/web"
1212
},
1313
"scripts": {
14-
"build": "tsc",
14+
"build": "tsc && cp -r public dist/public",
1515
"dev": "node dist/server.js",
1616
"watch": "tsc --watch"
1717
},

packages/web/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const PORT = parseInt(process.env.PORT || '3456');
1414
const HOST = process.env.HOST || '127.0.0.1';
1515

1616
app.use(express.json());
17-
app.use(express.static(path.join(__dirname, '..', 'public')));
17+
app.use(express.static(path.join(__dirname, 'public')));
1818

1919
app.use(createSessionRoutes(manager));
2020
app.use(createSettingsRoutes({ host: HOST, port: PORT }));

0 commit comments

Comments
 (0)