npgsqlrest 1.1.6 → 1.1.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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "npgsqlrest",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Automatic REST API for PostgreSQL Databases Client Build",
5
5
  "scripts": {
6
6
  "postinstall": "node postinstall.js",
7
+ "uninstall": "node uninstall.js",
7
8
  "start": "npx npgsqlrest ./appsettings.json ./npgsqlrest.json"
8
9
  },
9
10
  "bin": {
10
- "npgsqlrest": "./npgsqlrest.js",
11
+ "npgsqlrest": "node_modules/.bin/npgsqlrest",
11
12
  "npgsqlrest-config-copy": "./config-copy.js"
12
13
  },
13
14
  "repository": {
package/postinstall.js CHANGED
@@ -1,9 +1,11 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const fs = require("fs");
2
4
  const path = require("path");
3
5
  const os = require("os");
4
6
  const https = require("https");
5
7
 
6
- const downloadDir = "./.bin/";
8
+ const downloadDir = "../.bin/";
7
9
  const downloadFrom = "https://github.com/vb-consulting/NpgsqlRest/releases/download/v2.7.1-client-v1.1.0/";
8
10
 
9
11
  function download(url, to, done) {
package/readme.md CHANGED
@@ -25,6 +25,28 @@ NpgsqlRest Client Web App is a command line utility that runs as a configurable
25
25
 
26
26
  See the [default configuration file](https://vb-consulting.github.io/npgsqlrest/config/) with descriptions for more information.
27
27
 
28
+ ## Notes Before Installation
29
+
30
+ This package will download an executable file for the target OS on installation (see the postinstall.js script) from the [GitHub release page](https://github.com/vb-consulting/NpgsqlRest/releases/).
31
+
32
+ Currently, only the Windows-64 and Linux-64 builds are supported.
33
+
34
+ The Mac OS builds are missing because I don't have a Mac machine. If someone could help me out with this I'd be grateful.
35
+
36
+ If you try to install this package on MacOS, or any other unsupported OS, installation will report: `Unsupported OS detected: [OS Type]`.
37
+
38
+ To see how you can create your own custom build follow these instructions:
39
+
40
+ Steps:
41
+
42
+ 1) Make sure that you have .NET8 SDK installed and ready.
43
+ 2) Clone [NpgsqlRest repository](https://github.com/vb-consulting/NpgsqlRest/tree/master/NpgsqlRest)
44
+ 3) Navigate to the [`NpgsqlRestClient` project directory](https://github.com/vb-consulting/NpgsqlRest/tree/master/NpgsqlRestClient/).
45
+ 4) Make your desired customizations (or not).
46
+ 5) Run publish command, for example, `dotnet publish -r win-x64 -c Release --output [target dir]`
47
+
48
+ Notes: `win-x64` is the designated target OS for the build. Adjust this parameter appropriately for the target OS. See [https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids](https://learn.microsoft.com/en-us/dotnet/core/rid-catalog#known-rids). The project is already configured for the AOT builds, but you will need to run the publish command from the same flavor OS as the build target OS (Windows for Windows builds, Linux for Linux builds, etc).
49
+
28
50
  ## Installation
29
51
 
30
52
  Install `npgsqlrest` using npm:
@@ -72,12 +94,22 @@ $ npx npgsqlrest appsettings.json project-config.json
72
94
  [11:29:07.083 INF] Created HTTP file: /home/vbilopav/npgsqlrest-npm-test/test_public.http [NpgsqlRest.HttpFiles]
73
95
  [11:29:07.100 INF] Started in 00:00:00.5527040 [Program]
74
96
  [11:29:07.100 INF] Listening on ["http://localhost:5001"] [Program]
75
- ^C
76
- $
77
97
  ```
78
98
 
79
99
  ## Changelog
80
100
 
101
+ ### 1.1.8
102
+
103
+ Changed the download target from `./node_modules/npgsqlrest/.bin/` to shared bin: `./node_modules/.bin/`.
104
+
105
+ The reason is that when using the `./node_modules/npgsqlrest/.bin/` directory, I have to use the node spawn process wrapper which slows down the startup time. When the executable is in the `./node_modules/.bin/` it can be invoked directly which is an extremely fast, almost instant startup (a couple of milliseconds).
106
+
107
+ But now, I have to use the uninstall script too, to ensure the proper cleanup on the install.
108
+
109
+ ### 1.1.7
110
+
111
+ Update readme.
112
+
81
113
  ### 1.1.6
82
114
  ### 1.1.5
83
115
  ### 1.1.4
@@ -95,9 +127,9 @@ Fixing the issue with the local .bin directory.
95
127
 
96
128
  New build versions:
97
129
 
130
+ ```console
98
131
  Client Build 1.1.0.0
99
132
  Npgsql 2.7.1.0
100
133
  NpgsqlRest.HttpFiles 1.0.2.0
101
134
  NpgsqlRest.TsClient 1.6.0.0
102
-
103
- https://github.com/vb-consulting/NpgsqlRest/releases/tag/v2.7.1-client-v1.1.0
135
+ ```
package/uninstall.js ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const os = require("os");
5
+
6
+ const downloadDir = "../.bin/";
7
+ const osType = os.type();
8
+
9
+ var downloadTo;
10
+
11
+ if (osType === "Windows_NT") {
12
+ downloadTo = `${downloadDir}npgsqlrest.exe`;
13
+ } else {
14
+ downloadTo = `${downloadDir}npgsqlrest`;
15
+ }
16
+
17
+ if (fs.existsSync(downloadTo)) {
18
+ fs.unlinkSync(downloadTo);
19
+ }
20
+
21
+
package/npgsqlrest.js DELETED
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const { spawn } = require("child_process");
4
- const path = require("path");
5
-
6
- // Path to the binary file
7
- const binaryPath = path.join(__dirname, "./.bin/npgsqlrest");
8
-
9
- // Arguments passed to the script
10
- const args = process.argv.slice(2);
11
-
12
- // Spawn a child process to run the binary file
13
- const child = spawn(binaryPath, args, { stdio: "inherit" });
14
-
15
- child.on("error", (error) => {
16
- console.error(`Failed to start subprocess.\n${error}`);
17
- });
18
-
19
- child.on("exit", (code) => {
20
- process.exit(code);
21
- });