@spec2ts/cli 3.0.4 → 4.0.0
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 +11 -8
- package/bin/spec2ts.mjs +10 -0
- package/package.json +61 -68
- package/bin/spec2ts.d.ts +0 -2
- package/bin/spec2ts.js +0 -14
package/README.md
CHANGED
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
- **AST-based:** Unlike other code generators `@spec2ts/cli` does not use templates to generate code but uses TypeScript's built-in API to generate and pretty-print an abstract syntax tree.
|
|
12
|
+
- **Tree-shakeable:** Individually exported types allows you to bundle only the ones you actually use.
|
|
13
|
+
- **YAML or JSON:** Use YAML or JSON for your specifications.
|
|
14
|
+
- **External references:** Resolves automatically external references and bundle or import them in generated files.
|
|
15
|
+
- **Implementation agnostic:** Use generated types in any projet or framework.
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
Install in your project:
|
|
20
|
+
|
|
20
21
|
```bash
|
|
21
22
|
npm install @spec2ts/cli
|
|
22
23
|
```
|
|
@@ -71,9 +72,11 @@ Options:
|
|
|
71
72
|
## Compatibility Matrix
|
|
72
73
|
|
|
73
74
|
| TypeScript version | spec2ts version |
|
|
74
|
-
|
|
75
|
-
| v3.x.x | v1 |
|
|
76
|
-
| v4.x.x | v2 |
|
|
75
|
+
| ------------------ | --------------- |
|
|
76
|
+
| v3.x.x | v1 |
|
|
77
|
+
| v4.x.x | v2 |
|
|
78
|
+
| v5.x.x | v3 |
|
|
79
|
+
| v6.x.x | v4 |
|
|
77
80
|
|
|
78
81
|
## License
|
|
79
82
|
|
package/bin/spec2ts.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as jsonschema from "@spec2ts/jsonschema/cli";
|
|
3
|
+
import * as openapiClient from "@spec2ts/openapi-client/cli";
|
|
4
|
+
import * as openapi from "@spec2ts/openapi/cli";
|
|
5
|
+
import yargs from "yargs";
|
|
6
|
+
import { hideBin } from "yargs/helpers";
|
|
7
|
+
//#region src/spec2ts.ts
|
|
8
|
+
yargs(hideBin(process.argv)).command(jsonschema.usage.replace("$0", "jsonschema"), jsonschema.describe, jsonschema.builder, jsonschema.handler).command(openapi.usage.replace("$0", "openapi"), openapi.describe, openapi.builder, openapi.handler).command(openapiClient.usage.replace("$0", "openapi-client"), openapiClient.describe, openapiClient.builder, openapiClient.handler).help("help", "Show help usage").demandCommand().argv;
|
|
9
|
+
//#endregion
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,70 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"transpile",
|
|
64
|
-
"interface",
|
|
65
|
-
"typing",
|
|
66
|
-
"spec2ts",
|
|
67
|
-
"share"
|
|
68
|
-
],
|
|
69
|
-
"gitHead": "14819d04dac69a35a06fefd5f553cca4e84eb875"
|
|
2
|
+
"name": "@spec2ts/cli",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Utility to convert specifications (Open API, JSON Schemas) to TypeScript using TypeScript native compiler",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ast",
|
|
7
|
+
"client",
|
|
8
|
+
"compile",
|
|
9
|
+
"compiler",
|
|
10
|
+
"http",
|
|
11
|
+
"interface",
|
|
12
|
+
"json",
|
|
13
|
+
"jsonschema",
|
|
14
|
+
"openapi",
|
|
15
|
+
"openapiv3",
|
|
16
|
+
"rest",
|
|
17
|
+
"schema",
|
|
18
|
+
"share",
|
|
19
|
+
"spec",
|
|
20
|
+
"spec2ts",
|
|
21
|
+
"transpile",
|
|
22
|
+
"typescript",
|
|
23
|
+
"typing"
|
|
24
|
+
],
|
|
25
|
+
"homepage": "https://github.com/touchifyapp/spec2ts/blob/master/packages/cli#readme",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"author": "Touchify <dev@touchify.co>",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/touchifyapp/spec2ts"
|
|
31
|
+
},
|
|
32
|
+
"bin": {
|
|
33
|
+
"spec2ts": "./bin/spec2ts.mjs"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"bin/**/*.mjs"
|
|
37
|
+
],
|
|
38
|
+
"type": "module",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "npm run lint && npm run build:ts",
|
|
44
|
+
"build:ts": "tsdown",
|
|
45
|
+
"test": "npm run lint && npm run format:check && npm run test:vitest",
|
|
46
|
+
"test:prepublish": "npm run lint && npm run test:vitest",
|
|
47
|
+
"test:vitest": "vitest run -c ../../vitest.config.ts --passWithNoTests",
|
|
48
|
+
"test:coverage": "npm run test -- -- --coverage",
|
|
49
|
+
"lint": "npm run lint:ts",
|
|
50
|
+
"lint:ts": "oxlint -c ../../oxlint.config.ts",
|
|
51
|
+
"lint:fix": "npm run lint -- -- --fix",
|
|
52
|
+
"format": "oxfmt -c ../../oxfmt.config.ts",
|
|
53
|
+
"format:check": "oxfmt -c ../../oxfmt.config.ts --check",
|
|
54
|
+
"prepublishOnly": "npm run test:prepublish && npm run build"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@spec2ts/jsonschema": "^4.0.0",
|
|
58
|
+
"@spec2ts/openapi": "^4.0.0",
|
|
59
|
+
"@spec2ts/openapi-client": "^4.0.0",
|
|
60
|
+
"typescript": "^6.0.0",
|
|
61
|
+
"yargs": "^18.0.0"
|
|
62
|
+
}
|
|
70
63
|
}
|
package/bin/spec2ts.d.ts
DELETED
package/bin/spec2ts.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const yargs = require("yargs");
|
|
5
|
-
const jsonschema = require("@spec2ts/jsonschema/cli/command");
|
|
6
|
-
const openapi = require("@spec2ts/openapi/cli/command");
|
|
7
|
-
const openapiClient = require("@spec2ts/openapi-client/cli/command");
|
|
8
|
-
yargs
|
|
9
|
-
.command(jsonschema.usage.replace("$0", "jsonschema"), jsonschema.describe, jsonschema.builder, jsonschema.handler)
|
|
10
|
-
.command(openapi.usage.replace("$0", "openapi"), openapi.describe, openapi.builder, openapi.handler)
|
|
11
|
-
.command(openapiClient.usage.replace("$0", "openapi-client"), openapiClient.describe, openapiClient.builder, openapiClient.handler)
|
|
12
|
-
.help("help", "Show help usage")
|
|
13
|
-
.demandCommand()
|
|
14
|
-
.argv;
|