Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: ESM + CJS dual support #552

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {writeFileSync} from 'fs'
import {compileFromFile} from 'json-schema-to-typescript'
import {writeFileSync} from 'node:fs'
import {compileFromFile} from '@kickstartds/json-schema-to-typescript'

async function generate() {
writeFileSync('person.d.ts', await compileFromFile('person.json'))
Expand Down
12 changes: 8 additions & 4 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
"description": "",
"main": "index.js",
"typings": "index.d.ts",
"type": "module",
"scripts": {
"build": "npm run clean && tsc && node index.js",
"clean": "rm -f index.js index.d.ts person.d.ts"
"clean": "rm -f index.js index.d.ts person.d.ts",
"postinstall": "patch-package"
},
"dependencies": {
"@types/node": "^13.13.4",
"typescript": "3.8.3",
"json-schema-to-typescript": "9.0.0"
"@kickstartds/json-schema-to-typescript": "^13.1.5",
"@types/node": "^17.0.33",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"typescript": "^4.9.5"
},
"repository": {
"type": "git",
Expand Down
12 changes: 12 additions & 0 deletions example/patches/@bcherny+json-schema-ref-parser+10.0.5-fork.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/node_modules/@bcherny/json-schema-ref-parser/lib/index.d.ts b/node_modules/@bcherny/json-schema-ref-parser/lib/index.d.ts
index a62a8fd..1f98f80 100644
--- a/node_modules/@bcherny/json-schema-ref-parser/lib/index.d.ts
+++ b/node_modules/@bcherny/json-schema-ref-parser/lib/index.d.ts
@@ -1,6 +1,6 @@
import { JSONSchema4, JSONSchema4Object, JSONSchema4Type, JSONSchema6, JSONSchema6Object, JSONSchema6Type, JSONSchema7, JSONSchema7Object, JSONSchema7Type } from "json-schema";

-export = $RefParser;
+export default $RefParser;

/**
* This is the default export of JSON Schema $Ref Parser. You can creates instances of this class using new $RefParser(), or you can just call its static methods.
17 changes: 0 additions & 17 deletions example/person.d.ts

This file was deleted.

8 changes: 4 additions & 4 deletions example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"lib": [
"es2015"
],
"module": "commonjs",
"moduleResolution": "node",
"module": "node16",
"moduleResolution": "node16",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noUnusedLocals": true,
Expand All @@ -14,9 +14,9 @@
"preserveConstEnums": true,
"sourceMap": true,
"strictNullChecks": true,
"target": "es2016"
"target": "esnext"
},
"files": [
"./index.ts"
]
}
}
Loading