Browse Source

chore: remove useless dev dependencies + folder structure

pull/26/head
Antoine Lanoe 7 months ago
parent
commit
43b3c9e72a
  1. 20
      jest.config.js
  2. 2589
      package-lock.json
  3. 23
      package.json
  4. 8
      src/index.ts
  5. 4
      src/lib/list-diff/index.ts
  6. 4
      src/lib/list-diff/list-diff.test.ts
  7. 4
      src/lib/object-diff/index.ts
  8. 4
      src/lib/object-diff/object-diff.test.ts
  9. 0
      src/lib/stream-list-diff/emitter.ts
  10. 6
      src/lib/stream-list-diff/index.ts
  11. 2
      src/lib/utils/index.ts
  12. 2
      src/lib/utils/utils.test.ts
  13. 0
      src/models/list/index.ts
  14. 0
      src/models/object/index.ts
  15. 2
      src/models/stream/index.ts
  16. 0
      src/models/utils/index.ts
  17. 11
      tsconfig.json

20
jest.config.js

@ -1,5 +1,23 @@
module.exports = { module.exports = {
transform: { transform: {
"^.+\\.(ts|js)$": "ts-jest", "^.+\\.(ts|js)$": [
"@swc/jest",
{
jsc: {
baseUrl: ".",
parser: {
syntax: "typescript",
tsx: true,
dynamicImport: true,
},
paths: {
"@models/*": ["./src/models/*"],
"@lib/*": ["./src/lib/*"],
},
target: "esnext",
},
},
],
}, },
}; };

2589
package-lock.json generated

File diff suppressed because it is too large Load Diff

23
package.json

@ -61,28 +61,29 @@
], ],
"scripts": { "scripts": {
"build": "tsup", "build": "tsup",
"test": "jest",
"lint": "eslint --cache --max-warnings=0 --fix",
"tsc": "tsc --noEmit --incremental",
"format": "npx prettier . --write", "format": "npx prettier . --write",
"prepare": "husky" "lint:dead-code": "npx -p typescript@latest -p knip knip",
"lint": "eslint --cache --max-warnings=0 --fix",
"prepare": "husky",
"test": "jest",
"tsc": "tsc --noEmit --incremental"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.11.1", "@eslint/js": "^9.11.1",
"eslint": "^9.11.1",
"prettier": "^3.3.3",
"@semantic-release/exec": "^6.0.3", "@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.0", "@semantic-release/github": "^11.0.0",
"@semantic-release/npm": "^12.0.1", "@semantic-release/npm": "^12.0.1",
"@actions/core": "^1.10.1", "@swc/core": "^1.7.26",
"@babel/preset-env": "^7.25.4", "@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13", "@types/jest": "^29.5.13",
"eslint": "^9.11.1",
"husky": "^9.1.6", "husky": "^9.1.6",
"jest": "^29.7.0", "jest": "^29.7.0",
"ts-jest": "^29.2.5", "prettier": "^3.3.3",
"swc-loader": "^0.2.6",
"tsup": "^8.3.0", "tsup": "^8.3.0",
"typescript-eslint": "^8.7.0", "typescript": "^5.6.2",
"typescript": "^5.6.2" "typescript-eslint": "^8.7.0"
} }
} }

8
src/index.ts

@ -1,5 +1,7 @@
export { getObjectDiff } from "./object-diff"; export { getObjectDiff } from "./lib/object-diff";
export { getListDiff } from "./list-diff"; export { getListDiff } from "./lib/list-diff";
export { isEqual, isObject } from "./utils"; export { isEqual, isObject } from "./lib/utils";
export { streamListsDiff } from "./lib/stream-list-diff";
export * from "./models/list"; export * from "./models/list";
export * from "./models/object"; export * from "./models/object";
export * from "./models/stream";

4
src/list-diff.ts → src/lib/list-diff/index.ts

