Skip to content

Commit 9614a30

Browse files
committed
chore: fork v16.0.0 - update dependencies
- Update dependencies to resolve deprecation warnings - Migrate from .eslintrc to eslint.config.mjs - Remove browser bundle support (browserify) - Update example package - Update meta info BREAKING CHANGE: Removed browser bundle support
1 parent 43ba08b commit 9614a30

26 files changed

+1696
-4127
lines changed

.eslintrc.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3-
*Note: This is a partial changelog, covering significant & breaking changes. For a full list of changes, please consult the [commit log](https://github.com/bcherny/json-schema-to-typescript/commits).
3+
*Note: This fork contains the original project with updated dependencies. For the original project's history, see [bcherny/json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript).*
4+
5+
## 16.0.0
6+
7+
- 🔧 Updated dependencies to resolve deprecation warnings
8+
- ⚠️ Migrated from `.eslintrc` to `eslint.config.mjs`
9+
- 💥 Removed browser bundle support (`browserify`)
410

511
## 15.0.0
612

File renamed without changes.

README.md

Lines changed: 18 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
# json-schema-to-typescript [![Build Status][build]](https://github.com/bcherny/json-schema-to-typescript/actions?query=branch%3Amaster+workflow%3ACI) [![npm]](https://www.npmjs.com/package/json-schema-to-typescript) [![mit]](https://opensource.org/licenses/MIT) ![node]
2-
3-
[build]: https://img.shields.io/github/actions/workflow/status/bcherny/json-schema-to-typescript/ci.yml?style=flat-square
4-
[npm]: https://img.shields.io/npm/v/json-schema-to-typescript.svg?style=flat-square
5-
[mit]: https://img.shields.io/npm/l/json-schema-to-typescript.svg?style=flat-square
6-
[node]: https://img.shields.io/badge/Node.js-16+-417e37?style=flat-square
1+
# json-schema-to-typescript [![mit]](https://opensource.org/licenses/MIT) ![node]
72

83
> Compile JSON Schema to TypeScript typings.
94
10-
## Example
5+
## 🔧 Fork Notice
6+
7+
This is a fork of the original [json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript) with the following updates:
118

12-
Check out the [live demo](https://borischerny.com/json-schema-to-typescript-browser/).
9+
- Updated dependencies to remove deprecation warnings
10+
- Removed browser bundle support (`browserify`)
11+
- Replaced `.eslintrc` with `.eslint.config.mjs`
12+
13+
## Example
1314

1415
Input:
1516

@@ -53,10 +54,14 @@ export interface ExampleSchema {
5354
}
5455
```
5556

57+
## Requirements
58+
59+
- Node.js >= 16.0.0
60+
5661
## Installation
5762

5863
```sh
59-
npm install json-schema-to-typescript
64+
npm install github:Sideboard/json-schema-to-typescript
6065
```
6166

6267
## Usage
@@ -69,13 +74,13 @@ First make the CLI available using one of the following options:
6974

7075
```sh
7176
# install locally, then use `npx json2ts`
72-
npm install json-schema-to-typescript
77+
npm install github:Sideboard/json-schema-to-typescript
7378

7479
# or install globally, then use `json2ts`
75-
npm install json-schema-to-typescript --global
80+
npm install github:Sideboard/json-schema-to-typescript --global
7681

77-
# or install to npm cache, then use `npx --package=json-schema-to-typescript json2ts`
78-
# (you don't need to run an install command first)
82+
# or use directly with npx (no install needed)
83+
npx github:Sideboard/json-schema-to-typescript json2ts
7984
```
8085

8186
Then, use the CLI to convert JSON files to TypeScript typings:
@@ -124,8 +129,6 @@ compile(mySchema, 'MySchema')
124129
.then(ts => ...)
125130
```
126131

127-
See [server demo](example) and [browser demo](https://github.com/bcherny/json-schema-to-typescript-browser) for full examples.
128-
129132
## Options
130133

131134
`compileFromFile` and `compile` accept options as their last argument (all keys are optional):
@@ -154,45 +157,6 @@ See [server demo](example) and [browser demo](https://github.com/bcherny/json-sc
154157
$ npm test
155158
```
156159

157-
## Features
158-
159-
- [x] `title` => `interface`
160-
- [x] Primitive types:
161-
- [x] array
162-
- [x] homogeneous array
163-
- [x] boolean
164-
- [x] integer
165-
- [x] number
166-
- [x] null
167-
- [x] object
168-
- [x] string
169-
- [x] homogeneous enum
170-
- [x] heterogeneous enum
171-
- [x] Non/extensible interfaces
172-
- [ ] Custom JSON-schema extensions
173-
- [x] Nested properties
174-
- [x] Schema definitions
175-
- [x] [Schema references](http://json-schema.org/latest/json-schema-core.html#rfc.section.7.2.2)
176-
- [x] Local (filesystem) schema references
177-
- [x] External (network) schema references
178-
- [x] Add support for running in browser
179-
- [x] default interface name
180-
- [x] infer unnamed interface name from filename
181-
- [x] `deprecated`
182-
- [x] `allOf` ("intersection")
183-
- [x] `anyOf` ("union")
184-
- [x] `oneOf` (treated like `anyOf`)
185-
- [x] `maxItems` ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L166))
186-
- [x] `minItems` ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L165))
187-
- [x] `additionalProperties` of type
188-
- [x] `patternProperties` (partial support)
189-
- [x] [`extends`](https://github.com/json-schema/json-schema/wiki/Extends/014e3cd8692250baad70c361dd81f6119ad0f696)
190-
- [x] `required` properties on objects ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L130))
191-
- [ ] `validateRequired` ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L124))
192-
- [x] literal objects in enum ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L236))
193-
- [x] referencing schema by id ([eg](https://github.com/tdegrunt/jsonschema/blob/67c0e27ce9542efde0bf43dc1b2a95dd87df43c3/examples/all.js#L331))
194-
- [x] custom typescript types via `tsType`
195-
196160
## Custom schema properties:
197161

198162
- `tsType`: Overrides the type that's generated from the schema. Useful for forcing a type to `any` or when using non-standard JSON schema extensions ([eg](https://github.com/sokra/json-schema-to-typescript/blob/f1f40307cf5efa328522bb1c9ae0b0d9e5f367aa/test/e2e/customType.ts)).
@@ -226,17 +190,3 @@ Prettier is known to run slowly on really big files. To skip formatting and impr
226190
- JSON-schema test suite: https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node
227191
- TypeScript spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md
228192

229-
## Who uses JSON-Schema-to-TypeScript?
230-
231-
- [Alibaba](https://github.com/alibaba/lowcode-engine)
232-
- [Amazon](https://github.com/aws/aws-toolkit-vscode), [AWSLabs](https://github.com/awslabs/cdk8s)
233-
- [Expo](https://github.com/expo/expo)
234-
- [FormatJS](https://github.com/formatjs/formatjs)
235-
- [Microsoft](https://github.com/microsoft/mixed-reality-extension-sdk)
236-
- [Mozilla](https://github.com/mdn/browser-compat-data)
237-
- [Nx](https://github.com/nrwl/nx)
238-
- [RStudio](https://github.com/rstudio/rstudio)
239-
- [Sourcegraph](https://github.com/sourcegraph/sourcegraph)
240-
- [Stryker](https://github.com/stryker-mutator/stryker)
241-
- [Webpack](https://github.com/webpack/webpack)
242-
- [See more](https://github.com/bcherny/json-schema-to-typescript/network/dependents?package_id=UGFja2FnZS0xNjUxOTM5Mg%3D%3D)

eslint.config.mjs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { defineConfig } from "eslint/config";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import tsParser from "@typescript-eslint/parser";
4+
import path from "node:path";
5+
import { fileURLToPath } from "node:url";
6+
import js from "@eslint/js";
7+
import { FlatCompat } from "@eslint/eslintrc";
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all
15+
});
16+
17+
export default defineConfig([{
18+
files: ["src/**/*.ts", "test/**/*.ts"],
19+
20+
extends: compat.extends("prettier", "plugin:prettier/recommended"),
21+
22+
plugins: {
23+
"@typescript-eslint": typescriptEslint,
24+
},
25+
26+
languageOptions: {
27+
parser: tsParser,
28+
ecmaVersion: 2020,
29+
sourceType: "module",
30+
parserOptions: {
31+
project: "./tsconfig.json",
32+
},
33+
},
34+
35+
rules: {
36+
"camelcase": "off",
37+
"@typescript-eslint/adjacent-overload-signatures": "error",
38+
"@typescript-eslint/consistent-type-assertions": "error",
39+
"@typescript-eslint/naming-convention": "off",
40+
"no-array-constructor": "off",
41+
"@typescript-eslint/no-array-constructor": "error",
42+
"no-empty-function": "off",
43+
"@typescript-eslint/no-empty-function": "error",
44+
"@typescript-eslint/no-empty-interface": "error",
45+
"@typescript-eslint/no-inferrable-types": "error",
46+
"@typescript-eslint/no-misused-new": "error",
47+
"@typescript-eslint/no-namespace": "error",
48+
"@typescript-eslint/no-this-alias": "error",
49+
"no-unused-vars": "off",
50+
"@typescript-eslint/no-unused-vars": "warn",
51+
"no-var": "error",
52+
"prefer-const": "error",
53+
"prefer-rest-params": "error",
54+
"prefer-spread": "error",
55+
},
56+
}]);

example/package-lock.json

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-schema-to-typescript-example",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "",
55
"main": "index.js",
66
"typings": "index.d.ts",
@@ -9,18 +9,21 @@
99
"clean": "rm -f index.js index.d.ts person.d.ts"
1010
},
1111
"dependencies": {
12-
"@types/node": "^13.13.4",
13-
"typescript": "3.8.3",
14-
"json-schema-to-typescript": "9.0.0"
12+
"@types/node": "^20.19.27",
13+
"json-schema-to-typescript": "file:..",
14+
"typescript": "^5.9.3"
1515
},
1616
"repository": {
1717
"type": "git",
18-
"url": "git+https://github.com/bcherny/json-schema-to-typescript.git"
18+
"url": "git+https://github.com/Sideboard/json-schema-to-typescript.git"
1919
},
2020
"author": "Boris Cherny <boris@performancejs.com> (http://performancejs.com/)",
21+
"contributors": [
22+
"Sascha Klawohn <sascha.klawohn@physik.hu-berlin.de>"
23+
],
2124
"license": "MIT",
2225
"bugs": {
23-
"url": "https://github.com/bcherny/json-schema-to-typescript/issues"
26+
"url": "https://github.com/Sideboard/json-schema-to-typescript/issues"
2427
},
25-
"homepage": "https://github.com/bcherny/json-schema-to-typescript#readme"
28+
"homepage": "https://github.com/Sideboard/json-schema-to-typescript#readme"
2629
}

0 commit comments

Comments
 (0)