Skip to content

Commit 5e31713

Browse files
committed
Fixed versions
1 parent 38d8640 commit 5e31713

File tree

19 files changed

+462
-16
lines changed

19 files changed

+462
-16
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@ jobs:
2323
- run: npm run build --if-present
2424
- run: npm run test
2525

26+
consumer-tests:
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
node-version: [18.x, 20.x, 21.x]
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Use Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
- run: |
38+
npm ci
39+
npm run build
40+
cd tests/consumers/cjs && npm install && npm run test
41+
cd ../esm && npm install && npm run test
42+
cd ../ts-local && npm install && npm run test
43+
2644
linting:
2745
runs-on: ubuntu-latest
2846
strategy:

babel.config.cjs

Lines changed: 0 additions & 6 deletions
This file was deleted.

index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
export * from "./src/index";
2-
export * from "./src/Interfaces";
31
export * from "./src/Config";
2+
export * from "./src/Constants";
3+
export * from "./src/Interfaces";
4+
export * from "./src/Resource";
5+
export * from "./src/Types";
6+
export * from "./src/Api";

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"build": "rm -rf ./dist && microbundle",
2222
"test": "jest --runInBand",
2323
"test:dev": "jest --watch",
24+
"test:consumer": "sh scripts/consumer-test.sh",
2425
"lint": "eslint --max-warnings=0 .",
2526
"lint:watch": "esw --watch --color",
2627
"prepare": "husky"

scripts/consumer-test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
echo "TESTING!!!"
2+
3+
npm install
4+
npm run build
5+
6+
cd tests/consumers/cjs && npm run test
7+
cd ../esm && npm run test
8+
cd ../ts-local && npm run test

src/index.ts renamed to src/Api.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import Resource from "./Resource";
2-
import { addRequest, addResponse } from "./Config";
3-
4-
export * from "./Config";
1+
import { Resource } from "./Resource";
2+
import { addRequest, addResponse, setConfig, getConfig } from "./Config";
53

64
export const interceptors = {
75
addRequest,
@@ -26,3 +24,11 @@ export const find = async (url: string) => {
2624
* @returns IQueryable
2725
*/
2826
export const resource = (url: string) => new Resource(url);
27+
28+
export const api = {
29+
find,
30+
resource,
31+
setConfig,
32+
getConfig,
33+
interceptors,
34+
};

src/Interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Resource from "./Resource";
1+
import { Resource } from "./Resource";
22
import { ConditionTypes, MethodType, QueryFunctionType } from "./Types";
33

44
export interface IRequest {

src/Resource.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
SortType,
1919
} from "./Types";
2020

21-
class Resource implements IQueryable {
21+
export class Resource implements IQueryable {
2222
private url: string;
2323
private config: IInternalConfig;
2424
private params: URLSearchParams;
@@ -652,5 +652,3 @@ class Resource implements IQueryable {
652652
};
653653
}
654654
}
655-
656-
export default Resource;

tests/consumers/cjs/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const api = require("axe-api-client");
2+
3+
const main = async () => {
4+
api.setConfig({
5+
baseURL: "https://axe-api.com",
6+
});
7+
console.log(api.getConfig());
8+
console.log("CJS module tests are succeed!");
9+
};
10+
11+
main();

tests/consumers/cjs/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)