@ -3,8 +3,8 @@ import {
LIST_STATUS, LIST_STATUS,
ListDiff, ListDiff,
ListDiffOptions, ListDiffOptions,
} from "./models/list"; } from "@models/list";
import { isEqual, isObject } from "./utils"; import { isEqual, isObject } from "@lib/utils";
function getLeanDiff( function getLeanDiff(
diff: ListDiff["diff"], diff: ListDiff["diff"],

4
test/list-diff.test.ts → src/lib/list-diff/list-diff.test.ts

@ -1,5 +1,5 @@
import { getListDiff } from "../src/list-diff"; import { getListDiff } from ".";
import { LIST_STATUS } from "../src/models/list"; import { LIST_STATUS } from "@models/list";
describe("getListDiff", () => { describe("getListDiff", () => {
it("returns an empty diff if no lists are provided", () => { it("returns an empty diff if no lists are provided", () => {

4
src/object-diff.ts → src/lib/object-diff/index.ts

@ -6,8 +6,8 @@ import {
ObjectDiffOptions, ObjectDiffOptions,
Diff, Diff,
DEFAULT_OBJECT_DIFF_OPTIONS, DEFAULT_OBJECT_DIFF_OPTIONS,
} from "./models/object"; } from "@models/object";
import { isEqual, isObject } from "./utils"; import { isEqual, isObject } from "@lib/utils";
function getLeanDiff( function getLeanDiff(
diff: ObjectDiff["diff"], diff: ObjectDiff["diff"],

4
test/object-diff.test.ts → src/lib/object-diff/object-diff.test.ts

@ -1,5 +1,5 @@
import { GRANULARITY, OBJECT_STATUS } from "../src/models/object"; import { GRANULARITY, OBJECT_STATUS } from "../../models/object";
import { getObjectDiff } from "../src/object-diff"; import { getObjectDiff } from ".";
describe("getObjectDiff", () => { describe("getObjectDiff", () => {
it("returns an empty diff if no objects are provided", () => { it("returns an empty diff if no objects are provided", () => {

0
src/stream/emitter.ts → src/lib/stream-list-diff/emitter.ts

6
src/stream/stream-list-diff.ts → src/lib/stream-list-diff/index.ts

@ -4,9 +4,9 @@ import {
ReferenceProperty, ReferenceProperty,
StreamListsDiff, StreamListsDiff,
StreamReferences, StreamReferences,
} from "../models/stream"; } from "@models/stream";
import { LIST_STATUS } from "../models/list"; import { LIST_STATUS } from "@models/list";
import { isEqual } from "../utils"; import { isEqual } from "@lib/utils";
import { EventEmitter, StreamEvent } from "./emitter"; import { EventEmitter, StreamEvent } from "./emitter";
function outputDiffChunk<T extends Record<string, unknown>>( function outputDiffChunk<T extends Record<string, unknown>>(

2
src/utils.ts → src/lib/utils/index.ts

@ -1,4 +1,4 @@
import { isEqualOptions } from "./models/utils"; import { isEqualOptions } from "@models/utils";
/** /**
* Returns true if two data are equal * Returns true if two data are equal

2
test/utils.test.ts → src/lib/utils/utils.test.ts

@ -1,4 +1,4 @@
import { isEqual, isObject } from "../src/utils"; import { isEqual, isObject } from ".";
describe("isEqual", () => { describe("isEqual", () => {
it("return true if data are the same", () => { it("return true if data are the same", () => {

0
src/models/list.ts → src/models/list/index.ts

0
src/models/object.ts → src/models/object/index.ts

2
src/models/stream.ts → src/models/stream/index.ts

@ -1,4 +1,4 @@
import { LIST_STATUS } from "./list"; import { LIST_STATUS } from "@models/list";
export type StreamListsDiff<T extends Record<string, unknown>> = { export type StreamListsDiff<T extends Record<string, unknown>> = {
currentValue: T | null; currentValue: T | null;

0
src/models/utils.ts → src/models/utils/index.ts

11
tsconfig.json

@ -1,6 +1,6 @@
{ {
"exclude": ["node_modules", "dist"], "exclude": ["node_modules", "dist"],
"include": ["src/*.ts"], "include": ["src"],
"compilerOptions": { "compilerOptions": {
"declaration": true, "declaration": true,
"declarationDir": "./dist", "declarationDir": "./dist",
@ -15,6 +15,13 @@
"strict": true, "strict": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"skipLibCheck": true "skipLibCheck": true ,
"baseUrl": ".",
"paths": {
"@models/*": ["./src/models/*"],
"@lib/*": ["./src/lib/*"],
}
}, },
} }

Loading…
Cancel
Save