@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 CHANGED
@@ -8,15 +8,16 @@
8
8
 
9
9
  ## Features
10
10
 
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.
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
 
@@ -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
- "name": "@spec2ts/cli",
3
- "version": "3.0.4",
4
- "description": "Utility to convert specifications (Open API, JSON Schemas) to TypeScript using TypeScript native compiler",
5
- "author": "Touchify <dev@touchify.co>",
6
- "license": "MIT",
7
- "main": "index.js",
8
- "homepage": "https://github.com/touchifyapp/spec2ts/blob/master/packages/cli#readme",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/touchifyapp/spec2ts"
12
- },
13
- "publishConfig": {
14
- "access": "public"
15
- },
16
- "bin": {
17
- "spec2ts": "./bin/spec2ts.js"
18
- },
19
- "files": [
20
- "*.js",
21
- "*.d.ts",
22
- "bin/**/*.js",
23
- "bin/**/*.d.ts"
24
- ],
25
- "scripts": {
26
- "build": "npm run clean && npm run lint && npm run build:ts",
27
- "build:ts": "tsc -p .",
28
- "test": "npm run clean && npm run lint && npm run test:jest",
29
- "test:jest": "jest -c ../../jest.config.js --rootDir . --passWithNoTests",
30
- "test:coverage": "npm run test -- -- --coverage",
31
- "lint": "npm run lint:ts",
32
- "lint:ts": "eslint 'bin/**/*.ts'",
33
- "lint:fix": "npm run lint -- -- --fix",
34
- "clean": "npm run clean:ts",
35
- "clean:ts": "del '*.{js,d.ts}' 'bin/**/*.{js,d.ts}'",
36
- "prepublishOnly": "npm test && npm run build"
37
- },
38
- "dependencies": {
39
- "@spec2ts/jsonschema": "^3.0.4",
40
- "@spec2ts/openapi": "^3.1.2",
41
- "@spec2ts/openapi-client": "^3.1.2"
42
- },
43
- "devDependencies": {
44
- "del-cli": "^5.1.0",
45
- "eslint": "^8.49.0",
46
- "jest": "^29.6.4",
47
- "typescript": "^5.2.2"
48
- },
49
- "keywords": [
50
- "spec",
51
- "jsonschema",
52
- "json",
53
- "schema",
54
- "openapi",
55
- "openapiv3",
56
- "typescript",
57
- "compile",
58
- "compiler",
59
- "client",
60
- "http",
61
- "rest",
62
- "ast",
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
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
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;