Skip to content

Commit 2880903

Browse files
fix: revert back to commons js (#1975)
* cjs * run npm pkg fix * lint * feat: eslint in mjs * feat: eslint in mjs v2
1 parent 3dfb59b commit 2880903

File tree

5 files changed

+45
-61
lines changed

5 files changed

+45
-61
lines changed

bin/ts-json-schema-generator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
#!/usr/bin/env node
2-
import("../dist/ts-json-schema-generator.js");
2+
3+
// eslint-disable-next-line @typescript-eslint/no-require-imports
4+
require("../dist/ts-json-schema-generator.js");

eslint.config.js renamed to eslint.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"
66
/** @type {import('@types/eslint').Linter.FlatConfig[]} */
77
export default tseslint.config(
88
{
9-
ignores: ["dist", "cjs", "build"],
9+
ignores: ["dist", "cjs", "build", "eslint.config.mjs"],
1010
},
1111
eslint.configs.recommended,
1212
{
@@ -21,7 +21,7 @@ export default tseslint.config(
2121
],
2222
extends: tseslint.configs.recommendedTypeChecked,
2323
languageOptions: {
24-
sourceType: "module",
24+
sourceType: "commonjs",
2525
parserOptions: {
2626
project: "tsconfig.eslint.json",
2727
tsconfigRootDir: import.meta.dirname,
@@ -71,6 +71,7 @@ export default tseslint.config(
7171
languageOptions: {
7272
globals: {
7373
...globals.jest,
74+
...globals.commonjs,
7475
},
7576
},
7677
},

package.json

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@
22
"name": "ts-json-schema-generator",
33
"version": "2.0.0",
44
"description": "Generate JSON schema from your Typescript sources",
5-
"module": "dist/index.js",
6-
"types": "dist/index.d.ts",
7-
"type": "module",
8-
"bin": {
9-
"ts-json-schema-generator": "./bin/ts-json-schema-generator.js"
10-
},
11-
"files": [
12-
"dist",
13-
"cjs",
14-
"src",
15-
"factory",
16-
"index.*",
17-
"ts-json-schema-generator.*"
5+
"keywords": [
6+
"ts",
7+
"typescript",
8+
"json",
9+
"schema",
10+
"jsonschema"
1811
],
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/vega/ts-json-schema-generator.git"
15+
},
16+
"license": "MIT",
1917
"author": {
2018
"name": "Alexander Evtushenko",
2119
"email": "[email protected]"
@@ -30,24 +28,32 @@
3028
"email": "[email protected]"
3129
}
3230
],
33-
"repository": {
34-
"type": "git",
35-
"url": "https://github.com/vega/ts-json-schema-generator.git"
31+
"type": "commonjs",
32+
"main": "dist/index.js",
33+
"types": "dist/index.d.ts",
34+
"bin": {
35+
"ts-json-schema-generator": "bin/ts-json-schema-generator.js"
3636
},
37-
"license": "MIT",
38-
"keywords": [
39-
"ts",
40-
"typescript",
41-
"json",
42-
"schema",
43-
"jsonschema"
37+
"files": [
38+
"dist",
39+
"src",
40+
"factory",
41+
"index.*",
42+
"ts-json-schema-generator.*"
4443
],
45-
"engines": {
46-
"node": ">=18.0.0"
47-
},
48-
"exports": {
49-
"import": "./dist/index.js",
50-
"require": "./cjs/index.js"
44+
"scripts": {
45+
"build": "tsc",
46+
"debug": "tsx --inspect-brk ts-json-schema-generator.ts",
47+
"format": "eslint --fix",
48+
"lint": "eslint",
49+
"prepublishOnly": "yarn build",
50+
"release": "yarn build && auto shipit",
51+
"run": "tsx ts-json-schema-generator.ts",
52+
"test": "jest test/ --verbose",
53+
"test:coverage": "yarn jest test/ --collectCoverage=true",
54+
"test:fast": "cross-env FAST_TEST=1 jest test/ --verbose",
55+
"test:update": "cross-env UPDATE_SCHEMA=true yarn test:fast",
56+
"watch": "tsc -w"
5157
},
5258
"dependencies": {
5359
"@types/json-schema": "^7.0.15",
@@ -87,20 +93,7 @@
8793
"vega": "^5.28.0",
8894
"vega-lite": "^5.18.0"
8995
},
90-
"scripts": {
91-
"prepublishOnly": "yarn build",
92-
"build": "npm run build:cjs && npm run build:esm",
93-
"build:cjs": "tsc -p tsconfig.cjs.json",
94-
"build:esm": "tsc -p tsconfig.json",
95-
"watch": "tsc -w",
96-
"lint": "eslint",
97-
"format": "eslint --fix",
98-
"test": "jest test/ --verbose",
99-
"test:fast": "cross-env FAST_TEST=1 jest test/ --verbose",
100-
"test:coverage": "yarn jest test/ --collectCoverage=true",
101-
"test:update": "cross-env UPDATE_SCHEMA=true yarn test:fast",
102-
"debug": "tsx --inspect-brk ts-json-schema-generator.ts",
103-
"run": "tsx ts-json-schema-generator.ts",
104-
"release": "yarn build && auto shipit"
96+
"engines": {
97+
"node": ">=18.0.0"
10598
}
10699
}

tsconfig.cjs.json

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

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"compilerOptions": {
33
"target": "ES2022",
4-
"module": "NodeNext",
5-
"moduleResolution": "Node16",
4+
"module": "CommonJS",
5+
"moduleResolution": "Node",
66
"esModuleInterop": true,
77
"isolatedModules": false,
88
"experimentalDecorators": true,

0 commit comments

Comments
 (0)