Bugfix in spawn file
This commit is contained in:
parent
cd9ac833dc
commit
61a9d8d612
7
dist/commands/dev/index.js
vendored
7
dist/commands/dev/index.js
vendored
@ -2,6 +2,7 @@ import { Command } from "commander";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import grabDirNames from "../../utils/grab-dir-names";
|
import grabDirNames from "../../utils/grab-dir-names";
|
||||||
import writeErrorFile from "../../functions/write-error-file";
|
import writeErrorFile from "../../functions/write-error-file";
|
||||||
|
import { existsSync } from "fs";
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
let timeout;
|
let timeout;
|
||||||
const MAX_RETRIES = 5;
|
const MAX_RETRIES = 5;
|
||||||
@ -19,8 +20,12 @@ async function dev() {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const dev_spawn_file = path.resolve(__dirname, "dev-spawn.ts");
|
const dev_spawn_file = path.resolve(__dirname, "dev-spawn.ts");
|
||||||
|
const dev_spawn_js_file = path.resolve(__dirname, "dev-spawn.js");
|
||||||
|
const final_spawn_file = existsSync(dev_spawn_js_file)
|
||||||
|
? dev_spawn_js_file
|
||||||
|
: dev_spawn_file;
|
||||||
const spawn_options = {
|
const spawn_options = {
|
||||||
cmd: ["bun", dev_spawn_file],
|
cmd: ["bun", final_spawn_file],
|
||||||
stdio: ["inherit", "inherit", "inherit"],
|
stdio: ["inherit", "inherit", "inherit"],
|
||||||
async onExit(subprocess, exitCode, signalCode, error) {
|
async onExit(subprocess, exitCode, signalCode, error) {
|
||||||
writeErrorFile({ exitCode, error });
|
writeErrorFile({ exitCode, error });
|
||||||
|
|||||||
9
dist/commands/start/index.js
vendored
9
dist/commands/start/index.js
vendored
@ -1,6 +1,7 @@
|
|||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import writeErrorFile from "../../functions/write-error-file";
|
import writeErrorFile from "../../functions/write-error-file";
|
||||||
|
import { existsSync } from "fs";
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
let timeout;
|
let timeout;
|
||||||
const MAX_RETRIES = 5;
|
const MAX_RETRIES = 5;
|
||||||
@ -17,9 +18,13 @@ async function start() {
|
|||||||
console.error(`Production server crashed ${MAX_RETRIES} times. Exiting.`);
|
console.error(`Production server crashed ${MAX_RETRIES} times. Exiting.`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
const dev_spawn_file = path.resolve(__dirname, "prod-spawn.ts");
|
const prod_spawn_file = path.resolve(__dirname, "prod-spawn.ts");
|
||||||
|
const prod_spawn_js_file = path.resolve(__dirname, "prod-spawn.js");
|
||||||
|
const final_spawn_file = existsSync(prod_spawn_js_file)
|
||||||
|
? prod_spawn_js_file
|
||||||
|
: prod_spawn_file;
|
||||||
const spawn_options = {
|
const spawn_options = {
|
||||||
cmd: ["bun", dev_spawn_file],
|
cmd: ["bun", final_spawn_file],
|
||||||
stdio: ["inherit", "inherit", "inherit"],
|
stdio: ["inherit", "inherit", "inherit"],
|
||||||
onExit(subprocess, exitCode, signalCode, error) {
|
onExit(subprocess, exitCode, signalCode, error) {
|
||||||
writeErrorFile({ exitCode, error });
|
writeErrorFile({ exitCode, error });
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/bunext",
|
"name": "@moduletrace/bunext",
|
||||||
"version": "1.0.93",
|
"version": "1.0.94",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import path from "path";
|
|||||||
import type { BunSpawnOptions } from "../../types";
|
import type { BunSpawnOptions } from "../../types";
|
||||||
import grabDirNames from "../../utils/grab-dir-names";
|
import grabDirNames from "../../utils/grab-dir-names";
|
||||||
import writeErrorFile from "../../functions/write-error-file";
|
import writeErrorFile from "../../functions/write-error-file";
|
||||||
|
import { existsSync } from "fs";
|
||||||
|
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
let timeout: any;
|
let timeout: any;
|
||||||
@ -25,9 +26,14 @@ async function dev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dev_spawn_file = path.resolve(__dirname, "dev-spawn.ts");
|
const dev_spawn_file = path.resolve(__dirname, "dev-spawn.ts");
|
||||||
|
const dev_spawn_js_file = path.resolve(__dirname, "dev-spawn.js");
|
||||||
|
|
||||||
|
const final_spawn_file = existsSync(dev_spawn_js_file)
|
||||||
|
? dev_spawn_js_file
|
||||||
|
: dev_spawn_file;
|
||||||
|
|
||||||
const spawn_options: BunSpawnOptions = {
|
const spawn_options: BunSpawnOptions = {
|
||||||
cmd: ["bun", dev_spawn_file],
|
cmd: ["bun", final_spawn_file],
|
||||||
stdio: ["inherit", "inherit", "inherit"],
|
stdio: ["inherit", "inherit", "inherit"],
|
||||||
async onExit(subprocess, exitCode, signalCode, error) {
|
async onExit(subprocess, exitCode, signalCode, error) {
|
||||||
writeErrorFile({ exitCode, error });
|
writeErrorFile({ exitCode, error });
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { Command } from "commander";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import type { BunSpawnOptions } from "../../types";
|
import type { BunSpawnOptions } from "../../types";
|
||||||
import writeErrorFile from "../../functions/write-error-file";
|
import writeErrorFile from "../../functions/write-error-file";
|
||||||
|
import { existsSync } from "fs";
|
||||||
|
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
let timeout: any;
|
let timeout: any;
|
||||||
@ -19,14 +20,21 @@ async function start() {
|
|||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
if (retries >= MAX_RETRIES) {
|
if (retries >= MAX_RETRIES) {
|
||||||
console.error(`Production server crashed ${MAX_RETRIES} times. Exiting.`);
|
console.error(
|
||||||
|
`Production server crashed ${MAX_RETRIES} times. Exiting.`,
|
||||||
|
);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dev_spawn_file = path.resolve(__dirname, "prod-spawn.ts");
|
const prod_spawn_file = path.resolve(__dirname, "prod-spawn.ts");
|
||||||
|
const prod_spawn_js_file = path.resolve(__dirname, "prod-spawn.js");
|
||||||
|
|
||||||
|
const final_spawn_file = existsSync(prod_spawn_js_file)
|
||||||
|
? prod_spawn_js_file
|
||||||
|
: prod_spawn_file;
|
||||||
|
|
||||||
const spawn_options: BunSpawnOptions = {
|
const spawn_options: BunSpawnOptions = {
|
||||||
cmd: ["bun", dev_spawn_file],
|
cmd: ["bun", final_spawn_file],
|
||||||
stdio: ["inherit", "inherit", "inherit"],
|
stdio: ["inherit", "inherit", "inherit"],
|
||||||
onExit(subprocess, exitCode, signalCode, error) {
|
onExit(subprocess, exitCode, signalCode, error) {
|
||||||
writeErrorFile({ exitCode, error });
|
writeErrorFile({ exitCode, error });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user