Skip to content

Commit

Permalink
fix: revert back to commons js (#1975)
Browse files Browse the repository at this point in the history
* cjs

* run npm pkg fix

* lint

* feat: eslint in mjs

* feat: eslint in mjs v2
  • Loading branch information
arthurfiorette authored May 27, 2024
1 parent 3dfb59b commit 2880903
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 61 deletions.
4 changes: 3 additions & 1 deletion bin/ts-json-schema-generator.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env node
import("../dist/ts-json-schema-generator.js");

// eslint-disable-next-line @typescript-eslint/no-require-imports
require("../dist/ts-json-schema-generator.js");
5 changes: 3 additions & 2 deletions eslint.config.js → eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"
/** @type {import('@types/eslint').Linter.FlatConfig[]} */
export default tseslint.config(
{
ignores: ["dist", "cjs", "build"],
ignores: ["dist", "cjs", "build", "eslint.config.mjs"],
},
eslint.configs.recommended,
{
Expand All @@ -21,7 +21,7 @@ export default tseslint.config(
],
extends: tseslint.configs.recommendedTypeChecked,
languageOptions: {
sourceType: "module",
sourceType: "commonjs",
parserOptions: {
project: "tsconfig.eslint.json",
tsconfigRootDir: import.meta.dirname,
Expand Down Expand Up @@ -71,6 +71,7 @@ export default tseslint.config(
languageOptions: {
globals: {
...globals.jest,
...globals.commonjs,
},
},
},
Expand Down
81 changes: 37 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
"name": "ts-json-schema-generator",
"version": "2.0.0",
"description": "Generate JSON schema from your Typescript sources",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"bin": {
"ts-json-schema-generator": "./bin/ts-json-schema-generator.js"
},
"files": [
"dist",
"cjs",
"src",
"factory",
"index.*",
"ts-json-schema-generator.*"
"keywords": [
"ts",
"typescript",
"json",
"schema",
"jsonschema"
],
"repository": {
"type": "git",
"url": "git+https://github.com/vega/ts-json-schema-generator.git"
},
"license": "MIT",
"author": {
"name": "Alexander Evtushenko",
"email": "aevtushenko@xiag.ch"
Expand All @@ -30,24 +28,32 @@
"email": "mooyoul@gmail.com"
}
],
"repository": {
"type": "git",
"url": "https://github.com/vega/ts-json-schema-generator.git"
"type": "commonjs",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"ts-json-schema-generator": "bin/ts-json-schema-generator.js"
},
"license": "MIT",
"keywords": [
"ts",
"typescript",
"json",
"schema",
"jsonschema"
"files": [
"dist",
"src",
"factory",
"index.*",
"ts-json-schema-generator.*"
],
"engines": {
"node": ">=18.0.0"
},
"exports": {
"import": "./dist/index.js",
"require": "./cjs/index.js"
"scripts": {
"build": "tsc",
"debug": "tsx --inspect-brk ts-json-schema-generator.ts",
"format": "eslint --fix",
"lint": "eslint",
"prepublishOnly": "yarn build",
"release": "yarn build && auto shipit",
"run": "tsx ts-json-schema-generator.ts",
"test": "jest test/ --verbose",
"test:coverage": "yarn jest test/ --collectCoverage=true",
"test:fast": "cross-env FAST_TEST=1 jest test/ --verbose",
"test:update": "cross-env UPDATE_SCHEMA=true yarn test:fast",
"watch": "tsc -w"
},
"dependencies": {
"@types/json-schema": "^7.0.15",
Expand Down Expand Up @@ -87,20 +93,7 @@
"vega": "^5.28.0",
"vega-lite": "^5.18.0"
},
"scripts": {
"prepublishOnly": "yarn build",
"build": "npm run build:cjs && npm run build:esm",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.json",
"watch": "tsc -w",
"lint": "eslint",
"format": "eslint --fix",
"test": "jest test/ --verbose",
"test:fast": "cross-env FAST_TEST=1 jest test/ --verbose",
"test:coverage": "yarn jest test/ --collectCoverage=true",
"test:update": "cross-env UPDATE_SCHEMA=true yarn test:fast",
"debug": "tsx --inspect-brk ts-json-schema-generator.ts",
"run": "tsx ts-json-schema-generator.ts",
"release": "yarn build && auto shipit"
"engines": {
"node": ">=18.0.0"
}
}
12 changes: 0 additions & 12 deletions tsconfig.cjs.json

This file was deleted.

4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "Node16",
"module": "CommonJS",
"moduleResolution": "Node",
"esModuleInterop": true,
"isolatedModules": false,
"experimentalDecorators": true,
Expand Down

0 comments on commit 2880903

Please sign in to comment.