@typra/emitter 0.2.2 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +64 -10
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,51 @@
1
1
  # @typra/emitter
2
2
 
3
- Generic TypeSpec emitter for generating multi-runtime model, protocol, test,
4
- JSON AST, and documentation surfaces from TypeSpec.
3
+ `@typra/emitter` generates runtime model surfaces from TypeSpec. Use it when
4
+ you want TypeSpec to be the source of truth for shared model contracts and need
5
+ generated code, tests, JSON AST output, or documentation for one or more
6
+ runtimes.
7
+
8
+ Typra is emitter-only: it generates model/protocol surfaces, but it does not
9
+ ship runtime service implementations or product-specific contracts.
5
10
 
6
11
  ## Install
7
12
 
8
13
  ```powershell
9
- npm install --save-dev @typra/emitter
14
+ npm install --save-dev @typra/emitter @typespec/compiler
15
+ ```
16
+
17
+ ## Configure TypeSpec
18
+
19
+ Add the emitter to `tspconfig.yaml`:
20
+
21
+ ```yaml
22
+ emit:
23
+ - "@typra/emitter"
24
+
25
+ options:
26
+ "@typra/emitter":
27
+ emitter-output-dir: "{cwd}/generated"
28
+ root-object: "MyProject.ApiRoot"
29
+ root-namespace: "MyProject"
30
+ emit-targets:
31
+ - type: TypeScript
32
+ output-dir: "generated/typescript"
33
+ test-dir: "generated/typescript/tests"
34
+ import-path: "../index"
35
+ ```
36
+
37
+ Import the emitter library from your TypeSpec entry point:
38
+
39
+ ```typespec
40
+ import "@typra/emitter";
41
+
42
+ namespace MyProject;
43
+ ```
44
+
45
+ Compile with TypeSpec:
46
+
47
+ ```powershell
48
+ npx tsp compile ./path/to/main.tsp --config ./tspconfig.yaml
10
49
  ```
11
50
 
12
51
  ## CLI
@@ -17,14 +56,29 @@ The package includes the `typra-generate` command:
17
56
  npx typra-generate --help
18
57
  ```
19
58
 
20
- ## TypeSpec emitter
59
+ ## Supported output
60
+
61
+ Typra includes emitters for:
62
+
63
+ - TypeScript
64
+ - Python
65
+ - C#
66
+ - Go
67
+ - Rust
68
+ - Markdown documentation
69
+ - JSON AST
21
70
 
22
- Use `@typra/emitter` from TypeSpec configuration to generate runtime surfaces.
23
71
  The first Typra fixture slice validates TypeScript and JSON AST generation from
24
- synthetic TypeSpec shapes.
72
+ synthetic TypeSpec shapes. Additional fixture coverage will expand as the
73
+ extracted emitter hardens.
74
+
75
+ ## Generated files
76
+
77
+ Generated source files include Typra markers, and the emitter records a
78
+ generated-file manifest for each output root. Stale-file deletion is not enabled
79
+ yet, so Typra will not remove hand-authored runtime files.
25
80
 
26
- ## Publishing
81
+ ## Links
27
82
 
28
- This package is published from GitHub Actions using npm Trusted
29
- Publishing/OIDC. Do not use an `NPM_TOKEN` secret for the trusted-publishing
30
- path.
83
+ - Repository: <https://github.com/sethjuarez/typra>
84
+ - Package: <https://www.npmjs.com/package/@typra/emitter>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typra/emitter",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Generic TypeSpec emitter for generating multi-runtime model surfaces",
5
5
  "license": "MIT",
6
6
  "repository": {