@mono-labs/cli 0.0.123 β†’ 0.0.125

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.
@@ -125,8 +125,7 @@ function childManager(
125
125
  }
126
126
 
127
127
  child.on('sigint', (code) => {
128
-
129
-
128
+ console.log(
130
129
  `\n${service.icon || 'πŸ”š'} ${service.name || 'Service'} exited with code ${code}`
131
130
  );
132
131
  if (restartCallback) restartCallback();
@@ -134,9 +133,6 @@ function childManager(
134
133
 
135
134
  child.on('exit', (code) => {
136
135
  if (!serviceSigInt[service.name] && restartCallback) {
137
-
138
- `\n${service.icon || 'πŸ”š'} ${service.name || 'Service'} exited with code ${code}\n`
139
- );
140
136
  restartCallback();
141
137
  }
142
138
  });
@@ -168,7 +164,7 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
168
164
  getPrepServices().forEach((key) => {
169
165
  const { command, stdio } = devServices[key];
170
166
  if (acceptedServices.includes(key)) {
171
-
167
+ console.log(`Running command for service ${key}: ${command}`);
172
168
  const child = spawn(command, {
173
169
  stdio: ['pipe', 'inherit', 'pipe'], // Read from terminal, but capture output
174
170
  shell: true,
@@ -178,10 +174,10 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
178
174
  });
179
175
  if (key === 'app') {
180
176
  child.on('sigint', () => {
181
-
177
+ console.log('SIGINT received for app service');
182
178
  });
183
179
  child.on('exit', () => {
184
-
180
+ console.log('exit received for app service');
185
181
  });
186
182
  }
187
183
 
@@ -194,8 +190,8 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
194
190
  try {
195
191
  ngrokUrl = (await getNgrokUrl()) + '/';
196
192
  } catch (e) {
197
-
198
-
193
+ console.log('Ngrok failed to start. Retrying in 2 seconds...');
194
+ console.log(e);
199
195
  await new Promise((res) => setTimeout(res, 2000)); // Delay before retry
200
196
  }
201
197
  }
@@ -214,8 +210,6 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
214
210
 
215
211
  setTimeout(
216
212
  () => {
217
-
218
-
219
213
  getContinuedServices().forEach((key) => {
220
214
  if (stage && key === 'app') {
221
215
  startService(key, forceProd, ngrokUrl, stage, envObj);
@@ -230,7 +224,7 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
230
224
  );
231
225
 
232
226
  async function shutdown() {
233
-
227
+ console.log('\nπŸ›‘ Shutting down all services...');
234
228
  for (const [key, child] of Object.entries(childProcesses)) {
235
229
  if (
236
230
  child &&
@@ -239,11 +233,11 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
239
233
  devServices[key].continue &&
240
234
  !['docker'].includes(key)
241
235
  ) {
242
-
236
+ console.log(`β†’ Killing service: ${key}`);
243
237
  await new Promise((resolve) => {
244
238
  treeKill(child.pid, 'SIGTERM', (err) => {
245
239
  if (!err) {
246
-
240
+ console.log(`βœ… ${key} has been tree-killed.`);
247
241
  }
248
242
  resolve();
249
243
  });
@@ -271,6 +265,6 @@ export async function dev(_forceProd, useAtlas, argServices, stage) {
271
265
 
272
266
  // Exit signal
273
267
  process.on('exit', () => {
274
-
268
+ console.log('πŸ‘‹ Process exiting...');
275
269
  });
276
270
  }
package/lib/index.js CHANGED
@@ -23,7 +23,6 @@ const preactions = config.workspace?.preactions || [];
23
23
  const envMapList = config.envMap ?? ['FAILURE'];
24
24
 
25
25
  program.on('command:*', (operands) => {
26
-
27
26
  const [cmd] = operands; // e.g. "destroy3"
28
27
  const raw = program.rawArgs.slice(2); // after `node script.js`
29
28
  const i = raw.indexOf(cmd);
@@ -31,40 +30,28 @@ program.on('command:*', (operands) => {
31
30
 
32
31
  const workspace = workspacemap[tokens[0]] || tokens[0];
33
32
  let rest = tokens.slice(1);
34
-
35
-
36
33
 
37
34
  const envKeys = Object.keys(process.env).filter((k) => k.startsWith('MONO_'));
38
35
 
39
36
  let envObj = {};
40
37
 
41
-
42
38
  envKeys.map((k) => {
43
39
  envMapList.map((item) => {
44
40
  envObj[k.replace('MONO', item)] = process.env[k];
45
41
  });
46
42
  });
47
43
 
48
-
49
-
50
- // If the β€œrest” is empty or starts with flags, insert a default script
51
-
52
44
  const args = ['workspace', workspace, ...rest];
53
-
54
45
 
55
46
  console.error(`Unknown command. Falling back to: yarn ${args.join(' ')}`);
56
47
  executeCommandsIfWorkspaceAction(args, preactions, envObj);
57
-
58
- stdio: 'inherit',
59
- shell: process.platform === 'win32',
60
- });
61
48
  const child = spawn('yarn', args, {
62
49
  stdio: 'inherit',
63
50
  shell: process.platform === 'win32',
64
51
  env: { ...process.env, ...envObj },
65
52
  });
66
53
  child.on('exit', (code) => {
67
-
54
+ console.log('Child process exited with code:', code);
68
55
  process.exitCode = code ?? 1;
69
56
  });
70
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-labs/cli",
3
- "version": "0.0.123",
3
+ "version": "0.0.125",
4
4
  "description": "A CLI tool for building and deploying projects",
5
5
  "type": "module",
6
6
  "main": "index.js",