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

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 +41 -3
  2. package/bin/ts-for-gir +2989 -726
  3. package/bin/ts-for-gir-gjs +348955 -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 +41 -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,59 @@ 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
+ gjs -m https://raw.githubusercontent.com/gjsify/ts-for-gir/main/install.js
29
+ ```
30
+
31
+ Installs `ts-for-gir` to `~/.local/bin/ts-for-gir`. Update later with:
32
+
33
+ ```bash
34
+ ts-for-gir self-update
35
+ ```
36
+
37
+ ### Install (Node.js)
38
+
39
+ ```bash
26
40
  npx @ts-for-gir/cli --help
27
41
  ```
28
42
 
29
- > Alternatively you can also add @ts-for-gir/cli to your dependencies:
43
+ > Alternatively add `@ts-for-gir/cli` to your dependencies:
30
44
  > ```bash
31
45
  > npm install --save-dev @ts-for-gir/cli
32
46
  > ```
33
47
  >
34
- > Or globally install it:
48
+ > Or install globally:
35
49
  > ```bash
36
50
  > npm install -g @ts-for-gir/cli
37
51
  > ts-for-gir --help
38
52
  > ```
39
53
 
54
+ ### GJS bundle
55
+
56
+ The GJS bundle (`ts-for-gir-gjs`) supports the full TypeScript /
57
+ TypeDoc pipeline thanks to gjsify's runtime-relative `import.meta.url`
58
+ rewrite. All non-interactive commands run natively on GJS:
59
+
60
+ - `ts-for-gir generate` — `.d.ts` generation
61
+ - `ts-for-gir json` — TypeDoc-backed JSON export
62
+ - `ts-for-gir doc` — HTML documentation. TypeDoc's shiki highlighter
63
+ loads the [oniguruma](https://github.com/kkos/oniguruma) regex
64
+ engine via `WebAssembly.compile(...)`. GJS 1.88 (SpiderMonkey 140)
65
+ exposes the synchronous `WebAssembly.{Module,Instance}` constructors
66
+ but ships the Promise APIs as stubs that throw on first call;
67
+ [`@gjsify/webassembly`](https://www.npmjs.com/package/@gjsify/webassembly)
68
+ (gjsify v0.3.6+) wraps the synchronous constructors with
69
+ `Promise.{resolve,reject}` so `compile`/`instantiate` resolve
70
+ natively in the GJS bundle.
71
+ - `ts-for-gir list` / `copy` / `analyze` / `self-update`
72
+
73
+ The only command still gated on Node.js is `create` — its
74
+ [`inquirer`](https://www.npmjs.com/package/inquirer)-based interactive
75
+ prompt cannot run on GJS without a TTY-aware port. Use
76
+ `npx @ts-for-gir/cli create ...` from a Node install for now.
77
+
40
78
  ```
41
79
  TypeScript type definition generator for GObject introspection GIR files
42
80