redux-connected-devtools 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -1
- package/package.json +26 -12
- package/src/components/DevInspector/DevInspector.style.tsx +0 -1
- package/src/components/DevList/DevList.tsx +5 -2
- package/src/components/DevMenu/DevMenu.style.tsx +9 -6
- package/src/components/DevMenu/DevMenu.tsx +2 -1
- package/src/components/DevPanel/DevPanel.style.tsx +9 -0
- package/src/components/DevPanel/DevPanel.tsx +12 -5
- package/src/components/DevtoolsApp/DevtoolsApp.scss +2 -0
- package/src/components/DevtoolsApp/DevtoolsApp.style.tsx +12 -0
- package/src/components/DevtoolsApp/DevtoolsApp.tsx +45 -0
- package/src/components/Icon/AllIcons.tsx +66 -0
- package/src/components/Icon/Icon.scss +2 -0
- package/src/components/Icon/Icon.style.tsx +11 -0
- package/src/components/Icon/Icon.tsx +28 -0
- package/src/components/JourneyRow/JourneyRow.style.tsx +2 -2
- package/src/components/JourneyRow/JourneyRow.tsx +2 -0
- package/src/components/JsonViewer/JsonViewer.tsx +0 -1
- package/src/components/Lifecycle/Lifecycle.tsx +6 -1
- package/src/components/RequestDetails/RequestDetails.style.tsx +1 -1
- package/src/components/RequestJourney/RequestJourney.style.tsx +21 -0
- package/src/components/RequestRow/RequestRow.style.tsx +1 -0
- package/src/components/RequestRow/RequestRow.tsx +3 -3
- package/src/components/Size/Size.scss +2 -0
- package/src/components/Size/Size.style.tsx +6 -0
- package/src/components/Size/Size.tsx +21 -0
- package/src/components/StateViewer/StateViewer.scss +2 -0
- package/src/components/StateViewer/StateViewer.style.tsx +5 -0
- package/src/components/StateViewer/StateViewer.tsx +17 -0
- package/src/components/Time/Time.style.tsx +1 -1
- package/src/containers/DevPanelContainer.tsx +5 -3
- package/src/containers/DevtoolsAppContainer.tsx +42 -0
- package/src/containers/JsonViewerContainer.tsx +8 -0
- package/src/containers/LifecycleContainer.tsx +12 -0
- package/src/containers/LifecycleFailedContainer.tsx +11 -0
- package/src/containers/LogsViewerContainer.tsx +8 -0
- package/src/containers/StateViewerContainer.tsx +8 -0
- package/src/data/devComponents.tsx +2 -0
- package/src/data/devRouter.ts +107 -0
- package/src/data/devRoutes.ts +20 -13
- package/src/hooks/useStoreSize.ts +27 -0
- package/src/index.ts +1 -1
- package/src/store/selectors.ts +49 -34
- package/src/types.ts +1 -1
- package/src/utils/date.ts +9 -1
- package/src/utils/download.ts +17 -0
- package/tsconfig.json +13 -19
- package/vite.config.ts +21 -39
- package/.vscode/settings.json +0 -12
- package/.vscode/tasks.json +0 -33
- package/public/devtools.html +0 -8
- package/public/icon.png +0 -0
- package/public/manifest.json +0 -29
- package/public/options.html +0 -12
- package/public/panel.html +0 -39
- package/public/popup.html +0 -12
- package/src/background.ts +0 -49
- package/src/content_script.ts +0 -19
- package/src/devtools.tsx +0 -29
- package/src/injected_script.ts +0 -9
- package/src/options.tsx +0 -77
- package/src/panel.tsx +0 -30
- package/src/popup.tsx +0 -63
- package/src/sum.ts +0 -3
- package/webpack/webpack.common.js +0 -46
- package/webpack/webpack.dev.js +0 -7
- package/webpack/webpack.prod.js +0 -6
@@ -0,0 +1,42 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import DevtoolsApp from '../components/DevtoolsApp/DevtoolsApp';
|
3
|
+
import { clearCompletedRequests, clearFailedRequests } from 'redux-connected';
|
4
|
+
import { getMinutes, resetStartOfTime } from '../utils/date';
|
5
|
+
import { download } from '../utils/download';
|
6
|
+
import { useStoreSize } from '../hooks/useStoreSize';
|
7
|
+
|
8
|
+
export type DevtoolsAppProps = {
|
9
|
+
connectedStore: any;
|
10
|
+
isDarkMode?: boolean;
|
11
|
+
};
|
12
|
+
|
13
|
+
export function DevtoolsAppContainer(props: DevtoolsAppProps) {
|
14
|
+
const { connectedStore, isDarkMode } = props;
|
15
|
+
const storeSizeInBytes = useStoreSize(connectedStore);
|
16
|
+
|
17
|
+
function clearRequests() {
|
18
|
+
connectedStore.dispatch(clearCompletedRequests());
|
19
|
+
connectedStore.dispatch(clearFailedRequests());
|
20
|
+
// also resets time
|
21
|
+
resetStartOfTime();
|
22
|
+
}
|
23
|
+
|
24
|
+
function downloadState() {
|
25
|
+
const state = connectedStore.getState();
|
26
|
+
const minutes = getMinutes();
|
27
|
+
const filename = `state_${minutes}.json`;
|
28
|
+
download(filename, state);
|
29
|
+
}
|
30
|
+
|
31
|
+
return (
|
32
|
+
<DevtoolsApp
|
33
|
+
connectedStore={connectedStore}
|
34
|
+
clearRequests={clearRequests}
|
35
|
+
downloadState={downloadState}
|
36
|
+
storeSizeInBytes={storeSizeInBytes}
|
37
|
+
isDarkMode={isDarkMode}
|
38
|
+
/>
|
39
|
+
);
|
40
|
+
}
|
41
|
+
|
42
|
+
export default DevtoolsAppContainer;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { useSelector } from 'react-redux';
|
3
|
+
import { connectedSelectors } from 'redux-connected';
|
4
|
+
import Lifecycle from '../components/Lifecycle/Lifecycle';
|
5
|
+
|
6
|
+
export function LifecycleContainer() {
|
7
|
+
const actionLogs = useSelector(connectedSelectors.$actionLogsByLifecycle);
|
8
|
+
|
9
|
+
return <Lifecycle />;
|
10
|
+
}
|
11
|
+
|
12
|
+
export default LifecycleContainer;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { useSelector } from 'react-redux';
|
3
|
+
import Lifecycle from '../components/Lifecycle/Lifecycle';
|
4
|
+
import { $requestsFailed } from '../store/selectors';
|
5
|
+
|
6
|
+
export function LifecycleFailedContainer() {
|
7
|
+
const requests = useSelector($requestsFailed);
|
8
|
+
return <Lifecycle requests={requests} />;
|
9
|
+
}
|
10
|
+
|
11
|
+
export default LifecycleFailedContainer;
|
@@ -8,6 +8,7 @@ import LifecycleGeneralErrorContainer from '../containers/LifecycleGeneralErrorC
|
|
8
8
|
import LifecyclePendingApiContainer from '../containers/LifecyclePendingApiContainer';
|
9
9
|
import LifecycleApiErrorContainer from '../containers/LifecycleApiErrorContainer';
|
10
10
|
import LifecyclePostActionContainer from '../containers/LifecyclePostActionContainer';
|
11
|
+
import LifecycleFailedContainer from '../containers/LifecycleFailedContainer';
|
11
12
|
|
12
13
|
type DevComponents = Record<string, React.FC<any>>;
|
13
14
|
|
@@ -17,6 +18,7 @@ export const devComponents: DevComponents = {
|
|
17
18
|
LifecycleGeneralError: LifecycleGeneralErrorContainer,
|
18
19
|
LifecyclePendingApi: LifecyclePendingApiContainer,
|
19
20
|
LifecycleApiError: LifecycleApiErrorContainer,
|
21
|
+
LifecycleFailed: LifecycleFailedContainer,
|
20
22
|
LifecyclePostAction: LifecyclePostActionContainer,
|
21
23
|
GlobalSettings: GlobalSettingsContainer,
|
22
24
|
GlobalStats: GlobalStatsContainer,
|
@@ -0,0 +1,107 @@
|
|
1
|
+
export type IDevRoute = {
|
2
|
+
id: string;
|
3
|
+
title: string;
|
4
|
+
group: string;
|
5
|
+
componentId: string;
|
6
|
+
};
|
7
|
+
|
8
|
+
export const devRoutes: IDevRoute[] = [
|
9
|
+
{
|
10
|
+
id: '/lifecycle/original',
|
11
|
+
title: '1. Original',
|
12
|
+
group: 'lifecycle',
|
13
|
+
componentId: 'Lifecycle',
|
14
|
+
},
|
15
|
+
{
|
16
|
+
id: '/lifecycle/gatekeeper',
|
17
|
+
title: '2. Gatekeeper',
|
18
|
+
group: 'lifecycle',
|
19
|
+
componentId: 'Lifecycle',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
id: '/lifecycle/incoming',
|
23
|
+
title: '3. Incoming',
|
24
|
+
group: 'lifecycle',
|
25
|
+
componentId: 'Lifecycle',
|
26
|
+
},
|
27
|
+
{
|
28
|
+
id: '/lifecycle/queue',
|
29
|
+
title: '4. Queue',
|
30
|
+
group: 'lifecycle',
|
31
|
+
componentId: 'Lifecycle',
|
32
|
+
},
|
33
|
+
{
|
34
|
+
id: '/lifecycle/firing',
|
35
|
+
title: '5. Firing',
|
36
|
+
group: 'lifecycle',
|
37
|
+
componentId: 'Lifecycle',
|
38
|
+
},
|
39
|
+
{
|
40
|
+
id: '/lifecycle/api',
|
41
|
+
title: '6. API',
|
42
|
+
group: 'lifecycle',
|
43
|
+
componentId: 'Lifecycle',
|
44
|
+
},
|
45
|
+
{
|
46
|
+
id: '/lifecycle/error',
|
47
|
+
title: '7. Error',
|
48
|
+
group: 'lifecycle',
|
49
|
+
componentId: 'Lifecycle',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
id: '/lifecycle/postAction',
|
53
|
+
title: '8. Post-action',
|
54
|
+
group: 'lifecycle',
|
55
|
+
componentId: 'Lifecycle',
|
56
|
+
},
|
57
|
+
{
|
58
|
+
id: '/logs',
|
59
|
+
title: 'Logs',
|
60
|
+
group: 'state',
|
61
|
+
componentId: 'LogsViewer',
|
62
|
+
},
|
63
|
+
{
|
64
|
+
id: '/state',
|
65
|
+
title: 'State',
|
66
|
+
group: 'state',
|
67
|
+
componentId: 'StateViewer',
|
68
|
+
},
|
69
|
+
{
|
70
|
+
id: '/sagas',
|
71
|
+
title: 'Sagas',
|
72
|
+
group: 'state',
|
73
|
+
componentId: 'SagaViewer',
|
74
|
+
},
|
75
|
+
{
|
76
|
+
id: '/settings/global',
|
77
|
+
title: 'Global settings',
|
78
|
+
group: 'settings & stats',
|
79
|
+
componentId: 'JsonViewer',
|
80
|
+
},
|
81
|
+
{
|
82
|
+
id: '/settings/endpoints',
|
83
|
+
title: 'Endpoints configs',
|
84
|
+
group: 'settings & stats',
|
85
|
+
componentId: 'JsonViewer',
|
86
|
+
},
|
87
|
+
{
|
88
|
+
id: '/stats/global',
|
89
|
+
title: 'Global stats',
|
90
|
+
group: 'settings & stats',
|
91
|
+
componentId: 'JsonViewer',
|
92
|
+
},
|
93
|
+
];
|
94
|
+
|
95
|
+
const getGroups = (): string[] => {
|
96
|
+
const output: string[] = [];
|
97
|
+
|
98
|
+
devRoutes.forEach((group) => {
|
99
|
+
if (!output.includes(group.group)) {
|
100
|
+
output.push(group.group);
|
101
|
+
}
|
102
|
+
});
|
103
|
+
|
104
|
+
return output;
|
105
|
+
};
|
106
|
+
|
107
|
+
export const devGroups: string[] = getGroups();
|
package/src/data/devRoutes.ts
CHANGED
@@ -18,34 +18,41 @@ export const devRoutes: IDevRoute[] = [
|
|
18
18
|
group: 'lifecycle',
|
19
19
|
componentId: 'LifecycleInQueue',
|
20
20
|
},
|
21
|
+
|
21
22
|
{
|
22
|
-
id: '
|
23
|
-
title: '3.
|
23
|
+
id: 'lifecyclePendingApi',
|
24
|
+
title: '3. Pending API',
|
24
25
|
group: 'lifecycle',
|
25
|
-
componentId: '
|
26
|
+
componentId: 'LifecyclePendingApi',
|
26
27
|
},
|
27
28
|
{
|
28
|
-
id: '
|
29
|
-
title: '4.
|
29
|
+
id: 'lifecyclePostAction',
|
30
|
+
title: '4. Post action',
|
30
31
|
group: 'lifecycle',
|
31
|
-
componentId: '
|
32
|
+
componentId: 'LifecyclePostAction',
|
33
|
+
},
|
34
|
+
{
|
35
|
+
id: 'lifecycleGeneralError',
|
36
|
+
title: 'e1. General errors',
|
37
|
+
group: 'errors',
|
38
|
+
componentId: 'LifecycleGeneralError',
|
32
39
|
},
|
33
40
|
{
|
34
41
|
id: 'lifecycleApiError',
|
35
|
-
title: '
|
36
|
-
group: '
|
42
|
+
title: 'e2. API errors',
|
43
|
+
group: 'errors',
|
37
44
|
componentId: 'LifecycleApiError',
|
38
45
|
},
|
39
46
|
{
|
40
|
-
id: '
|
41
|
-
title: '
|
42
|
-
group: '
|
43
|
-
componentId: '
|
47
|
+
id: 'lifecycleFailed',
|
48
|
+
title: 'e3. Failed requests (after retries)',
|
49
|
+
group: 'errors',
|
50
|
+
componentId: 'LifecycleFailed',
|
44
51
|
},
|
45
52
|
{
|
46
53
|
id: 'endpointStatus',
|
47
54
|
title: 'Endpoint status',
|
48
|
-
group: '
|
55
|
+
group: 'settings & stats',
|
49
56
|
componentId: 'EndpointStatus',
|
50
57
|
},
|
51
58
|
{
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { useState, useEffect } from 'react';
|
2
|
+
import { debounce } from 'shared-base';
|
3
|
+
|
4
|
+
type Callback = () => void;
|
5
|
+
|
6
|
+
interface ReduxStore {
|
7
|
+
getState: () => Json;
|
8
|
+
subscribe: (callback: Callback) => void;
|
9
|
+
}
|
10
|
+
|
11
|
+
export const useStoreSize = (store: ReduxStore) => {
|
12
|
+
const [storeSize, setStoreSize] = useState<number>();
|
13
|
+
|
14
|
+
const calculateSize = debounce(() => {
|
15
|
+
const state = store.getState();
|
16
|
+
const size = JSON.stringify(state).length;
|
17
|
+
setStoreSize(size);
|
18
|
+
}, 500);
|
19
|
+
|
20
|
+
useEffect(() => {
|
21
|
+
store.subscribe(() => {
|
22
|
+
calculateSize();
|
23
|
+
});
|
24
|
+
}, [store]);
|
25
|
+
|
26
|
+
return storeSize;
|
27
|
+
};
|
package/src/index.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export {
|
1
|
+
export { DevtoolsAppContainer as DevtoolsApp } from './containers/DevtoolsAppContainer';
|
package/src/store/selectors.ts
CHANGED
@@ -8,10 +8,10 @@ export const $requests = createSelector(
|
|
8
8
|
.map((request) => {
|
9
9
|
const { items } = request;
|
10
10
|
|
11
|
-
const lastPoint = items[items.length - 1];
|
11
|
+
const lastPoint = items[items.length - 1] ?? {};
|
12
12
|
|
13
13
|
const journeyWithDelta = items.map((point, index) => {
|
14
|
-
const nextPoint = items[index + 1]
|
14
|
+
const nextPoint = items[index + 1] ?? point;
|
15
15
|
const delta = nextPoint.timestamp - point.timestamp;
|
16
16
|
|
17
17
|
return {
|
@@ -71,28 +71,6 @@ export const $requestsInQueuePast = createSelector($requests, (requests) => {
|
|
71
71
|
});
|
72
72
|
|
73
73
|
// 3
|
74
|
-
export const $requestsGeneralError = createSelector($requests, (requests) => {
|
75
|
-
return requests.filter((request) => {
|
76
|
-
const { items } = request;
|
77
|
-
const lastPoint = items[items.length - 1];
|
78
|
-
return lastPoint && lastPoint.status === LifecycleStatus.GENERAL_ERROR;
|
79
|
-
});
|
80
|
-
});
|
81
|
-
|
82
|
-
export const $requestsGeneralErrorPast = createSelector(
|
83
|
-
$requests,
|
84
|
-
(requests) => {
|
85
|
-
return requests.filter((request) => {
|
86
|
-
const { items } = request;
|
87
|
-
|
88
|
-
return items.find(
|
89
|
-
(point) => point.status === LifecycleStatus.GENERAL_ERROR
|
90
|
-
);
|
91
|
-
});
|
92
|
-
}
|
93
|
-
);
|
94
|
-
|
95
|
-
// 4
|
96
74
|
export const $requestsPendingApi = createSelector($requests, (requests) => {
|
97
75
|
return requests.filter((request) => {
|
98
76
|
const { items } = request;
|
@@ -114,40 +92,71 @@ export const $requestsPendingApiPast = createSelector($requests, (requests) => {
|
|
114
92
|
});
|
115
93
|
});
|
116
94
|
|
117
|
-
//
|
118
|
-
export const $
|
95
|
+
// 4
|
96
|
+
export const $requestsPostAction = createSelector($requests, (requests) => {
|
119
97
|
return requests.filter((request) => {
|
120
98
|
const { items } = request;
|
121
99
|
const lastPoint = items[items.length - 1];
|
122
|
-
return lastPoint && lastPoint.status === LifecycleStatus.
|
100
|
+
return lastPoint && lastPoint.status === LifecycleStatus.POST_ACTION;
|
123
101
|
});
|
124
102
|
});
|
125
103
|
|
126
|
-
export const $
|
104
|
+
export const $requestsPostActionPast = createSelector($requests, (requests) => {
|
127
105
|
return requests.filter((request) => {
|
128
106
|
const { items } = request;
|
129
107
|
|
130
108
|
return items.find(
|
131
|
-
(point) => point.status === LifecycleStatus.
|
109
|
+
(point) => point.status === LifecycleStatus.POST_ACTION
|
132
110
|
);
|
133
111
|
});
|
134
112
|
});
|
135
113
|
|
136
|
-
//
|
137
|
-
export const $
|
114
|
+
// e1
|
115
|
+
export const $requestsGeneralError = createSelector($requests, (requests) => {
|
138
116
|
return requests.filter((request) => {
|
139
117
|
const { items } = request;
|
140
118
|
const lastPoint = items[items.length - 1];
|
141
|
-
return lastPoint && lastPoint.status === LifecycleStatus.
|
119
|
+
return lastPoint && lastPoint.status === LifecycleStatus.GENERAL_ERROR;
|
142
120
|
});
|
143
121
|
});
|
144
122
|
|
145
|
-
export const $
|
123
|
+
export const $requestsGeneralErrorPast = createSelector(
|
124
|
+
$requests,
|
125
|
+
(requests) => {
|
126
|
+
return requests.filter((request) => {
|
127
|
+
const { items } = request;
|
128
|
+
|
129
|
+
return items.find(
|
130
|
+
(point) => point.status === LifecycleStatus.GENERAL_ERROR
|
131
|
+
);
|
132
|
+
});
|
133
|
+
}
|
134
|
+
);
|
135
|
+
|
136
|
+
// e2
|
137
|
+
export const $requestsApiError = createSelector($requests, (requests) => {
|
138
|
+
return requests.filter((request) => {
|
139
|
+
const { items } = request;
|
140
|
+
const lastPoint = items[items.length - 1];
|
141
|
+
return lastPoint && lastPoint.status === LifecycleStatus.API_ERROR;
|
142
|
+
});
|
143
|
+
});
|
144
|
+
|
145
|
+
// e3
|
146
|
+
export const $requestsFailed = createSelector($requests, (requests) => {
|
147
|
+
return requests.filter((request) => {
|
148
|
+
const { items } = request;
|
149
|
+
|
150
|
+
return items.find((point) => point.status === LifecycleStatus.FAILED);
|
151
|
+
});
|
152
|
+
});
|
153
|
+
|
154
|
+
export const $requestsApiErrorPast = createSelector($requests, (requests) => {
|
146
155
|
return requests.filter((request) => {
|
147
156
|
const { items } = request;
|
148
157
|
|
149
158
|
return items.find(
|
150
|
-
(point) => point.status === LifecycleStatus.
|
159
|
+
(point) => point.status === LifecycleStatus.API_ERROR
|
151
160
|
);
|
152
161
|
});
|
153
162
|
});
|
@@ -158,6 +167,7 @@ export const $menuBadges = createSelector(
|
|
158
167
|
$requestsGeneralError,
|
159
168
|
$requestsPendingApi,
|
160
169
|
$requestsApiError,
|
170
|
+
$requestsFailed,
|
161
171
|
$requestsPostAction,
|
162
172
|
(
|
163
173
|
requestsReceived,
|
@@ -165,6 +175,7 @@ export const $menuBadges = createSelector(
|
|
165
175
|
requestsGeneralError,
|
166
176
|
requestsPendingApi,
|
167
177
|
requestsApiError,
|
178
|
+
requestsFailed,
|
168
179
|
requestsPostAction
|
169
180
|
) => {
|
170
181
|
return {
|
@@ -173,6 +184,7 @@ export const $menuBadges = createSelector(
|
|
173
184
|
lifecycleGeneralError: requestsGeneralError.length,
|
174
185
|
lifecyclePendingApi: requestsPendingApi.length,
|
175
186
|
lifecycleApiError: requestsApiError.length,
|
187
|
+
lifecycleFailed: requestsFailed.length,
|
176
188
|
lifecyclePostAction: requestsPostAction.length,
|
177
189
|
};
|
178
190
|
}
|
@@ -184,6 +196,7 @@ export const $menuBadgesTotal = createSelector(
|
|
184
196
|
$requestsGeneralErrorPast,
|
185
197
|
$requestsPendingApiPast,
|
186
198
|
$requestsApiErrorPast,
|
199
|
+
$requestsFailed,
|
187
200
|
$requestsPostActionPast,
|
188
201
|
(
|
189
202
|
requestsReceived,
|
@@ -191,6 +204,7 @@ export const $menuBadgesTotal = createSelector(
|
|
191
204
|
requestsGeneralError,
|
192
205
|
requestsPendingApi,
|
193
206
|
requestsApiError,
|
207
|
+
requestsFailed,
|
194
208
|
requestsPostAction
|
195
209
|
) => {
|
196
210
|
return {
|
@@ -199,6 +213,7 @@ export const $menuBadgesTotal = createSelector(
|
|
199
213
|
lifecycleGeneralError: requestsGeneralError.length,
|
200
214
|
lifecyclePendingApi: requestsPendingApi.length,
|
201
215
|
lifecycleApiError: requestsApiError.length,
|
216
|
+
lifecycleFailed: requestsFailed.length,
|
202
217
|
lifecyclePostAction: requestsPostAction.length,
|
203
218
|
};
|
204
219
|
}
|
package/src/types.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
|
package/src/utils/date.ts
CHANGED
@@ -1,3 +1,11 @@
|
|
1
1
|
export const timestamp = () => new Date().getTime();
|
2
2
|
|
3
|
-
export
|
3
|
+
export let startOfTime = timestamp();
|
4
|
+
|
5
|
+
export const resetStartOfTime = () => {
|
6
|
+
startOfTime = timestamp();
|
7
|
+
};
|
8
|
+
|
9
|
+
export const getMinutes = () => {
|
10
|
+
return new Date().getMinutes();
|
11
|
+
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export const download = (filename: string, json: Json) => {
|
2
|
+
const data = JSON.stringify(json, null, 4);
|
3
|
+
|
4
|
+
const blob = new Blob([data], { type: 'text/csv' });
|
5
|
+
// @ts-ignore
|
6
|
+
if (window.navigator.msSaveOrOpenBlob) {
|
7
|
+
// @ts-ignore
|
8
|
+
window.navigator.msSaveBlob(blob, filename);
|
9
|
+
} else {
|
10
|
+
const elem = window.document.createElement('a');
|
11
|
+
elem.href = window.URL.createObjectURL(blob);
|
12
|
+
elem.download = filename;
|
13
|
+
document.body.appendChild(elem);
|
14
|
+
elem.click();
|
15
|
+
document.body.removeChild(elem);
|
16
|
+
}
|
17
|
+
};
|
package/tsconfig.json
CHANGED
@@ -1,24 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"compilerOptions": {
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"outDir": "dist",
|
4
|
+
"target": "ES2020",
|
5
|
+
"module": "ES2022",
|
6
|
+
"lib": ["ES2020", "dom"],
|
7
|
+
"moduleResolution": "node",
|
6
8
|
"esModuleInterop": true,
|
7
|
-
"
|
8
|
-
"
|
9
|
-
"
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"paths": {
|
15
|
-
"redux-connected": [
|
16
|
-
"redux-connected"
|
17
|
-
],
|
18
|
-
}
|
9
|
+
"declaration": true,
|
10
|
+
"declarationDir": "dist/dts",
|
11
|
+
"jsx": "react-jsx",
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
13
|
+
"strict": true,
|
14
|
+
"skipLibCheck": true,
|
15
|
+
"types": ["types-base", "@types/jest"]
|
19
16
|
},
|
20
|
-
"
|
21
|
-
"node_modules",
|
22
|
-
"vite.config.ts",
|
23
|
-
]
|
17
|
+
"include": ["src/*.ts", "test/*.ts", "src/context.tsx"]
|
24
18
|
}
|
package/vite.config.ts
CHANGED
@@ -1,45 +1,27 @@
|
|
1
|
+
import path from 'path';
|
1
2
|
import { defineConfig } from 'vite';
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
require('dotenv-flow').config();
|
3
|
+
import dts from 'vite-plugin-dts';
|
4
|
+
import { externals } from 'shared-base';
|
5
|
+
import analyze from 'rollup-plugin-analyzer';
|
6
|
+
import p from './package.json';
|
7
7
|
|
8
|
-
const cwd = path.resolve(process.cwd(), '../../');
|
9
|
-
const host = (process.env.VITE_SERVER_DOMAIN||'').replace(/https?:\/\//, '');
|
10
|
-
|
11
|
-
// https://vitejs.dev/config/
|
12
8
|
export default defineConfig({
|
13
|
-
plugins: [
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
'@payem/router': `${cwd}/packages/web-router/src`,
|
30
|
-
'@payem/ui': `${cwd}/packages/web-ui/src`,
|
31
|
-
'@payem/base-ui': `${cwd}/packages/web-base-ui/src`,
|
32
|
-
'@payem/testing-base': `${cwd}/packages/web-testing-base/src`,
|
33
|
-
'@payem/hooks': `${cwd}/packages/hooks/src`,
|
34
|
-
'@payem/root-types': `${cwd}/packages/root-types/src`,
|
35
|
-
'@payem/themes': `${cwd}/packages/web-themes/src`,
|
36
|
-
'@minimal/widgets': `${cwd}/packages/minimal`,
|
37
|
-
'@payem/platformer': `${cwd}/packages/platformer`,
|
38
|
-
'@payem/app-home': `${cwd}/apps/home`,
|
9
|
+
plugins: [dts({})],
|
10
|
+
build: {
|
11
|
+
sourcemap: true,
|
12
|
+
lib: {
|
13
|
+
entry: path.resolve(__dirname, 'src/index.ts'),
|
14
|
+
name: 'ReduxConnectedDevtools',
|
15
|
+
formats: ['es', 'umd'],
|
16
|
+
fileName: (format) => `redux-connected-devtools.${format}.js`,
|
17
|
+
},
|
18
|
+
rollupOptions: {
|
19
|
+
plugins: [analyze()],
|
20
|
+
...externals({
|
21
|
+
react: '',
|
22
|
+
'react/jsx-runtime': '',
|
23
|
+
...p.dependencies,
|
24
|
+
}),
|
39
25
|
},
|
40
|
-
},
|
41
|
-
server: {
|
42
|
-
host,
|
43
|
-
port: 3001,
|
44
26
|
},
|
45
27
|
});
|
package/.vscode/settings.json
DELETED
package/.vscode/tasks.json
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
{
|
2
|
-
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
3
|
-
// for the documentation about the tasks.json format
|
4
|
-
"version": "2.0.0",
|
5
|
-
"command": "npm",
|
6
|
-
"tasks": [
|
7
|
-
{
|
8
|
-
"label": "install",
|
9
|
-
"type": "shell",
|
10
|
-
"command": "npm",
|
11
|
-
"args": ["install"]
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"label": "update",
|
15
|
-
"type": "shell",
|
16
|
-
"command": "npm",
|
17
|
-
"args": ["update"]
|
18
|
-
},
|
19
|
-
{
|
20
|
-
"label": "test",
|
21
|
-
"type": "shell",
|
22
|
-
"command": "npm",
|
23
|
-
"args": ["run", "test"]
|
24
|
-
},
|
25
|
-
{
|
26
|
-
"label": "build",
|
27
|
-
"type": "shell",
|
28
|
-
"group": "build",
|
29
|
-
"command": "npm",
|
30
|
-
"args": ["run", "watch"]
|
31
|
-
}
|
32
|
-
]
|
33
|
-
}
|