@launchframe/cli 1.0.0-beta.29 → 1.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/dev-queue.js +85 -0
- package/src/commands/help.js +2 -1
- package/src/index.js +4 -0
package/package.json
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { spawnSync, spawn } = require('child_process');
|
|
5
|
+
const { requireProject } = require('../utils/project-helpers');
|
|
6
|
+
|
|
7
|
+
async function devQueue() {
|
|
8
|
+
requireProject();
|
|
9
|
+
|
|
10
|
+
const infrastructurePath = path.join(process.cwd(), 'infrastructure');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(infrastructurePath)) {
|
|
13
|
+
console.error(chalk.red('\n❌ Error: infrastructure/ directory not found'));
|
|
14
|
+
console.log(chalk.gray('Make sure you are in the root of your LaunchFrame project.\n'));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Check backend container is running
|
|
19
|
+
const psResult = spawnSync(
|
|
20
|
+
'docker',
|
|
21
|
+
[
|
|
22
|
+
'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.dev.yml',
|
|
23
|
+
'ps', '--status', 'running', '-q', 'backend'
|
|
24
|
+
],
|
|
25
|
+
{ cwd: infrastructurePath, encoding: 'utf8' }
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (!psResult.stdout || psResult.stdout.trim() === '') {
|
|
29
|
+
console.error(chalk.red('\n❌ Backend container is not running.'));
|
|
30
|
+
console.log(chalk.gray('Start local services first:'));
|
|
31
|
+
console.log(chalk.white(' launchframe docker:up\n'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Read BULL_ADMIN_TOKEN from backend container
|
|
36
|
+
const tokenResult = spawnSync(
|
|
37
|
+
'docker',
|
|
38
|
+
[
|
|
39
|
+
'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.dev.yml',
|
|
40
|
+
'exec', '-T', 'backend', 'sh', '-c', 'echo $BULL_ADMIN_TOKEN'
|
|
41
|
+
],
|
|
42
|
+
{ cwd: infrastructurePath, encoding: 'utf8' }
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const token = (tokenResult.stdout || '').trim();
|
|
46
|
+
|
|
47
|
+
if (!token) {
|
|
48
|
+
console.error(chalk.red('\n❌ Could not read BULL_ADMIN_TOKEN from backend container.'));
|
|
49
|
+
console.log(chalk.gray('Make sure the backend is fully started and BULL_ADMIN_TOKEN is set in your .env\n'));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Read BACKEND_PORT from backend container (fallback to 4000)
|
|
54
|
+
const portResult = spawnSync(
|
|
55
|
+
'docker',
|
|
56
|
+
[
|
|
57
|
+
'compose', '-f', 'docker-compose.yml', '-f', 'docker-compose.dev.yml',
|
|
58
|
+
'exec', '-T', 'backend', 'sh', '-c', 'echo $BACKEND_PORT'
|
|
59
|
+
],
|
|
60
|
+
{ cwd: infrastructurePath, encoding: 'utf8' }
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const port = (portResult.stdout || '').trim() || '4000';
|
|
64
|
+
|
|
65
|
+
const url = `http://localhost:${port}/admin/queues/${token}`;
|
|
66
|
+
|
|
67
|
+
console.log(chalk.green('\n Opening Bull queue dashboard...'));
|
|
68
|
+
console.log(chalk.gray(` ${url}\n`));
|
|
69
|
+
|
|
70
|
+
// Open URL with platform-appropriate command
|
|
71
|
+
const platform = process.platform;
|
|
72
|
+
let openCmd;
|
|
73
|
+
if (platform === 'darwin') {
|
|
74
|
+
openCmd = 'open';
|
|
75
|
+
} else if (platform === 'win32') {
|
|
76
|
+
openCmd = 'start';
|
|
77
|
+
} else {
|
|
78
|
+
openCmd = 'xdg-open';
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const child = spawn(openCmd, [url], { detached: true, stdio: 'ignore' });
|
|
82
|
+
child.unref();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = { devQueue };
|
package/src/commands/help.js
CHANGED
|
@@ -56,7 +56,8 @@ function help() {
|
|
|
56
56
|
console.log(chalk.gray(' cache:update Force update cache to latest version'));
|
|
57
57
|
console.log(chalk.gray(' cache:clear Delete cache (re-download on next use)\n'));
|
|
58
58
|
console.log(chalk.white('Dev Helpers:'));
|
|
59
|
-
console.log(chalk.gray(' dev:add-user Generate and insert a random test user into the local database
|
|
59
|
+
console.log(chalk.gray(' dev:add-user Generate and insert a random test user into the local database'));
|
|
60
|
+
console.log(chalk.gray(' dev:queue Open the Bull queue dashboard in the browser\n'));
|
|
60
61
|
console.log(chalk.white('Other commands:'));
|
|
61
62
|
console.log(chalk.gray(' doctor Check project health and configuration'));
|
|
62
63
|
console.log(chalk.gray(' telemetry Show telemetry status'));
|
package/src/index.js
CHANGED
|
@@ -43,6 +43,7 @@ const {
|
|
|
43
43
|
} = require('./commands/service');
|
|
44
44
|
const { cacheClear, cacheInfo, cacheUpdate } = require('./commands/cache');
|
|
45
45
|
const { devAddUser } = require('./commands/dev-add-user');
|
|
46
|
+
const { devQueue } = require('./commands/dev-queue');
|
|
46
47
|
|
|
47
48
|
// Get command and arguments
|
|
48
49
|
const command = process.argv[2];
|
|
@@ -199,6 +200,9 @@ async function main() {
|
|
|
199
200
|
case 'dev:add-user':
|
|
200
201
|
await devAddUser();
|
|
201
202
|
break;
|
|
203
|
+
case 'dev:queue':
|
|
204
|
+
await devQueue();
|
|
205
|
+
break;
|
|
202
206
|
case 'telemetry':
|
|
203
207
|
if (flags.disable) {
|
|
204
208
|
setTelemetryEnabled(false);
|