Skip to content

Commit 5165863

Browse files
committed
updated pkgs, rollup
1 parent 58c4a8e commit 5165863

File tree

11 files changed

+36
-65
lines changed

11 files changed

+36
-65
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jjmyers/api-store",
3-
"version": "1.3.3",
3+
"version": "1.3.5",
44
"private": false,
55
"type": "module",
66
"publishConfig": {
@@ -15,13 +15,13 @@
1515
},
1616
"scripts": {
1717
"start": "react-scripts start",
18-
"build": "rm -r ./build & rm jjmyers-api-store-*.tgz & rollup -c --bundleConfigAsCjs && npm pack",
18+
"build": "rm -r ./build & rm jjmyers-api-store-*.tgz & rollup -c --bundleConfigAsCjs && cp lib/types.d.ts build/types && npm pack",
1919
"test": "react-scripts test",
2020
"testIndex": "nodemon src/__tests__/index.ts",
2121
"eject": "react-scripts eject"
2222
},
2323
"dependencies": {
24-
"@jjmyers/object-relationship-store": "^3.2.4"
24+
"@jjmyers/object-relationship-store": "^3.2.7"
2525
},
2626
"repository": {
2727
"type": "git",
@@ -65,36 +65,35 @@
6565
]
6666
},
6767
"devDependencies": {
68-
"@babel/core": "^7.22.9",
68+
"@babel/core": "^7.24.3",
6969
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
70-
"@babel/preset-env": "^7.22.9",
71-
"@babel/preset-react": "^7.22.5",
72-
"@faker-js/faker": "^8.0.2",
73-
"@rollup/plugin-commonjs": "^25.0.3",
74-
"@rollup/plugin-node-resolve": "^15.1.0",
75-
"@rollup/plugin-terser": "^0.4.3",
76-
"@rollup/plugin-typescript": "^11.1.2",
77-
"@testing-library/jest-dom": "^5.16.5",
78-
"@testing-library/react": "^13.4.0",
79-
"@testing-library/user-event": "^13.5.0",
80-
"@types/jest": "^27.5.2",
81-
"@types/node": "^16.18.38",
82-
"@types/react": "^18.2.14",
83-
"@types/react-dom": "^18.2.6",
84-
"nodemon": "^3.0.1",
70+
"@babel/preset-env": "^7.24.3",
71+
"@babel/preset-react": "^7.24.1",
72+
"@faker-js/faker": "^8.4.1",
73+
"@rollup/plugin-commonjs": "^25.0.7",
74+
"@rollup/plugin-node-resolve": "^15.2.3",
75+
"@rollup/plugin-terser": "^0.4.4",
76+
"@rollup/plugin-typescript": "^11.1.6",
77+
"@testing-library/jest-dom": "^6.4.2",
78+
"@testing-library/react": "^14.2.2",
79+
"@testing-library/user-event": "^14.5.2",
80+
"@types/jest": "^29.5.12",
81+
"@types/node": "^20.11.30",
82+
"@types/react": "^18.2.69",
83+
"@types/react-dom": "^18.2.22",
84+
"nodemon": "^3.1.0",
8585
"react": "^18.2.0",
8686
"react-dom": "^18.2.0",
8787
"react-scripts": "5.0.1",
88-
"rollup": "^3.26.3",
88+
"rollup": "^4.13.0",
8989
"rollup-plugin-commonjs": "^10.1.0",
90-
"rollup-plugin-dts": "^5.3.0",
9190
"rollup-plugin-node-resolve": "^5.2.0",
9291
"rollup-plugin-peer-deps-external": "^2.2.4",
93-
"ts-loader": "^9.4.4",
94-
"ts-node": "^10.9.1",
95-
"tslib": "^2.6.0",
96-
"typescript": "^5.1.6",
97-
"web-vitals": "^2.1.4"
92+
"ts-loader": "^9.5.1",
93+
"ts-node": "^10.9.2",
94+
"tslib": "^2.6.2",
95+
"typescript": "^5.4.3",
96+
"web-vitals": "^3.5.2"
9897
},
9998
"description": "A react store that uses object relationships to normalize data, save in state and retrieve data.",
10099
"keywords": [

rollup.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ import resolve from "@rollup/plugin-node-resolve";
22
import commonjs from "@rollup/plugin-commonjs";
33
import typescript from "@rollup/plugin-typescript";
44
import terser from "@rollup/plugin-terser";
5-
import dts from "rollup-plugin-dts";
65

76
const packageJson = require("./package.json");
87

98
export default [
109
{
11-
input: "src/index.ts",
10+
input: "lib/index.ts",
1211
output: [
1312
{
1413
file: packageJson.main,
@@ -24,14 +23,13 @@ export default [
2423
plugins: [
2524
resolve(),
2625
commonjs(),
27-
typescript({tsconfig: "./tsconfig.json"}),
26+
typescript({
27+
include: ["lib/**"],
28+
declaration: true,
29+
declarationDir: "build/types"
30+
}),
2831
terser()
2932
],
3033
external: ["react", "react-dom"],
31-
},
32-
{
33-
input: "src/index.ts",
34-
output: [{ file: "build/index.d.ts", format: "es" }],
35-
plugins: [dts.default()],
3634
}
3735
];

src/__tests__/application.test.tsx

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { act, renderHook, waitFor } from "@testing-library/react";
22
import { posts } from "./data";
3-
import { RelationalStoreProvider, createRelationalObject, createRelationalObjectIndex, createStore, useStoreIndex, withOptions } from "..";
4-
import { useQuery } from "../useQuery";
3+
import { RelationalStoreProvider, createRelationalObject, createRelationalObjectIndex, createStore, useStoreIndex, withOptions } from "../../lib";
4+
import { useQuery } from "../../lib/useQuery";
55
import { fakeFetch, fakePaginatingFetch } from "./test-utils";
6-
import { useInfiniteQuery } from "../useInfiniteQuery";
7-
import { useMutation } from "../useMutation";
6+
import { useInfiniteQuery } from "../../lib/useInfiniteQuery";
7+
import { useMutation } from "../../lib/useMutation";
88

99
const user = createRelationalObject("user");
1010
const image = createRelationalObject("image");
@@ -55,29 +55,6 @@ it("should get data from a store", async () => {
5555
act(() => store.mutate(withOptions({ id: 5 }, { __identify__: "post", __indexes__: ["homeFeed-1"] })))
5656

5757
expect(result.current?.length).toBe(6)
58-
59-
})
60-
61-
62-
it("should get data from a store", async () => {
63-
64-
store.mutate(withOptions(posts, { __indexes__: ["homeFeed-1"] }))
65-
66-
const { result } = renderHook(() => (
67-
useStoreIndex("homeFeed-1", {
68-
post: {
69-
from: "post",
70-
fields: ["id"],
71-
}
72-
})
73-
), { wrapper });
74-
75-
expect(result.current?.length).toBe(5)
76-
77-
act(() => store.mutate(withOptions({ id: 5 }, { __identify__: "post", __indexes__: ["homeFeed-1"] })))
78-
79-
expect(result.current?.length).toBe(6)
80-
8158
})
8259

8360
it("should get data from useQuery", async () => {

0 commit comments

Comments
 (0)