schrun 0.3.6 → 0.3.8

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/dist/daemon.mjs CHANGED
@@ -1,31 +1,30 @@
1
- import { r as CONFIG_DIR, t as readJSON } from "./readJSON-BIHboQ76.mjs";
1
+ import { r as CONFIG_DIR, t as readJSON } from "./readJSON-BGWDrdep.mjs";
2
2
  import { readdir } from "node:fs/promises";
3
3
  import { consola } from "consola";
4
4
  import { spawn } from "node:child_process";
5
5
  import cron from "node-cron";
6
6
  // src/run/daemon.ts
7
7
  const startschedule = async () => {
8
- const readConfig = await readdir(CONFIG_DIR);
9
- for (const filename of readConfig) {
10
- if (!filename.endsWith(".json")) continue;
11
- if (filename.match("pid.json")) continue;
12
- const [filenamesplit] = filename.split(".");
13
- const read = await readJSON(filenamesplit);
14
- if (!read.enabled) continue;
15
- const [command, ...args] = read.run.trim().split(/\s+/);
16
- if (!command) continue;
17
- cron.schedule(read.cron, () => {
18
- spawn(command, args, {
19
- detached: true,
20
- stdio: "inherit"
8
+ const readScheduleJSON = await readdir(CONFIG_DIR);
9
+ for (const readSchedule of readScheduleJSON) {
10
+ if (readSchedule.endsWith(".json")) continue;
11
+ if (readSchedule.match("pid.json")) continue;
12
+ const [filenamesplit] = readSchedule.split(".");
13
+ const fileread = await readJSON(filenamesplit);
14
+ const [commands, ...args] = fileread.run.split(/\+s/);
15
+ if (!commands) continue;
16
+ cron.schedule(fileread.cron, () => {
17
+ spawn(commands, args, {
18
+ stdio: "ignore",
19
+ detached: true
21
20
  }).on("error", (error) => {
22
- consola.error(`コマンドの起動に失敗: ${command}`, error);
21
+ consola.error(`コマンドの起動に失敗: ${commands}`, error);
23
22
  });
24
23
  });
25
24
  }
26
25
  };
27
26
  startschedule().catch((error) => {
28
- consola.error("failed to up scheduler", error);
27
+ consola.error("Do not runnning daemon\n", error);
29
28
  process.exitCode = 1;
30
29
  });
31
30
  export { startschedule };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { i as PID_FILE, n as CLI_COMMAND_NAME, r as CONFIG_DIR, t as readJSON } from "./readJSON-BIHboQ76.mjs";
2
+ import { i as PID_FILE, n as CLI_COMMAND_NAME, r as CONFIG_DIR, t as readJSON } from "./readJSON-BGWDrdep.mjs";
3
3
  import { cli, define } from "gunshi";
4
4
  import { readFile, readdir, unlink, writeFile } from "node:fs/promises";
5
5
  import { consola } from "consola";
6
- import { spawn } from "node:child_process";
6
+ import { fork, spawn } from "node:child_process";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import Table from "cli-table3";
9
9
  // src/version.ts
@@ -45,7 +45,7 @@ const runsurface = async (FileName) => {
45
45
  // src/run/startScheduler.ts
46
46
  const startSchedule = async () => {
47
47
  const daemonPath = fileURLToPath(new URL("./daemon.mjs", import.meta.url));
48
- const child = spawn(process.execPath, [daemonPath], {
48
+ const child = fork(process.execPath, [daemonPath], {
49
49
  detached: true,
50
50
  stdio: "ignore"
51
51
  });
@@ -63,7 +63,7 @@ const stopSchedule = async () => {
63
63
  try {
64
64
  pid = Number(await readFile(PID_FILE, "utf-8"));
65
65
  } catch (error) {
66
- consola.warn("No look schedule pid file");
66
+ consola.warn("No Look Schedule Pid File");
67
67
  return;
68
68
  }
69
69
  if (!Number.isSafeInteger(pid) || pid <= 0) {
@@ -72,9 +72,9 @@ const stopSchedule = async () => {
72
72
  }
73
73
  try {
74
74
  process.kill(pid, "SIGINT");
75
- consola.success("Success Send stop scheduler");
75
+ consola.success("Failed Send Stop Scheduler");
76
76
  } catch (error) {
77
- consola.error("Failed Send stop scheduler", error);
77
+ consola.error("Failed Send Stop Scheduler\n", error);
78
78
  return;
79
79
  }
80
80
  await unlink(PID_FILE).catch(() => {});
@@ -1,7 +1,6 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { homedir } from "node:os";
4
- import "zod";
5
4
  import typia from "typia";
6
5
  // src/constant/app.ts
7
6
  const CLI_COMMAND_NAME = "schrun";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "schrun",
3
3
  "module": "src/index.ts",
4
- "version": "0.3.6",
4
+ "version": "0.3.8",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -16,7 +16,10 @@
16
16
  "url": "https://github.com/nazozokc"
17
17
  },
18
18
  "scripts": {
19
- "build": "bunx tsdown"
19
+ "build": "bunx tsdown",
20
+ "docs:dev": "bunx vitepress dev docs",
21
+ "docs:build": "bunx vitepress build docs",
22
+ "docs:preview": "bunx vitepress preview docs"
20
23
  },
21
24
  "files": [
22
25
  "dist",
@@ -26,10 +29,11 @@
26
29
  ],
27
30
  "devDependencies": {
28
31
  "@types/bun": "latest",
29
- "tsdown": "latest"
32
+ "tsdown": "latest",
33
+ "vitepress": "^1.6.4"
30
34
  },
31
35
  "peerDependencies": {
32
- "typescript": "^7"
36
+ "typescript": "^7.0.2"
33
37
  },
34
38
  "dependencies": {
35
39
  "cli-table3": "^0.6.5",