From 898a32afd08a15f8cc6c1f24b4ec28990ae54b91 Mon Sep 17 00:00:00 2001 From: diy0r Date: Tue, 24 Sep 2024 23:27:51 +0500 Subject: [PATCH] chore: move to cjs --- commitlint.config.js | 2 +- eslint.config.js | 14 +++++++------- package.json | 8 ++------ tsconfig.build.json | 12 ------------ tsconfig.cjs.json | 11 +++++++++++ tsconfig.json | 11 ++++------- 6 files changed, 25 insertions(+), 33 deletions(-) delete mode 100644 tsconfig.build.json create mode 100644 tsconfig.cjs.json diff --git a/commitlint.config.js b/commitlint.config.js index 514308e..66f5f47 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,4 +1,4 @@ -export default { +module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'type-enum': [ diff --git a/eslint.config.js b/eslint.config.js index b8a03f8..b1357c2 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,11 +1,11 @@ -import pluginJs from '@eslint/js'; -import globals from 'globals'; -import tseslint from 'typescript-eslint'; -import prettierPlugin from 'eslint-plugin-prettier'; -import eslintConfigPrettier from 'eslint-config-prettier'; +const pluginJs = require('@eslint/js'); +const globals = require('globals'); +const tseslint = require('typescript-eslint'); +const prettierPlugin = require('eslint-plugin-prettier'); +const eslintConfigPrettier = require('eslint-config-prettier'); /** @type {import('eslint').Linter.FlatConfig[]} */ -export default tseslint.config( +module.exports = tseslint.config( { plugins: { '@typescript-eslint': tseslint.plugin, @@ -31,7 +31,7 @@ export default tseslint.config( ...globals.es2020, }, parserOptions: { - project: ['tsconfig.json', 'tsconfig.build.json'], + project: 'tsconfig.json', }, }, }, diff --git a/package.json b/package.json index 892b49a..d928c91 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,9 @@ "name": "file-graph", "version": "0.12.1", "main": "./dist/index.js", - "module": "./dist/index.js", "types": "./dist/index.d.ts", - "files": [ - "./dist" - ], - "type": "module", "scripts": { - "build": "tsc -p tsconfig.build.json", + "build": "tsc -p tsconfig.cjs.json", "prettier": "prettier 'lib/**/**.{js,ts}' 'test/**/**.{js,ts}' --check --ignore-unknown", "prettier:fix": "prettier lib/**/**.{js,ts}' 'test/**/**.{js,ts}' -w", "lint": "eslint", @@ -59,6 +54,7 @@ "data-structure", "network-analysis" ], + "files": ["dist"], "npm": { "publish": true }, diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index b298871..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "./tsconfig.json", - "exclude": [ - "node_modules", - "**/*.spec.ts", - "**/*.test.ts", - "dist", - "test", - "jest.config.ts", - "tsconfig.json" - ] -} \ No newline at end of file diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 0000000..edc9b0b --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "./dist", + "target": "ES2015" + }, + "exclude": [ + "test/**/*" + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 1d4fad4..3b13eac 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,13 @@ { "compilerOptions": { - "module": "ESNext", "declaration": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "target": "ES2021", "sourceMap": true, - "outDir": "./dist", - "baseUrl": "./", - "moduleResolution": "Node", + "baseUrl": ".", + "moduleResolution": "node", "skipLibCheck": true, "strictNullChecks": false, "noImplicitAny": false, @@ -20,13 +17,13 @@ }, "include": [ "lib/**/*", - "test/**/*", + "test/**/*" ], "ignorePatterns": [ "commitlint.config.js" ], "exclude": [ "node_modules", - "dist", + "dist" ] } \ No newline at end of file