From 898a32afd08a15f8cc6c1f24b4ec28990ae54b91 Mon Sep 17 00:00:00 2001 From: diy0r Date: Tue, 24 Sep 2024 23:27:51 +0500 Subject: [PATCH 1/3] 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 From efc7a18438b48215c1cebab6a1c38a4bc5a643b1 Mon Sep 17 00:00:00 2001 From: diy0r Date: Tue, 24 Sep 2024 23:29:47 +0500 Subject: [PATCH 2/3] refactor: use absolute path --- lib/graph/index.ts | 2 +- lib/utils/merge-vertex.ts | 2 +- test/graph.test.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/graph/index.ts b/lib/graph/index.ts index e5e84ef..7cc97ae 100644 --- a/lib/graph/index.ts +++ b/lib/graph/index.ts @@ -1,4 +1,4 @@ -import { asyncTaskQueue } from 'lib/utils'; +import { asyncTaskQueue } from '../utils'; import FileGraphIml from './file.graph'; import StorageFile from './storage.file'; diff --git a/lib/utils/merge-vertex.ts b/lib/utils/merge-vertex.ts index 5bf885b..2b103a2 100644 --- a/lib/utils/merge-vertex.ts +++ b/lib/utils/merge-vertex.ts @@ -1,4 +1,4 @@ -import { IVertex } from 'lib/interfaces'; +import { IVertex } from '../interfaces'; export const mergeVertices = ( vertex: IVertex, diff --git a/test/graph.test.ts b/test/graph.test.ts index c517066..d23260f 100644 --- a/test/graph.test.ts +++ b/test/graph.test.ts @@ -1,8 +1,8 @@ import assert from 'node:assert'; import { before, describe, test } from 'node:test'; -import { FileGraph, IUuidArray, uuidType } from 'lib'; +import { FileGraph, IUuidArray, uuidType } from '../lib'; import { writeFileSync } from 'node:fs'; -import { createError } from 'lib/utils'; +import { createError } from '../lib/utils'; const pathGraph = 'data.txt'; const graph = FileGraph(pathGraph); From 7dade3176925de49911fe8e440aa1c779eead1b8 Mon Sep 17 00:00:00 2001 From: diy0r Date: Wed, 25 Sep 2024 00:12:02 +0500 Subject: [PATCH 3/3] chore: version v1.0.0 --- CHANGELOG.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e133ad4..1c6c59a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,14 @@ All notable changes to this project will be documented in this file. Dates are displayed in UTC. +#### [1.0.0](https://github.com/DIY0R/file-graph/compare/0.12.1...1.0.0) + +- refactor: use absolute path [`efc7a18`](https://github.com/DIY0R/file-graph/commit/efc7a18438b48215c1cebab6a1c38a4bc5a643b1) + #### [0.12.1](https://github.com/DIY0R/file-graph/compare/0.12.0...0.12.1) +> 22 September 2024 + - doc: improved documentation text and examples [`d234ab9`](https://github.com/DIY0R/file-graph/commit/d234ab9e1069af8b2bf4f26f5f97f1e894f52868) - refactor: esModuleInterop true [`b0174d1`](https://github.com/DIY0R/file-graph/commit/b0174d1558eb52019d3dea98ef2743fc3cacb902) diff --git a/package-lock.json b/package-lock.json index fa9045c..f025fdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "file-graph", - "version": "0.12.1", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "file-graph", - "version": "0.12.1", + "version": "1.0.0", "license": "MIT", "devDependencies": { "@commitlint/cli": "^19.3.0", diff --git a/package.json b/package.json index d928c91..68cf6cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "file-graph", - "version": "0.12.1", + "version": "1.0.0", "main": "./dist/index.js", "types": "./dist/index.d.ts", "scripts": { @@ -54,7 +54,9 @@ "data-structure", "network-analysis" ], - "files": ["dist"], + "files": [ + "dist" + ], "npm": { "publish": true },