@dithrkit/sdk 0.1.0 → 0.1.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 ADDED
@@ -0,0 +1,61 @@
1
+ # @dithrkit/sdk
2
+
3
+ SDK and CLI for the [dithr](https://github.com/dithrkit/dithr) fantasy console.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @dithrkit/sdk
9
+ ```
10
+
11
+ Or scaffold a new project (installs the SDK automatically):
12
+
13
+ ```bash
14
+ npm create @dithrkit my-game
15
+ ```
16
+
17
+ ## CLI Commands
18
+
19
+ | Command | Description |
20
+ | ----------------- | ---------------------------------------------- |
21
+ | `dithrkit run` | Run natively with hot-reload |
22
+ | `dithrkit dev` | Build TS in watch mode + run (native dev loop) |
23
+ | `dithrkit build` | Bundle JS/TS source via esbuild |
24
+ | `dithrkit serve` | Build and serve in the browser |
25
+ | `dithrkit watch` | Build, serve, and live-reload on file changes |
26
+ | `dithrkit export` | Export for web or desktop distribution |
27
+
28
+ ## TypeScript Support
29
+
30
+ The SDK ships type definitions for the dithr API. Scaffolded TypeScript
31
+ projects automatically extend the shared tsconfig:
32
+
33
+ ```json
34
+ {
35
+ "extends": "@dithrkit/sdk/configs/tsconfig.base.json",
36
+ "include": ["src/**/*.ts"]
37
+ }
38
+ ```
39
+
40
+ ## ESLint Config
41
+
42
+ A shared ESLint config is available for both JS and TS projects:
43
+
44
+ ```js
45
+ const dithrConfig = require("@dithrkit/sdk/configs/eslint");
46
+
47
+ module.exports = [
48
+ ...dithrConfig.ts, // or dithrConfig.js
49
+ ];
50
+ ```
51
+
52
+ ## Documentation
53
+
54
+ - [API Reference](https://github.com/dithrkit/dithr/blob/main/docs/api-reference.md)
55
+ - [Cart Format](https://github.com/dithrkit/dithr/blob/main/docs/cart-format.md)
56
+ - [Architecture](https://github.com/dithrkit/dithr/blob/main/docs/architecture.md)
57
+ - [Building](https://github.com/dithrkit/dithr/blob/main/docs/building.md)
58
+
59
+ ## License
60
+
61
+ MIT
@@ -86,6 +86,10 @@ const cart = {
86
86
  code: codeEntry,
87
87
  maps: [],
88
88
  };
89
+ if (useTypescript) {
90
+ cart.buildCommand =
91
+ "npx esbuild src/main.ts --bundle --format=esm --target=es2020 --outfile=dist/main.js";
92
+ }
89
93
  fs.writeFileSync(path.join(dir, "cart.json"), JSON.stringify(cart, null, 4) + "\n");
90
94
 
91
95
  // src/main.{js,ts} from template
@@ -89,8 +89,12 @@ function exportWeb(cart, out) {
89
89
  const shellPath = path.join(__dirname, "..", "..", "templates", "shell.html");
90
90
  let html = fs.readFileSync(shellPath, "utf-8");
91
91
 
92
- // Replace title
93
- const title = cart.title || "dithr";
92
+ // Replace title (escape HTML entities to prevent XSS)
93
+ const title = (cart.title || "dithr")
94
+ .replace(/&/g, "&")
95
+ .replace(/</g, "&lt;")
96
+ .replace(/>/g, "&gt;")
97
+ .replace(/"/g, "&quot;");
94
98
  html = html.replace("<title>dithr</title>", `<title>${title}</title>`);
95
99
 
96
100
  // Replace {{{ SCRIPT }}} with script tags
package/lib/packager.js CHANGED
@@ -34,6 +34,11 @@ function packDirectory(dir, mount) {
34
34
  const fullPath = path.join(currentDir, entry.name);
35
35
  const relPath = relPrefix ? `${relPrefix}/${entry.name}` : entry.name;
36
36
 
37
+ if (entry.isSymbolicLink()) {
38
+ // Skip symlinks to prevent including files outside the cart
39
+ continue;
40
+ }
41
+
37
42
  if (entry.isDirectory()) {
38
43
  walk(fullPath, relPath);
39
44
  } else if (entry.isFile()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dithrkit/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "SDK and CLI for the dithr fantasy console",
5
5
  "license": "MIT",
6
6
  "author": "dithrkit",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/dithrkit/dithr.git",
22
+ "url": "git+https://github.com/dithrkit/dithr.git",
23
23
  "directory": "packages/sdk"
24
24
  },
25
25
  "bin": {
@@ -44,9 +44,9 @@
44
44
  "esbuild": "^0.24.0"
45
45
  },
46
46
  "optionalDependencies": {
47
- "@dithrkit/win32-x64": "0.1.0",
48
- "@dithrkit/linux-x64": "0.1.0",
49
- "@dithrkit/darwin-arm64": "0.1.0",
50
- "@dithrkit/wasm": "0.1.0"
47
+ "@dithrkit/win32-x64": "0.1.3",
48
+ "@dithrkit/linux-x64": "0.1.3",
49
+ "@dithrkit/darwin-arm64": "0.1.3",
50
+ "@dithrkit/wasm": "0.1.3"
51
51
  }
52
52
  }