Skip to content

Commit 425c73c

Browse files
committed
add some command niceness
1 parent b4c6000 commit 425c73c

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

typescript-sdk/apps/dojo/scripts/prep-dojo-everything.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,26 @@ const { execSync } = require('child_process');
44
const path = require('path');
55
const concurrently = require('concurrently');
66

7+
// Parse command line arguments
8+
const args = process.argv.slice(2);
9+
const showHelp = args.includes('--help') || args.includes('-h');
10+
const dryRun = args.includes('--dry-run');
11+
12+
if (showHelp) {
13+
console.log(`
14+
Usage: node prep-dojo-everything.js [options]
15+
16+
Options:
17+
--dry-run Show what would be installed without actually running
18+
--help, -h Show this help message
19+
20+
Examples:
21+
node prep-dojo-everything.js
22+
node prep-dojo-everything.js --dry-run
23+
`);
24+
process.exit(0);
25+
}
26+
727
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
828
const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations');
929

@@ -79,8 +99,18 @@ const dojo = {
7999
cwd: path.join(gitRoot, 'typescript-sdk'),
80100
}
81101

102+
function printDryRunServices(procs) {
103+
console.log('Dry run - would install dependencies for the following services:');
104+
procs.forEach(proc => {
105+
console.log(` - ${proc.name} (${proc.cwd})`);
106+
console.log(` Command: ${proc.command}`);
107+
console.log('');
108+
});
109+
process.exit(0);
110+
}
111+
82112
async function main() {
83-
const {result} = concurrently([
113+
const procs = [
84114
serverStarter,
85115
serverStarterAllFeatures,
86116
agno,
@@ -91,7 +121,13 @@ async function main() {
91121
mastra,
92122
pydanticAi,
93123
dojo
94-
]);
124+
];
125+
126+
if (dryRun) {
127+
printDryRunServices(procs);
128+
}
129+
130+
const {result} = concurrently(procs);
95131

96132
result.then(() => process.exit(0)).catch((err) => {
97133
console.error(err);

typescript-sdk/apps/dojo/scripts/run-dojo-everything.js

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ const { execSync } = require('child_process');
44
const path = require('path');
55
const concurrently = require('concurrently');
66

7+
// Parse command line arguments
8+
const args = process.argv.slice(2);
9+
const showHelp = args.includes('--help') || args.includes('-h');
10+
const dryRun = args.includes('--dry-run');
11+
12+
if (showHelp) {
13+
console.log(`
14+
Usage: node run-dojo-everything.js [options]
15+
16+
Options:
17+
--e2e Run end-to-end tests after starting services
18+
--dry-run Show what would be started without actually running
19+
--help, -h Show this help message
20+
21+
Examples:
22+
node run-dojo-everything.js
23+
node run-dojo-everything.js --e2e
24+
node run-dojo-everything.js --dry-run
25+
`);
26+
process.exit(0);
27+
}
28+
729
const gitRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf-8' }).trim();
830
const integrationsRoot = path.join(gitRoot, 'typescript-sdk', 'integrations');
931

@@ -132,11 +154,33 @@ const procs = [
132154
dojo
133155
];
134156

135-
if (process.argv.includes('--e2e')) {
157+
if (args.includes('--e2e')) {
136158
procs.push(e2e);
137159
}
138160

161+
function printDryRunServices(procs) {
162+
console.log('Dry run - would start the following services:');
163+
procs.forEach(proc => {
164+
console.log(` - ${proc.name} (${proc.cwd})`);
165+
console.log(` Command: ${proc.command}`);
166+
console.log(` Environment variables:`);
167+
if (proc.env) {
168+
Object.entries(proc.env).forEach(([key, value]) => {
169+
console.log(` ${key}: ${value}`);
170+
});
171+
} else {
172+
console.log(' No environment variables specified.');
173+
}
174+
console.log('');
175+
});
176+
process.exit(0);
177+
}
178+
139179
async function main() {
180+
if (dryRun) {
181+
printDryRunServices(procs);
182+
}
183+
140184
const {result} = concurrently(procs);
141185

142186
result.then(() => process.exit(0)).catch((err) => {

0 commit comments

Comments
 (0)