@varavel/vdl 0.0.0-dev → 0.4.0-alpha.3

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
File without changes
package/bin.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { getBinaryPath } = require("./index.js");
5
+
6
+ try {
7
+ const binPath = getBinaryPath();
8
+ const args = process.argv.slice(2);
9
+
10
+ // Spawn vdl
11
+ const child = spawn(binPath, args, {
12
+ stdio: ["inherit", "inherit", "inherit"],
13
+ });
14
+
15
+ // Propagate OS signals
16
+ const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
17
+ signals.forEach((sig) => {
18
+ process.on(sig, () => {
19
+ if (child.pid) child.kill(sig);
20
+ });
21
+ });
22
+
23
+ child.on("exit", (code) => {
24
+ process.exit(code || 0);
25
+ });
26
+
27
+ child.on("error", (err) => {
28
+ console.error(err.message);
29
+ process.exit(1);
30
+ });
31
+ } catch (e) {
32
+ console.error(e.message);
33
+ process.exit(1);
34
+ }
package/index.js CHANGED
@@ -14,7 +14,7 @@ function getBinaryPath() {
14
14
  if (!fs.existsSync(binaryPath)) {
15
15
  throw new Error(
16
16
  `VDL binary not found at ${binaryPath}. ` +
17
- `Installation may have failed. Try reinstalling: npm install @varavel/vdl`,
17
+ `Installation may have failed. Try reinstalling: npm install --global @varavel/vdl`,
18
18
  );
19
19
  }
20
20
 
package/install.js CHANGED
@@ -256,8 +256,6 @@ function download(url) {
256
256
  }
257
257
 
258
258
  const chunks = [];
259
- let totalLength = 0;
260
-
261
259
  response.on("data", (chunk) => {
262
260
  chunks.push(chunk);
263
261
  totalLength += chunk.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varavel/vdl",
3
- "version": "0.0.0-dev",
3
+ "version": "0.4.0-alpha.3",
4
4
  "description": "Open-source cross-language definition engine for modern stacks. Define your data structures, APIs, contracts, and generate type-safe code for your backend and frontend instantly.",
5
5
  "author": "Varavel",
6
6
  "license": "MIT",
@@ -13,10 +13,18 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/varavelio/vdl/issues"
15
15
  },
16
+ "type": "commonjs",
16
17
  "main": "index.js",
17
18
  "bin": {
18
- "vdl": "bin/vdl"
19
+ "vdl": "bin.js"
19
20
  },
21
+ "files": [
22
+ "bin.js",
23
+ "install.js",
24
+ "index.js",
25
+ "package.json",
26
+ "README.md"
27
+ ],
20
28
  "scripts": {
21
29
  "postinstall": "node install.js"
22
30
  },
@@ -38,11 +46,5 @@
38
46
  "cpu": [
39
47
  "x64",
40
48
  "arm64"
41
- ],
42
- "files": [
43
- "bin/",
44
- "install.js",
45
- "index.js",
46
- "README.md"
47
49
  ]
48
50
  }