@quangnv13/nonstop 1.0.12 → 1.0.13

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 +19 -0
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -5,12 +5,31 @@ const config_js_1 = require("./config.js");
5
5
  const logger_js_1 = require("./logger.js");
6
6
  const runtime_js_1 = require("./runtime.js");
7
7
  const ui_js_1 = require("./ui.js");
8
+ const runtime_manager_js_1 = require("./runtime-manager.js");
8
9
  async function main() {
9
10
  (0, config_js_1.ensureEnvExampleFile)();
10
11
  const args = new Set(process.argv.slice(2));
11
12
  const isBackground = args.has('--background');
13
+ const isStop = args.has('--stop');
12
14
  const config = (0, config_js_1.loadConfigFromDisk)();
13
15
  (0, config_js_1.applyConfigToProcessEnv)(config);
16
+ if (isStop) {
17
+ const status = (0, runtime_manager_js_1.getRuntimeStatus)();
18
+ if (status.running && status.snapshot) {
19
+ try {
20
+ const msg = (0, runtime_manager_js_1.stopBackgroundRuntime)(status.snapshot);
21
+ console.log(msg);
22
+ }
23
+ catch (error) {
24
+ console.error(error instanceof Error ? error.message : String(error));
25
+ process.exitCode = 1;
26
+ }
27
+ }
28
+ else {
29
+ console.log('nonstop background runtime is not running.');
30
+ }
31
+ return;
32
+ }
14
33
  if (isBackground) {
15
34
  const missingFields = (0, config_js_1.getMissingConfigFields)(config);
16
35
  if (missingFields.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quangnv13/nonstop",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "preferGlobal": true,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -41,7 +41,8 @@
41
41
  "build": "tsc -p tsconfig.json",
42
42
  "start": "node dist/index.js",
43
43
  "test": "node --import tsx --test src/*.test.ts",
44
- "preinstall": "node scripts/preinstall.js"
44
+ "preinstall": "node scripts/preinstall.js",
45
+ "preuninstall": "node scripts/preinstall.js"
45
46
  },
46
47
  "dependencies": {
47
48
  "boxen": "^5.1.2",