cddl2ts 0.3.1 → 0.4.1
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/.release-it.ts +14 -0
- package/LICENSE +1 -1
- package/README.md +5 -9
- package/changelogithub.config.ts +6 -0
- package/cli-examples/local.ts +1013 -0
- package/cli-examples/remote.ts +1520 -0
- package/cli-examples/tsconfig.json +12 -0
- package/package.json +18 -34
- package/src/cli.ts +42 -0
- package/src/constants.ts +6 -0
- package/src/index.ts +652 -0
- package/src/utils.ts +61 -0
- package/tests/__snapshots__/group_choice.test.ts.snap +72 -0
- package/tests/__snapshots__/literals.test.ts.snap +8 -0
- package/tests/__snapshots__/mixin_union.test.ts.snap +19 -0
- package/tests/__snapshots__/mod.test.ts.snap +102 -0
- package/tests/__snapshots__/repro_proxy.test.ts.snap +14 -0
- package/tests/__snapshots__/union_extension.test.ts.snap +18 -0
- package/tests/__snapshots__/webdriver_local.test.ts.snap +1017 -0
- package/tests/__snapshots__/webdriver_remote.test.ts.snap +1524 -0
- package/tests/complex_types.test.ts +54 -0
- package/tests/group_choice.test.ts +53 -0
- package/tests/literals.test.ts +45 -0
- package/tests/mixin_union.test.ts +56 -0
- package/tests/mod.test.ts +74 -0
- package/tests/named_group_choice.test.ts +47 -0
- package/tests/transform.test.ts +21 -0
- package/tests/unknown.test.ts +51 -0
- package/tests/webdriver_local.test.ts +43 -0
- package/tests/webdriver_remote.test.ts +43 -0
- package/tsconfig.json +11 -0
package/.release-it.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import baseConfig from '../../.release-it.base';
|
|
2
|
+
import type { Config } from 'release-it';
|
|
3
|
+
|
|
4
|
+
const config: Config = {
|
|
5
|
+
...baseConfig,
|
|
6
|
+
git: {
|
|
7
|
+
...baseConfig.git,
|
|
8
|
+
// Must be overriden by each package to have seperate tags and changelogs
|
|
9
|
+
tagName: "cddl2ts-v${version}",
|
|
10
|
+
commitMessage: "chore(cddl2ts): release v${version}",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default config;
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Christian Bromann
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
CDDL to TypeScript
|
|
1
|
+
CDDL to TypeScript
|
|
2
2
|
==================
|
|
3
3
|
|
|
4
4
|
> A Node.js package that can generate a TypeScript definition based on a CDDL file
|
|
5
5
|
|
|
6
|
-
CDDL expresses Concise Binary Object Representation (CBOR) data structures ([RFC 7049](https://tools.ietf.org/html/rfc7049)). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON. This package allows you to transform a CDDL file into a TypeScript interface that you can use for other TypeScript
|
|
7
|
-
|
|
8
|
-
Related projects:
|
|
9
|
-
- [christian-bromann/cddl](https://github.com/christian-bromann/cddl): parses CDDL into an AST
|
|
6
|
+
CDDL expresses Concise Binary Object Representation (CBOR) data structures ([RFC 7049](https://tools.ietf.org/html/rfc7049)). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON. This package allows you to transform a CDDL file into a TypeScript interface that you can use for other TypeScript projects.
|
|
10
7
|
|
|
11
8
|
## Install
|
|
12
9
|
|
|
@@ -28,11 +25,10 @@ npx cddl2ts ./path/to/interface.cddl &> ./path/to/interface.ts
|
|
|
28
25
|
|
|
29
26
|
### Programmatic Interface
|
|
30
27
|
|
|
31
|
-
The module exports a `transform` method that takes
|
|
28
|
+
The module exports a `transform` method that takes a CDDL AST object and returns a TypeScript definition as `string`, e.g.:
|
|
32
29
|
|
|
33
30
|
```js
|
|
34
|
-
import { parse } from 'cddl'
|
|
35
|
-
import { transform } from 'cddl2ts'
|
|
31
|
+
import { parse, transform } from 'cddl'
|
|
36
32
|
|
|
37
33
|
/**
|
|
38
34
|
* spec.cddl:
|
|
@@ -61,4 +57,4 @@ console.log(ts)
|
|
|
61
57
|
|
|
62
58
|
---
|
|
63
59
|
|
|
64
|
-
If you are interested in this project, please feel free to contribute ideas or code patches. Have a look at our [contributing guidelines](https://github.com/
|
|
60
|
+
If you are interested in this project, please feel free to contribute ideas or code patches. Have a look at our [contributing guidelines](https://github.com/webdriverio/cddl/blob/master/CONTRIBUTING.md) to get started.
|