@ts-for-gir/cli 4.0.0-rc.1 → 4.0.0-rc.12

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.
Files changed (35) hide show
  1. package/README.md +43 -3
  2. package/bin/ts-for-gir +2993 -727
  3. package/bin/ts-for-gir-gjs +296069 -0
  4. package/dist-templates/types-locally/.ts-for-girrc.js +6 -0
  5. package/dist-templates/types-locally/README.md +15 -0
  6. package/dist-templates/types-locally/esbuild.ts +10 -0
  7. package/dist-templates/types-locally/main.ts +21 -0
  8. package/dist-templates/types-locally/package.json +18 -0
  9. package/dist-templates/types-locally/tsconfig.json +17 -0
  10. package/dist-templates/types-npm/README.md +14 -0
  11. package/dist-templates/types-npm/esbuild.ts +10 -0
  12. package/dist-templates/types-npm/main.ts +19 -0
  13. package/dist-templates/types-npm/package.json +23 -0
  14. package/dist-templates/types-npm/tsconfig.json +15 -0
  15. package/dist-templates/types-workspace/.ts-for-girrc.js +12 -0
  16. package/dist-templates/types-workspace/README.md +26 -0
  17. package/dist-templates/types-workspace/package.json +22 -0
  18. package/dist-templates/types-workspace/packages/app/esbuild.ts +10 -0
  19. package/dist-templates/types-workspace/packages/app/main.ts +19 -0
  20. package/dist-templates/types-workspace/packages/app/package.json +23 -0
  21. package/dist-templates/types-workspace/packages/app/tsconfig.json +15 -0
  22. package/dist-templates/types-workspace/tsconfig.json +11 -0
  23. package/package.json +40 -19
  24. package/src/commands/create.ts +223 -0
  25. package/src/commands/index.ts +2 -0
  26. package/src/commands/run-generation-command.ts +6 -1
  27. package/src/commands/self-update.ts +142 -0
  28. package/src/config/config-loader.ts +51 -3
  29. package/src/config/defaults.ts +2 -0
  30. package/src/config/index.ts +9 -1
  31. package/src/config/options.ts +50 -0
  32. package/src/formatters/typescript-formatter.ts +9 -16
  33. package/src/module-loader.ts +46 -14
  34. package/src/start.ts +33 -15
  35. package/src/types/command-args.ts +36 -0
package/README.md CHANGED
@@ -22,21 +22,61 @@ CLI tool to generate TypeScript type definitions and HTML documentation for GObj
22
22
 
23
23
  ## Getting started
24
24
 
25
- ``` bash
25
+ ### Install (GJS — no Node.js required)
26
+
27
+ ```bash
28
+ curl -fsSL https://raw.githubusercontent.com/gjsify/ts-for-gir/main/install.js -o /tmp/ts-for-gir-install.js
29
+ gjs -m /tmp/ts-for-gir-install.js
30
+ rm /tmp/ts-for-gir-install.js
31
+ ```
32
+
33
+ Installs `ts-for-gir` to `~/.local/bin/ts-for-gir`. Update later with:
34
+
35
+ ```bash
36
+ ts-for-gir self-update
37
+ ```
38
+
39
+ ### Install (Node.js)
40
+
41
+ ```bash
26
42
  npx @ts-for-gir/cli --help
27
43
  ```
28
44
 
29
- > Alternatively you can also add @ts-for-gir/cli to your dependencies:
45
+ > Alternatively add `@ts-for-gir/cli` to your dependencies:
30
46
  > ```bash
31
47
  > npm install --save-dev @ts-for-gir/cli
32
48
  > ```
33
49
  >
34
- > Or globally install it:
50
+ > Or install globally:
35
51
  > ```bash
36
52
  > npm install -g @ts-for-gir/cli
37
53
  > ts-for-gir --help
38
54
  > ```
39
55
 
56
+ ### GJS bundle
57
+
58
+ The GJS bundle (`ts-for-gir-gjs`) supports the full TypeScript /
59
+ TypeDoc pipeline thanks to gjsify's runtime-relative `import.meta.url`
60
+ rewrite. All non-interactive commands run natively on GJS:
61
+
62
+ - `ts-for-gir generate` — `.d.ts` generation
63
+ - `ts-for-gir json` — TypeDoc-backed JSON export
64
+ - `ts-for-gir doc` — HTML documentation. TypeDoc's shiki highlighter
65
+ loads the [oniguruma](https://github.com/kkos/oniguruma) regex
66
+ engine via `WebAssembly.compile(...)`. GJS 1.88 (SpiderMonkey 140)
67
+ exposes the synchronous `WebAssembly.{Module,Instance}` constructors
68
+ but ships the Promise APIs as stubs that throw on first call;
69
+ [`@gjsify/webassembly`](https://www.npmjs.com/package/@gjsify/webassembly)
70
+ (gjsify v0.3.6+) wraps the synchronous constructors with
71
+ `Promise.{resolve,reject}` so `compile`/`instantiate` resolve
72
+ natively in the GJS bundle.
73
+ - `ts-for-gir list` / `copy` / `analyze` / `self-update`
74
+
75
+ The only command still gated on Node.js is `create` — its
76
+ [`inquirer`](https://www.npmjs.com/package/inquirer)-based interactive
77
+ prompt cannot run on GJS without a TTY-aware port. Use
78
+ `npx @ts-for-gir/cli create ...` from a Node install for now.
79
+
40
80
  ```
41
81
  TypeScript type definition generator for GObject introspection GIR files
42
82