woodstone 0.1.0 → 0.1.4

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/index.cjs CHANGED
@@ -1,2 +1,54 @@
1
1
  #!/usr/bin/env node
2
- require("./server.js")
2
+
3
+ function parseArgs(argv) {
4
+ const args = argv.slice(2)
5
+ const flags = { port: 3000, host: "0.0.0.0", "license-key": undefined }
6
+ const positionals = []
7
+ const allowed = new Set(["port", "host", "license-key"])
8
+
9
+ for (let i = 0; i < args.length; i++) {
10
+ const arg = args[i]
11
+ if (arg.startsWith("--")) {
12
+ const withoutDashes = arg.slice(2)
13
+ let key, value
14
+ if (withoutDashes.includes("=")) {
15
+ const parts = withoutDashes.split("=")
16
+ key = parts.shift()
17
+ if (!allowed.has(key)) {
18
+ console.error("Unknown Flag:", key)
19
+ process.exit(1)
20
+ }
21
+ value = parts.join("=")
22
+ } else {
23
+ key = withoutDashes
24
+ if (!allowed.has(key)) {
25
+ console.error("Unknown Flag:", key)
26
+ process.exit(1)
27
+ }
28
+ const next = args[i + 1]
29
+ if (next && !next.startsWith("-")) {
30
+ value = next
31
+ i++
32
+ } else {
33
+ console.error(`Flag --${key} requires a value`)
34
+ process.exit(1)
35
+ }
36
+ }
37
+ flags[key] = value
38
+ continue
39
+ }
40
+ if (arg.startsWith("-")) {
41
+ console.error(`Unknown short flag ${arg}`)
42
+ process.exit(1)
43
+ }
44
+ positionals.push(arg)
45
+ }
46
+ return { flags, positionals }
47
+ }
48
+
49
+ const { flags } = parseArgs(process.argv)
50
+ process.env.PORT = flags.port
51
+ process.env.HOST = flags.host
52
+ console.log("Flags:", flags)
53
+
54
+ require("./server.js")
Binary file
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "woodstone",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "A simple web-app that allows you to easily create and deploy a website/API server with drag-and-drop mechanics.",
5
5
  "type": "module",
6
- "main": "index.cjs",
7
6
  "bin": {
8
7
  "woodstone": "index.cjs"
9
8
  },
@@ -22,6 +21,7 @@
22
21
  "homepage": "https://github.com/axryans/woodstone#readme",
23
22
  "dependencies": {
24
23
  "comment-json": "^4.5.1",
24
+ "env-paths": "^4.0.0",
25
25
  "hono": "^4.11.10",
26
26
  "next": "15.5.2",
27
27
  "react": "19.1.0",