@koeroesi86/node-webserver-service 20.10.12-4df01bf → 22.3.21-6f09f84

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/README.md CHANGED
@@ -2,12 +2,36 @@
2
2
 
3
3
  OS service integration for @koeroesi86/node-webserver
4
4
 
5
- Usage:
6
-
7
- yarn node-webserver-service [argument]
8
-
9
- arguments:
10
- --add Installs the service
11
- --remove Removes the service
12
- --run Attempt to run the program as a service
5
+ This package brings ability to deploy webapps a lot easier. Just copy [configuration.example.js](configuration.example.js) to `configuration.js`, modify it to your needs and start server instantly. Configuration also supported in `configuration.json` format.
13
6
 
7
+ ### Dependencies to run
8
+ * [NodeJS](https://nodejs.org/en/)
9
+ * [Yarn](https://yarnpkg.com/en/)
10
+ * For Windows usage
11
+ 1. [Python](https://www.python.org/)
12
+ 1. [Visual C++ Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017)
13
+ 1. Windows build tools
14
+
15
+ From an administrator console:
16
+
17
+ ```shell script
18
+ npm install --global --production windows-build-tools
19
+ ```
20
+
21
+
22
+ ### Usage
23
+
24
+ ```shell script
25
+ yarn add @koeroesi86/node-webserver-service
26
+ ```
27
+
28
+ Please enter in a console/terminal:
29
+
30
+ ```shell script
31
+ yarn nws-service [argument]
32
+
33
+ arguments:
34
+ --add Installs the service
35
+ --remove Removes the service
36
+ --run Attempt to run the program as a service
37
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koeroesi86/node-webserver-service",
3
- "version": "v20.10.12-4df01bf",
3
+ "version": "v22.03.21-6f09f84",
4
4
  "description": "OS service integration for @koeroesi86/node-webserver",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -12,7 +12,7 @@
12
12
  "access": "public"
13
13
  },
14
14
  "bin": {
15
- "node-webserver-service": "./scripts/manageService.js"
15
+ "nws-service": "./scripts/manageService.js"
16
16
  },
17
17
  "scripts": {
18
18
  "service": "node scripts/manageService.js",
@@ -20,10 +20,10 @@
20
20
  "generate-version": "node scripts/version.js"
21
21
  },
22
22
  "dependencies": {
23
- "@koeroesi86/node-webserver": "^20.10.104-80ebdf3",
23
+ "@koeroesi86/node-webserver": "^22.3.132-5e488e1",
24
24
  "os-service": "^2.2.0"
25
25
  },
26
26
  "devDependencies": {
27
- "nodemon": "^2.0.4"
27
+ "nodemon": "^2.0.15"
28
28
  }
29
29
  }
@@ -3,7 +3,6 @@
3
3
  const service = require('os-service');
4
4
  const path = require('path');
5
5
  const fs = require('fs');
6
- const {spawn} = require('child_process');
7
6
  const parseArgv = require('../utils/parseArgv');
8
7
 
9
8
  const {add, remove, run, configuration} = parseArgv();
@@ -36,13 +35,9 @@ if (add) {
36
35
  }
37
36
  });
38
37
  } else if (run) {
39
- const instance = spawn(
40
- 'node',
41
- [path.resolve(__dirname, '../node_modules/.bin/node-webserver'), `--config="${configPath}"`],
42
- {shell: true}
43
- );
38
+ const start = require('../utils/start');
39
+ start(configPath);
44
40
  service.run(() => {
45
- instance.kill('SIGINT');
46
41
  service.stop(0);
47
42
  });
48
43
  } else {
package/scripts/start.js CHANGED
@@ -1,22 +1,14 @@
1
- const {execSync} = require('child_process');
2
1
  const path = require('path');
3
2
  const fs = require('fs');
4
3
  const parseArgv = require('../utils/parseArgv');
4
+ const start = require('../utils/start');
5
5
 
6
6
  const { configuration } = parseArgv();
7
7
 
8
- const executable = path.resolve(__dirname, '../node_modules/.bin/node-webserver');
9
-
10
8
  const configPath = configuration || process.env.NODE_WEBSERVER_CONFIG || path.resolve(__dirname, '../configuration.example.js');
11
9
 
12
10
  if (!fs.existsSync(configPath)) {
13
11
  fs.copyFileSync(path.resolve(__dirname, '../configuration.example.js'), configPath);
14
12
  }
15
13
 
16
- execSync(
17
- `${executable} --config="${configPath}"`,
18
- {
19
- shell: true,
20
- stdio: 'inherit',
21
- }
22
- );
14
+ start(configPath);
package/utils/start.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = configPath => {
2
+ (async () => {
3
+ await new Promise(r => setTimeout(r, 1));
4
+ const nws = require('@koeroesi86/node-webserver');
5
+ const config = require(configPath);
6
+ await nws(config);
7
+ })();
8
+ };