Skip to content

Commit

Permalink
feat(export): Setup ESM first (#46)
Browse files Browse the repository at this point in the history
* feat(export): Setup ESM first

* Switch to Vitest
  • Loading branch information
JoseLion authored Jun 23, 2024
1 parent 5514d36 commit 29e87ad
Show file tree
Hide file tree
Showing 20 changed files with 2,163 additions and 1,023 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- run: yarn add --dev rxjs@~${{ matrix.rxjs }}
- run: yarn compile
- run: yarn lint
- run: yarn test --forbid-only
- run: yarn test

check:
runs-on: ubuntu-latest
Expand Down
13 changes: 0 additions & 13 deletions .mocharc.json

This file was deleted.

4 changes: 2 additions & 2 deletions eslint.config.mjs → eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export default eslintTs.config(
"@stylistic/switch-colon-spacing": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-exports": "off",
"@typescript-eslint/consistent-type-imports": ["off", { fixStyle: "inline-type-imports" }],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "inline-type-imports" }],
"@typescript-eslint/dot-notation": "error",
"@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
"@typescript-eslint/explicit-member-accessibility": "error",
Expand Down
42 changes: 29 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,42 @@
"rxjs",
"rxjs-observable"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"source": "./src/main.ts",
"main": "./dist/main.cjs",
"module": "./dist/main.js",
"unpkg": "./dist/main.umd.cjs",
"types": "./dist/main.d.ts",
"sideEffects": false,
"exports": {
".": {
"import": "./dist/main.js",
"require": "./dist/main.cjs",
"types": "./dist/main.d.ts",
"default": "./dist/main.js"
},
"./package.json": "./package.json"
},
"files": [
"dist/",
"src/"
"./dist",
"./src",
"./package.json"
],
"engines": {
"node": ">=18"
},
"scripts": {
"build": "tsc -p tsconfig.prod.json",
"check": "yarn compile && yarn lint && yarn test --forbid-only",
"build": "vite build",
"check": "yarn compile && yarn lint && yarn test --run",
"compile": "tsc",
"lint": "eslint .",
"release": "semantic-release",
"test": "NODE_ENV=test mocha"
"test": "NODE_ENV=test vitest"
},
"packageManager": "[email protected]",
"dependencies": {
"pino": "^9.2.0"
},
"devDependencies": {
"@assertive-ts/core": "^2.1.0",
"@assertive-ts/sinon": "^1.0.0",
Expand All @@ -44,7 +62,6 @@
"@stylistic/eslint-plugin": "^2.2.2",
"@types/eslint__eslintrc": "^2.1.1",
"@types/eslint__js": "^8.42.3",
"@types/mocha": "^10.0.7",
"@types/node": "^20.14.8",
"@types/sinon": "^17.0.3",
"axios": "^1.7.2",
Expand All @@ -57,7 +74,6 @@
"eslint-plugin-jsdoc": "^48.2.15",
"eslint-plugin-sonarjs": "^1.0.3",
"form-data": "^4.0.0",
"mocha": "^10.4.0",
"msw": "^2.3.1",
"rxjs": "^7.8.1",
"semantic-release": "^24.0.0",
Expand All @@ -66,7 +82,10 @@
"ts-node": "^10.9.2",
"tslib": "^2.6.3",
"typescript": "^5.5.2",
"typescript-eslint": "^7.13.1"
"typescript-eslint": "^7.13.1",
"vite": "^5.3.1",
"vite-plugin-dts": "^3.9.1",
"vitest": "^1.6.0"
},
"peerDependencies": {
"axios": ">=1.0.0",
Expand All @@ -83,8 +102,5 @@
"publishConfig": {
"access": "public",
"provenance": true
},
"dependencies": {
"pino": "^9.2.0"
}
}
27 changes: 14 additions & 13 deletions src/lib/RxjsAxios.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import axios, {
AxiosError,
AxiosInstance,
AxiosInterceptorManager,
AxiosRequestConfig,
AxiosRequestHeaders,
AxiosResponseHeaders,
Cancel,
CreateAxiosDefaults,
FormSerializerOptions,
GenericFormData,
GenericHTMLFormElement,
AxiosResponse as OriginalAxiosResponse,
type AxiosError,
type AxiosInstance,
type AxiosInterceptorManager,
type AxiosRequestConfig,
type AxiosRequestHeaders,
type AxiosResponseHeaders,
type Cancel,
type CreateAxiosDefaults,
type FormSerializerOptions,
type GenericFormData,
type GenericHTMLFormElement,
type AxiosResponse as OriginalAxiosResponse,
} from "axios";
import pino from "pino";
import { Observable } from "rxjs";

import { observify } from "./observify";

import type { Observable } from "rxjs";

export type AxiosResponse<T, D = unknown> = OriginalAxiosResponse<T, D>;

export type AxiosObservable<T> = Observable<AxiosResponse<T>>;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/helpers/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpResponse, PathParams, http } from "msw";
import { HttpResponse, type PathParams, http } from "msw";

export interface User {
id?: number;
Expand Down
18 changes: 0 additions & 18 deletions test/hooks.ts

This file was deleted.

18 changes: 0 additions & 18 deletions test/index.test.ts

This file was deleted.

Loading

0 comments on commit 29e87ad

Please sign in to comment.