@bb-labs/bldr 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -225,27 +225,47 @@ async function main() {
225
225
  // TypeScript compiler handles additions and changes automatically
226
226
  const shutdown = async () => {
227
227
  console.log("\n[bldr] shutting down...");
228
+ // Close file watcher
228
229
  try {
229
- srcWatcher.close();
230
+ await srcWatcher.close();
230
231
  console.log("[bldr] src watcher closed");
231
232
  }
232
233
  catch (error) {
233
234
  console.error(`[bldr] error closing src watcher: ${error}`);
234
235
  }
235
- try {
236
- tscWatch.kill();
237
- console.log("[bldr] tsc watcher killed");
238
- }
239
- catch (error) {
240
- console.error(`[bldr] error killing tsc watcher: ${error}`);
236
+ // Kill child processes
237
+ const killPromises = [];
238
+ if (!tscWatch.killed) {
239
+ killPromises.push(new Promise((resolve) => {
240
+ tscWatch.on("exit", () => resolve());
241
+ tscWatch.kill();
242
+ // Force kill after 5 seconds
243
+ setTimeout(() => {
244
+ if (!tscWatch.killed) {
245
+ tscWatch.kill("SIGKILL");
246
+ }
247
+ resolve();
248
+ }, 5000);
249
+ }));
250
+ console.log("[bldr] killing tsc watcher...");
241
251
  }
242
- try {
243
- aliasWatch.kill();
244
- console.log("[bldr] tsc-alias watcher killed");
245
- }
246
- catch (error) {
247
- console.error(`[bldr] error killing tsc-alias watcher: ${error}`);
252
+ if (!aliasWatch.killed) {
253
+ killPromises.push(new Promise((resolve) => {
254
+ aliasWatch.on("exit", () => resolve());
255
+ aliasWatch.kill();
256
+ // Force kill after 5 seconds
257
+ setTimeout(() => {
258
+ if (!aliasWatch.killed) {
259
+ aliasWatch.kill("SIGKILL");
260
+ }
261
+ resolve();
262
+ }, 5000);
263
+ }));
264
+ console.log("[bldr] killing tsc-alias watcher...");
248
265
  }
266
+ // Wait for all child processes to exit
267
+ await Promise.all(killPromises);
268
+ console.log("[bldr] all processes cleaned up");
249
269
  process.exit(0);
250
270
  };
251
271
  process.on("SIGINT", shutdown);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bb-labs/bldr",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "bin": {
5
5
  "bldr": "./dist/index.js"
6
6
  },