@goldstack/utils-json-to-ts 0.4.34 → 0.4.36
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 +26 -0
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
[](https://badge.fury.io/js/%40goldstack%2Futils-json-to-ts)
|
|
2
|
+
|
|
1
3
|
# JSON to TS Utilities
|
|
2
4
|
|
|
3
5
|
This library contains a simple wrapper around [json-schema-to-typescript](https://www.npmjs.com/package/json-schema-to-typescript) for use in Goldstack templates.
|
|
4
6
|
|
|
5
7
|
This approach is deprecated in favour of generating JSON schema from TypeScript.
|
|
8
|
+
|
|
9
|
+
This utility has been developed for the [Goldstack](https://goldstack.party) starter project builder. Check it out for starting your next project ❤️
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @goldstack/utils-json-to-ts
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
const schema = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: {
|
|
22
|
+
name: { type: "string" }
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
```typescript
|
|
27
|
+
import { convertJsonToTs } from '@goldstack/utils-json-to-ts';
|
|
28
|
+
|
|
29
|
+
const tsCode = await convertJsonToTs(schema);
|
|
30
|
+
|
|
31
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goldstack/utils-json-to-ts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.36",
|
|
4
4
|
"description": "Utility to convert JSON schema into TypeScript interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goldstack",
|
|
@@ -32,19 +32,18 @@
|
|
|
32
32
|
"compile-watch:light": "nodemon --watch ./src/ -e '*' --exec 'yarn compile'",
|
|
33
33
|
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js --runInBand",
|
|
34
34
|
"prepublishOnly": "yarn run build",
|
|
35
|
-
"publish": "
|
|
35
|
+
"publish": "yarn npm publish --tolerate-republish",
|
|
36
36
|
"test": "jest --passWithNoTests --config=./jest.config.js --runInBand",
|
|
37
|
-
"version:apply": "
|
|
37
|
+
"version:apply": "yarn version $@ && yarn version apply",
|
|
38
38
|
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@goldstack/utils-log": "0.3.
|
|
42
|
-
"@goldstack/utils-sh": "0.5.
|
|
41
|
+
"@goldstack/utils-log": "0.3.31",
|
|
42
|
+
"@goldstack/utils-sh": "0.5.36",
|
|
43
43
|
"json-schema-to-typescript": "^9.1.1",
|
|
44
44
|
"replace-ext": "^2.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@goldstack/utils-git": "0.2.22",
|
|
48
47
|
"@swc/core": "^1.15.8",
|
|
49
48
|
"@swc/jest": "^0.2.39",
|
|
50
49
|
"@types/jest": "^30.0.0",
|