skir 1.0.21 β 1.0.22
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 +51 -29
- package/dist/project_initializer.js +11 -11
- package/package.json +1 -1
- package/src/project_initializer.ts +11 -11
package/README.md
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>Skir</h1>
|
|
3
|
+
<p><strong>Like Protocol Buffer, but better.</strong></p>
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/skir)
|
|
6
|
+
[](https://github.com/gepheum/skir/actions)
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+

|
|
9
|
+
</div>
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+
<br />
|
|
12
|
+
|
|
13
|
+
**Skir** is a universal language for representing data types, constants, and RPC interfaces. Define your schema once in a `.skir` file and generate idiomatic, type-safe code in TypeScript, Python, Java, C++, and more.
|
|
14
|
+
|
|
15
|
+
## β¨ Features
|
|
16
|
+
|
|
17
|
+
- π **Single source of truth** - Define your data types once and share them between your backend, frontend, and microservices.
|
|
18
|
+
- π **Multi-language** - First-class support for TypeScript, Python, C++, Java, Kotlin, and Dart.
|
|
19
|
+
- βοΈ **Idiomatic code gen** - Generates code that feels native to each language.
|
|
20
|
+
- π **Effortless serialization** - Skir generates functions to serialize your data to JSON or binary, so you never have to write parsing code manually.
|
|
21
|
+
- π¦ **Schema evolution** - Simple guidelines and built-in checks to evolve your schema without breaking backward compatibility.
|
|
22
|
+
- π€ **RPC interfaces** - Define the interface between your frontend and your backend or your microservices, enjoy end-to-end type safety.
|
|
23
|
+
- π οΈ **Climactic developer experience** - Automatic recompilation in watch mode, built-in code formatter, official VSCode extension.
|
|
24
|
+
- π¦ **Built-in package manager** - Import types from other GitHub repositories to easily share common data structures across projects.
|
|
25
|
+
- π **Easy setup** - Get started with `npx skir init`, manage your entire project configuration from a single YAML file.
|
|
26
|
+
|
|
27
|
+
## β‘ Syntax example
|
|
9
28
|
|
|
10
29
|
```d
|
|
11
30
|
// shapes.skir
|
|
@@ -32,36 +51,39 @@ const TOP_RIGHT_CORNER: Point = {
|
|
|
32
51
|
method IsConvex(Shape): bool = 12345;
|
|
33
52
|
```
|
|
34
53
|
|
|
35
|
-
|
|
54
|
+
Skir compiles these definitions into native, type-safe code you can use in your project:
|
|
36
55
|
|
|
37
56
|
```python
|
|
38
57
|
# my_project.py
|
|
39
58
|
|
|
40
|
-
from skirout.shapes_skir import Point #
|
|
59
|
+
from skirout.shapes_skir import Point # Python module generated by Skir
|
|
41
60
|
|
|
42
61
|
point = Point(x=3, y=4, label="P")
|
|
43
|
-
point_json = Point.serializer.to_json(point)
|
|
44
|
-
assert(Point.serializer.from_json(json) == point)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Documentation
|
|
48
|
-
|
|
49
|
-
1. [Why Skir?](docs/introduction.md)
|
|
50
|
-
2. [Getting started: setup & workflow](docs/setup.md)
|
|
51
|
-
3. [Language reference](docs/language-reference.md)
|
|
52
|
-
4. [Serialization formats](docs/serialization.md)
|
|
53
|
-
5. [Schema evolution & compatibility](docs/compatibility.md)
|
|
54
|
-
6. [Typesafe RPC interfaces](docs/services.md)
|
|
55
|
-
7. [External dependencies](docs/dependencies.md)
|
|
56
|
-
8. [Comparisons](docs/comparisons.md)
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
# Roundβtrip serialization to JSON
|
|
64
|
+
point_json = Point.serializer.to_json(point)
|
|
65
|
+
restored = Point.serializer.from_json(point_json)
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* C++: [documentation](https://github.com/gepheum/skir-cc-gen), [example](https://github.com/gepheum/skir-cc-example)
|
|
63
|
-
* Java: [documentation](https://github.com/gepheum/skir-java-gen), [example](https://github.com/gepheum/skir-java-example)
|
|
64
|
-
* Kotlin: [documentation](https://github.com/gepheum/skir-kotlin-gen), [example](https://github.com/gepheum/skir-kotlin-example)
|
|
65
|
-
* Dart: [documentation](https://github.com/gepheum/skir-dart-gen), [example](https://github.com/gepheum/skir-dart-example)
|
|
67
|
+
assert(restored == point)
|
|
68
|
+
```
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
## π Documentation
|
|
71
|
+
|
|
72
|
+
- [Getting started: setup & workflow](docs/setup.md)
|
|
73
|
+
- [Language reference](docs/language-reference.md)
|
|
74
|
+
- [Serialization formats](docs/serialization.md)
|
|
75
|
+
- [Schema evolution & compatibility](docs/compatibility.md)
|
|
76
|
+
- [Typesafe RPC interfaces](docs/services.md)
|
|
77
|
+
- [External dependencies](docs/dependencies.md)
|
|
78
|
+
- [Coming from Protocol Buffer](docs/coming_from_protobuf.md)
|
|
79
|
+
|
|
80
|
+
## π Supported languages
|
|
81
|
+
|
|
82
|
+
| Language | Documentation | Example |
|
|
83
|
+
| :--- | :--- | :--- |
|
|
84
|
+
| π¦ **TypeScript** | [Documentation](https://github.com/gepheum/skir-typescript-gen) | [Example](https://github.com/gepheum/skir-typescript-example) |
|
|
85
|
+
| π **Python** | [Documentation](https://github.com/gepheum/skir-python-gen) | [Example](https://github.com/gepheum/skir-python-example) |
|
|
86
|
+
| β‘ **C++** | [Documentation](https://github.com/gepheum/skir-cc-gen) | [Example](https://github.com/gepheum/skir-cc-example) |
|
|
87
|
+
| β **Java** | [Documentation](https://github.com/gepheum/skir-java-gen) | [Example](https://github.com/gepheum/skir-java-example) |
|
|
88
|
+
| π **Kotlin** | [Documentation](https://github.com/gepheum/skir-kotlin-gen) | [Example](https://github.com/gepheum/skir-kotlin-example) |
|
|
89
|
+
| π― **Dart** | [Documentation](https://github.com/gepheum/skir-dart-gen) | [Example](https://github.com/gepheum/skir-dart-example) |
|
|
@@ -118,26 +118,26 @@ generators:
|
|
|
118
118
|
# # To install runtime dependencies: npm i skir-client
|
|
119
119
|
# # --------------------------------------------------------------------------
|
|
120
120
|
# - mod: skir-typescript-gen
|
|
121
|
-
# outDir: ./
|
|
121
|
+
# outDir: ./skirout
|
|
122
122
|
# config:
|
|
123
123
|
# # Use ".js" for ES modules, "" for CommonJS
|
|
124
124
|
# importPathExtension: ".js"
|
|
125
125
|
|
|
126
|
-
# --------------------------------------------------------------------------
|
|
127
|
-
# External Skir dependencies hosted on GitHub
|
|
128
|
-
# To use an external repository, specify the GitHub repository identifier
|
|
129
|
-
# in the format "@owner/repository-name" and the release tag version.
|
|
130
|
-
# --------------------------------------------------------------------------
|
|
126
|
+
# # --------------------------------------------------------------------------
|
|
127
|
+
# # External Skir dependencies hosted on GitHub
|
|
128
|
+
# # To use an external repository, specify the GitHub repository identifier
|
|
129
|
+
# # in the format "@owner/repository-name" and the release tag version.
|
|
130
|
+
# # --------------------------------------------------------------------------
|
|
131
131
|
# dependencies:
|
|
132
132
|
# # Add a dependency to:
|
|
133
133
|
# # https://github.com/gepheum/fantasy-game-skir-example/tree/v1.0.0
|
|
134
134
|
# "@gepheum/fantasy-game-skir-example": v1.0.0
|
|
135
135
|
|
|
136
|
-
# --------------------------------------------------------------------------
|
|
137
|
-
# GitHub Personal Access Token (required for private dependencies)
|
|
138
|
-
# Set this to the name of an environment variable containing your GitHub
|
|
139
|
-
# token. The token is used to authenticate when downloading dependencies.
|
|
140
|
-
# --------------------------------------------------------------------------
|
|
136
|
+
# # --------------------------------------------------------------------------
|
|
137
|
+
# # GitHub Personal Access Token (required for private dependencies)
|
|
138
|
+
# # Set this to the name of an environment variable containing your GitHub
|
|
139
|
+
# # token. The token is used to authenticate when downloading dependencies.
|
|
140
|
+
# # --------------------------------------------------------------------------
|
|
141
141
|
# githubTokenEnvVar: GITHUB_TOKEN
|
|
142
142
|
`;
|
|
143
143
|
const HELLO_WORLD_SKIR_CONTENT = `/// A point in 2D space.
|
package/package.json
CHANGED
|
@@ -132,26 +132,26 @@ generators:
|
|
|
132
132
|
# # To install runtime dependencies: npm i skir-client
|
|
133
133
|
# # --------------------------------------------------------------------------
|
|
134
134
|
# - mod: skir-typescript-gen
|
|
135
|
-
# outDir: ./
|
|
135
|
+
# outDir: ./skirout
|
|
136
136
|
# config:
|
|
137
137
|
# # Use ".js" for ES modules, "" for CommonJS
|
|
138
138
|
# importPathExtension: ".js"
|
|
139
139
|
|
|
140
|
-
# --------------------------------------------------------------------------
|
|
141
|
-
# External Skir dependencies hosted on GitHub
|
|
142
|
-
# To use an external repository, specify the GitHub repository identifier
|
|
143
|
-
# in the format "@owner/repository-name" and the release tag version.
|
|
144
|
-
# --------------------------------------------------------------------------
|
|
140
|
+
# # --------------------------------------------------------------------------
|
|
141
|
+
# # External Skir dependencies hosted on GitHub
|
|
142
|
+
# # To use an external repository, specify the GitHub repository identifier
|
|
143
|
+
# # in the format "@owner/repository-name" and the release tag version.
|
|
144
|
+
# # --------------------------------------------------------------------------
|
|
145
145
|
# dependencies:
|
|
146
146
|
# # Add a dependency to:
|
|
147
147
|
# # https://github.com/gepheum/fantasy-game-skir-example/tree/v1.0.0
|
|
148
148
|
# "@gepheum/fantasy-game-skir-example": v1.0.0
|
|
149
149
|
|
|
150
|
-
# --------------------------------------------------------------------------
|
|
151
|
-
# GitHub Personal Access Token (required for private dependencies)
|
|
152
|
-
# Set this to the name of an environment variable containing your GitHub
|
|
153
|
-
# token. The token is used to authenticate when downloading dependencies.
|
|
154
|
-
# --------------------------------------------------------------------------
|
|
150
|
+
# # --------------------------------------------------------------------------
|
|
151
|
+
# # GitHub Personal Access Token (required for private dependencies)
|
|
152
|
+
# # Set this to the name of an environment variable containing your GitHub
|
|
153
|
+
# # token. The token is used to authenticate when downloading dependencies.
|
|
154
|
+
# # --------------------------------------------------------------------------
|
|
155
155
|
# githubTokenEnvVar: GITHUB_TOKEN
|
|
156
156
|
`;
|
|
157
157
|
|