create-catalyst-app 0.0.1-beta.2 → 0.0.1-beta.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/{readme.md → Readme.md} +2 -3
- package/license +10 -0
- package/package.json +20 -18
- package/scripts/cli.cjs +242 -0
- package/templates/common/.babelrc +11 -11
- package/templates/common/README.md +16 -20
- package/templates/common/api.js +9 -11
- package/templates/common/client/styles.js +1 -13
- package/templates/common/config/config.json +13 -16
- package/templates/common/public/favicon.ico +0 -0
- package/templates/{none-js → common}/server/document.js +1 -2
- package/templates/common/server/index.js +2 -0
- package/templates/common/server/server.js +8 -0
- package/templates/common/src/js/containers/Home/Home.js +23 -40
- package/templates/common/src/js/containers/Home/Home.scss +34 -0
- package/templates/common/src/js/routes/index.js +9 -42
- package/templates/common/src/static/css/base/index.scss +0 -7
- package/templates/common/src/static/css/base/styles.scss +0 -160
- package/templates/common/src/static/css/resources/_variables.scss +0 -172
- package/{my-app → templates/common}/webpackConfig.js +2 -2
- package/templates/none-js/client/index.js +9 -13
- package/templates/none-js/package.json +6 -36
- package/templates/none-js/src/js/containers/App/index.js +12 -36
- package/templates/none-js/src/js/routes/utils.js +28 -0
- package/templates/redux-js/client/index.js +6 -5
- package/templates/redux-js/package.json +9 -36
- package/templates/redux-js/src/js/containers/App/actions.js +1 -4
- package/templates/redux-js/src/js/containers/App/index.js +12 -38
- package/templates/redux-js/src/js/containers/App/reducer.js +15 -16
- package/templates/redux-js/src/js/routes/utils.js +28 -0
- package/templates/redux-js/src/js/store/index.js +17 -68
- package/templates/rtk-js/client/index.js +6 -5
- package/templates/rtk-js/package.json +9 -36
- package/templates/rtk-js/src/js/containers/App/index.js +12 -38
- package/templates/rtk-js/src/js/containers/App/reducer.js +1 -9
- package/templates/rtk-js/src/js/routes/utils.js +28 -0
- package/templates/rtk-js/src/js/store/index.js +12 -6
- package/my-app/.babelrc +0 -26
- package/my-app/.eslintignore +0 -6
- package/my-app/.eslintrc +0 -53
- package/my-app/.stylelintrc +0 -35
- package/my-app/README.md +0 -23
- package/my-app/api.js +0 -29
- package/my-app/checkVersion.js +0 -3
- package/my-app/client/index.js +0 -27
- package/my-app/client/styles.js +0 -14
- package/my-app/config/config.json +0 -15
- package/my-app/config/config_template.json +0 -18
- package/my-app/config/index.js +0 -44
- package/my-app/package.json +0 -28
- package/my-app/server/document.js +0 -14
- package/my-app/server/index.js +0 -3
- package/my-app/server/server.js +0 -3
- package/my-app/src/js/containers/App/actions.js +0 -20
- package/my-app/src/js/containers/App/index.js +0 -16
- package/my-app/src/js/containers/App/reducer.js +0 -26
- package/my-app/src/js/containers/DemoPage/DemoPage.js +0 -39
- package/my-app/src/js/containers/DemoPage/DemoPage.scss +0 -3
- package/my-app/src/js/containers/Home/Home.js +0 -25
- package/my-app/src/js/containers/Home/Home.scss +0 -36
- package/my-app/src/js/reducer/index.js +0 -80
- package/my-app/src/js/routes/index.js +0 -43
- package/my-app/src/js/stateManager/stateProvider.js +0 -34
- package/my-app/src/js/store/index.js +0 -22
- package/my-app/src/static/css/base/index.scss +0 -2
- package/my-app/src/static/css/base/styles.scss +0 -3
- package/my-app/src/static/css/base/typography.scss +0 -53
- package/my-app/src/static/css/resources/_variables.scss +0 -0
- package/my-app/src/static/fonts/.gitkeep +0 -0
- package/my-app/src/static/fonts/Inter-Bold-Subset.otf +0 -0
- package/my-app/src/static/fonts/Inter-Italic-Subset.otf +0 -0
- package/my-app/src/static/fonts/Inter-Light-Subset.otf +0 -0
- package/my-app/src/static/fonts/Inter-Medium-Subset.otf +0 -0
- package/my-app/src/static/fonts/Inter-Regular-Subset.otf +0 -0
- package/my-app/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
- package/my-app/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
- package/my-app/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
- package/my-app/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
- package/my-app/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
- package/my-app/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
- package/scripts/cli.mjs +0 -266
- package/templates/common/.editorconfig +0 -12
- package/templates/common/.eslintignore +0 -6
- package/templates/common/.eslintrc +0 -53
- package/templates/common/.prettierrc.json +0 -7
- package/templates/common/.stylelintrc +0 -35
- package/templates/common/checkVersion.js +0 -3
- package/templates/common/client/index.js +0 -39
- package/templates/common/config/config_template.json +0 -18
- package/templates/common/config/index.js +0 -77
- package/templates/common/package.json +0 -56
- package/templates/common/server/CustomDocument.js +0 -14
- package/templates/common/server/customIndex.js +0 -3
- package/templates/common/server/customServer.js +0 -16
- package/templates/common/src/js/containers/App/actions.js +0 -20
- package/templates/common/src/js/containers/App/index.js +0 -46
- package/templates/common/src/js/containers/App/reducer.js +0 -21
- package/templates/common/src/js/containers/PDP/PDP.js +0 -37
- package/templates/common/src/js/reducer/index.js +0 -80
- package/templates/common/src/js/stateManager/stateProvider.js +0 -34
- package/templates/common/src/js/store/index.js +0 -77
- package/templates/common/src/static/css/base/_overrides.scss +0 -81
- package/templates/common/src/static/css/base/animations.js +0 -38
- package/templates/common/src/static/css/base/layout.scss +0 -242
- package/templates/common/src/static/css/base/typography.scss +0 -285
- package/templates/common/src/static/css/resources/_mixins.scss +0 -196
- package/templates/common/src/static/css/resources/_vendors.scss +0 -1
- package/templates/common/src/static/fonts/.gitkeep +0 -0
- package/templates/common/src/static/fonts/Inter-Bold-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Inter-Italic-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Inter-Light-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Inter-Medium-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Inter-Regular-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
- package/templates/common/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
- package/templates/common/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
- package/templates/common/src/static/fonts/Poppins-Light-Subset.woff2 +0 -0
- package/templates/common/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
- package/templates/common/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
- package/templates/common/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
- package/templates/none-js/.babelrc +0 -26
- package/templates/none-js/.eslintignore +0 -6
- package/templates/none-js/.eslintrc +0 -53
- package/templates/none-js/.prettierrc.json +0 -7
- package/templates/none-js/.stylelintrc +0 -35
- package/templates/none-js/README.md +0 -22
- package/templates/none-js/api.js +0 -29
- package/templates/none-js/checkVersion.js +0 -3
- package/templates/none-js/client/styles.js +0 -15
- package/templates/none-js/config/config.json +0 -15
- package/templates/none-js/config/config_template.json +0 -18
- package/templates/none-js/config/index.js +0 -44
- package/templates/none-js/server/index.js +0 -3
- package/templates/none-js/server/server.js +0 -16
- package/templates/none-js/src/js/containers/DemoPage/DemoPage.js +0 -39
- package/templates/none-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
- package/templates/none-js/src/js/containers/Home/Home.js +0 -27
- package/templates/none-js/src/js/containers/Home/Home.scss +0 -36
- package/templates/none-js/src/js/routes/index.js +0 -49
- package/templates/none-js/src/js/stateManager/stateProvider.js +0 -19
- package/templates/none-js/src/js/store/index.js +0 -6
- package/templates/none-js/src/static/css/base/index.scss +0 -3
- package/templates/none-js/src/static/css/base/styles.scss +0 -11
- package/templates/none-js/src/static/css/base/typography.scss +0 -53
- package/templates/none-js/src/static/css/resources/_variables.scss +0 -1
- package/templates/none-js/src/static/fonts/.gitkeep +0 -0
- package/templates/none-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
- package/templates/none-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
- package/templates/none-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
- package/templates/none-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
- package/templates/none-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
- package/templates/none-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
- package/templates/none-js/webpackConfig.js +0 -5
- package/templates/redux-js/.babelrc +0 -26
- package/templates/redux-js/.eslintignore +0 -6
- package/templates/redux-js/.eslintrc +0 -53
- package/templates/redux-js/.prettierrc.json +0 -7
- package/templates/redux-js/.stylelintrc +0 -35
- package/templates/redux-js/README.md +0 -22
- package/templates/redux-js/api.js +0 -29
- package/templates/redux-js/checkVersion.js +0 -3
- package/templates/redux-js/client/styles.js +0 -15
- package/templates/redux-js/config/config.json +0 -15
- package/templates/redux-js/config/config_template.json +0 -18
- package/templates/redux-js/config/index.js +0 -44
- package/templates/redux-js/server/document.js +0 -14
- package/templates/redux-js/server/index.js +0 -3
- package/templates/redux-js/server/server.js +0 -16
- package/templates/redux-js/src/js/containers/DemoPage/DemoPage.js +0 -39
- package/templates/redux-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
- package/templates/redux-js/src/js/containers/Home/Home.js +0 -27
- package/templates/redux-js/src/js/containers/Home/Home.scss +0 -36
- package/templates/redux-js/src/js/reducer/index.js +0 -80
- package/templates/redux-js/src/js/routes/index.js +0 -49
- package/templates/redux-js/src/js/stateManager/stateProvider.js +0 -34
- package/templates/redux-js/src/static/css/base/index.scss +0 -3
- package/templates/redux-js/src/static/css/base/styles.scss +0 -11
- package/templates/redux-js/src/static/css/base/typography.scss +0 -53
- package/templates/redux-js/src/static/css/resources/_variables.scss +0 -1
- package/templates/redux-js/src/static/fonts/.gitkeep +0 -0
- package/templates/redux-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
- package/templates/redux-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
- package/templates/redux-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
- package/templates/redux-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
- package/templates/redux-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
- package/templates/redux-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
- package/templates/redux-js/webpackConfig.js +0 -5
- package/templates/rtk-js/.babelrc +0 -26
- package/templates/rtk-js/.eslintignore +0 -6
- package/templates/rtk-js/.eslintrc +0 -53
- package/templates/rtk-js/.prettierrc.json +0 -7
- package/templates/rtk-js/.stylelintrc +0 -35
- package/templates/rtk-js/README.md +0 -23
- package/templates/rtk-js/api.js +0 -29
- package/templates/rtk-js/checkVersion.js +0 -3
- package/templates/rtk-js/client/styles.js +0 -15
- package/templates/rtk-js/config/config.json +0 -15
- package/templates/rtk-js/config/config_template.json +0 -18
- package/templates/rtk-js/config/index.js +0 -44
- package/templates/rtk-js/server/document.js +0 -14
- package/templates/rtk-js/server/index.js +0 -3
- package/templates/rtk-js/server/server.js +0 -16
- package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.js +0 -39
- package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
- package/templates/rtk-js/src/js/containers/Home/Home.js +0 -27
- package/templates/rtk-js/src/js/containers/Home/Home.scss +0 -36
- package/templates/rtk-js/src/js/reducer/index.js +0 -80
- package/templates/rtk-js/src/js/routes/index.js +0 -49
- package/templates/rtk-js/src/js/stateManager/stateProvider.js +0 -34
- package/templates/rtk-js/src/static/css/base/index.scss +0 -3
- package/templates/rtk-js/src/static/css/base/styles.scss +0 -11
- package/templates/rtk-js/src/static/css/base/typography.scss +0 -53
- package/templates/rtk-js/src/static/css/resources/_variables.scss +0 -1
- package/templates/rtk-js/src/static/fonts/.gitkeep +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
- package/templates/rtk-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
- package/templates/rtk-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
- package/templates/rtk-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
- package/templates/rtk-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
- package/templates/rtk-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
- package/templates/rtk-js/webpackConfig.js +0 -5
- /package/{my-app/.prettierrc.json → .prettierrc.json} +0 -0
|
@@ -1,42 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
useLocation,
|
|
4
|
-
useOutlet,
|
|
5
|
-
UNSAFE_LocationContext,
|
|
6
|
-
} from "react-router-dom";
|
|
7
|
-
import {reduxTest} from "./actions"
|
|
8
|
-
import "@css/base/index.scss";
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Outlet } from "@tata1mg/router"
|
|
9
3
|
|
|
10
|
-
|
|
11
|
-
export const BaseOutlet = () => {
|
|
12
|
-
const o = useOutlet();
|
|
13
|
-
const [outlet] = useState(o);
|
|
14
|
-
|
|
15
|
-
return <>{outlet}</>;
|
|
16
|
-
};
|
|
17
4
|
const App = () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</UNSAFE_LocationContext.Provider>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
return (
|
|
28
|
-
<div className={"flexColumn"}>
|
|
29
|
-
<>
|
|
30
|
-
{/* <ShellLocusHeader /> */}
|
|
31
|
-
</>
|
|
32
|
-
<div>{page}</div>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<Outlet />
|
|
8
|
+
</>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
36
11
|
|
|
37
|
-
App.serverSideFunction = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
12
|
+
App.serverSideFunction = () => {
|
|
13
|
+
return new Promise((resolve) => resolve())
|
|
14
|
+
}
|
|
41
15
|
|
|
42
|
-
export default App
|
|
16
|
+
export default App
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { ShellActions } from "./actions"
|
|
1
|
+
import { ShellActions } from "./actions"
|
|
2
2
|
|
|
3
3
|
export const defaultState = {
|
|
4
|
-
|
|
5
|
-
}
|
|
4
|
+
testActionDispatched: false,
|
|
5
|
+
}
|
|
6
6
|
|
|
7
|
-
const shellReducer = (state = defaultState, action) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export const shellReducer = (state = defaultState, action) => {
|
|
8
|
+
switch (action.type) {
|
|
9
|
+
case ShellActions.REDUX_TEST: {
|
|
10
|
+
return {
|
|
11
|
+
...state,
|
|
12
|
+
testActionDispatched: true,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
16
|
+
default:
|
|
17
|
+
return state
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
|
-
export default shellReducer;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { RouterDataProvider, MetaTag } from "@tata1mg/router"
|
|
3
|
+
import App from "@containers/App"
|
|
4
|
+
import routes from "./index.js"
|
|
5
|
+
|
|
6
|
+
export const preparedRoutes = ({ store, routerInitialState }) => {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
element: (
|
|
10
|
+
<RouterDataProvider config={{}} initialState={routerInitialState} fetcherArgs={{ store }}>
|
|
11
|
+
<MetaTag />
|
|
12
|
+
<App />
|
|
13
|
+
</RouterDataProvider>
|
|
14
|
+
),
|
|
15
|
+
children: getRoutes()?.map((route, index) => {
|
|
16
|
+
const Component = route.component
|
|
17
|
+
return {
|
|
18
|
+
...route,
|
|
19
|
+
element: <Component key={index} />,
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const getRoutes = () => {
|
|
27
|
+
return routes
|
|
28
|
+
}
|
|
@@ -1,79 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import createReducerManager from "../reducer/index.js"
|
|
7
|
-
import fetchInstance from "../../../api.js"
|
|
1
|
+
import { configureStore as createStore } from "@reduxjs/toolkit"
|
|
2
|
+
import { combineReducers } from "redux"
|
|
3
|
+
import { shellReducer } from "@containers/App/reducer.js"
|
|
4
|
+
import fetchInstance from "@api"
|
|
5
|
+
|
|
8
6
|
/**
|
|
9
7
|
* Function that initializes the store with the initialstate and adds middlewares that can be used during action dispatch
|
|
10
8
|
* @param {object} initialState Default state
|
|
11
|
-
* @param {object}
|
|
12
|
-
* @
|
|
13
|
-
* @return {object} the store itself
|
|
9
|
+
* @param {object} request Request object that we recieve on server, this is only recieved when store is initialized on the server.
|
|
10
|
+
* @return {object} The store itself
|
|
14
11
|
*/
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export default function configureStore(initialState, request) {
|
|
19
|
-
|
|
20
|
-
// The variable defined below acts as a flag when the store is initialized on the client side
|
|
21
|
-
// Reason being that for the first time we need to actually need to forcefully set the reducer for which we have the initial data
|
|
22
|
-
let initializeClient = true
|
|
23
|
-
|
|
24
|
-
const reducerManager = createReducerManager()
|
|
25
|
-
|
|
26
|
-
// FRAMEWORK COMMENT. This should be exposed to user.
|
|
13
|
+
const configureStore = (initialState) => {
|
|
27
14
|
const api = fetchInstance
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// disable redux-logger in server - https://github.com/LogRocket/redux-logger/issues/6
|
|
31
|
-
const reduxLogger = createLogger({
|
|
32
|
-
predicate: () => typeof window !== "undefined",
|
|
33
|
-
})
|
|
34
|
-
const addReducer = (reducer) => {
|
|
35
|
-
// Only executed once when for the first run in client - side
|
|
36
|
-
if (initializeClient) {
|
|
37
|
-
initializeClient = false
|
|
38
|
-
return store.replaceReducer(reducerManager.add(reducer))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// This blocks check if the reducer is already added or not in store
|
|
42
|
-
// If not then it only add the missing reducers
|
|
43
|
-
// And if the required reducers are already present then we simply return without performing any change
|
|
44
|
-
let reducerToAdd = {}
|
|
45
|
-
const currentState = store.getState()
|
|
46
|
-
for (let key in reducer) {
|
|
47
|
-
if (!currentState[key]) {
|
|
48
|
-
reducerToAdd[key] = reducer[key]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (Object.keys(reducerToAdd).length > 0) {
|
|
52
|
-
return store.replaceReducer(reducerManager.add(reducerToAdd))
|
|
53
|
-
}
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
let middleware = [thunk.withExtraArgument({ api, addReducer })]
|
|
57
|
-
if(process.env.NODE_ENV !== "production"){
|
|
58
|
-
middleware = [...middleware,reduxLogger]
|
|
59
|
-
}
|
|
60
|
-
// Add universal enhancers here
|
|
61
|
-
let enhancers = []
|
|
62
|
-
|
|
63
|
-
const composeEnhancers = process.env.NODE_ENV === "production" && (typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose
|
|
64
|
-
const enhancer = composeEnhancers(...[applyMiddleware(...middleware), ...enhancers])
|
|
65
|
-
|
|
66
|
-
// create store with enhancers, middleware, reducers, and initialState
|
|
67
|
-
// When the store is initialized on the client side, we are passing a function that just returns the initial State from the server
|
|
68
|
-
// This is way we are able to maintain the initial state from the server on the client side and then add the relevant reducers
|
|
69
|
-
// Which then consumes the initial state
|
|
70
15
|
const store = createStore({
|
|
71
|
-
reducer:combineReducers({shellReducer}),
|
|
72
|
-
|
|
16
|
+
reducer: combineReducers({ shellReducer }),
|
|
17
|
+
middleware: (getDefaultMiddleware) =>
|
|
18
|
+
getDefaultMiddleware({
|
|
19
|
+
thunk: {
|
|
20
|
+
extraArgument: { api },
|
|
21
|
+
},
|
|
22
|
+
}),
|
|
23
|
+
preloadedState: initialState,
|
|
73
24
|
})
|
|
74
|
-
|
|
75
|
-
|
|
76
25
|
return store
|
|
77
26
|
}
|
|
78
27
|
|
|
79
|
-
|
|
28
|
+
export default configureStore
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
+
import "./styles"
|
|
2
3
|
import { hydrateRoot } from "react-dom/client"
|
|
3
4
|
import { loadableReady } from "@loadable/component"
|
|
4
5
|
import { Provider } from "react-redux"
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import configureStore from "
|
|
8
|
-
import "./styles"
|
|
6
|
+
import { RouterProvider } from "@tata1mg/router"
|
|
7
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
8
|
+
import configureStore from "@store"
|
|
9
9
|
|
|
10
10
|
window.addEventListener("load", () => {
|
|
11
11
|
loadableReady(() => {
|
|
12
12
|
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
13
13
|
const store = configureStore(__INITIAL_STATE__ || {})
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
15
16
|
|
|
16
17
|
const Application = (
|
|
17
18
|
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
@@ -1,52 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-catalyst-app-starter",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"description": "This README would normally document whatever steps are necessary to get your application up and running.",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"bin": "scripts/cli.mjs",
|
|
7
4
|
"scripts": {
|
|
8
5
|
"start": "catalyst start",
|
|
9
6
|
"build": "catalyst build",
|
|
10
7
|
"serve": "catalyst serve"
|
|
11
8
|
},
|
|
12
9
|
"_moduleAliases": {
|
|
10
|
+
"@api": "api.js",
|
|
13
11
|
"@containers": "src/js/containers",
|
|
14
|
-
"@
|
|
15
|
-
"$server": "server",
|
|
16
|
-
"@constants": "src/js/constants",
|
|
12
|
+
"@server": "server",
|
|
17
13
|
"@config": "config",
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/tata1mg/catalyst"
|
|
14
|
+
"@css": "src/static/css",
|
|
15
|
+
"@routes": "src/js/routes/",
|
|
16
|
+
"@store": "src/js/store/index.js"
|
|
24
17
|
},
|
|
25
18
|
"dependencies": {
|
|
26
19
|
"@loadable/component": "^5.16.3",
|
|
27
|
-
"@tata1mg/router": "^0.0.1-
|
|
28
|
-
"catalyst-core":"0.0.1-beta.
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"framer-motion": "^10.18.0",
|
|
32
|
-
"isomorphic-dompurify": "^2.2.0",
|
|
33
|
-
"normalize.css": "^8.0.1",
|
|
34
|
-
"prop-types": "^15.8.1",
|
|
35
|
-
"react-dfp": "^0.21.0",
|
|
36
|
-
"react-helmet-async":"^1.3.0",
|
|
37
|
-
"react-intersection-observer": "^9.5.3",
|
|
38
|
-
"react-loadable-visibility": "^3.0.2",
|
|
39
|
-
"react-redux": "^8.1.3",
|
|
40
|
-
"@reduxjs/toolkit": "1.9.3"
|
|
41
|
-
},
|
|
42
|
-
"author": "",
|
|
43
|
-
"license": "ISC",
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/tata1mg/catalyst/issues"
|
|
46
|
-
},
|
|
47
|
-
"homepage": "https://github.com/tata1mg/catalyst#readme",
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.23.7",
|
|
50
|
-
"@babel/node": "^7.22.19"
|
|
20
|
+
"@tata1mg/router": "^0.0.1-beta.0",
|
|
21
|
+
"catalyst-core": "^0.0.1-beta.3",
|
|
22
|
+
"@reduxjs/toolkit": "1.9.3",
|
|
23
|
+
"react-redux": "^8.1.3"
|
|
51
24
|
}
|
|
52
25
|
}
|
|
@@ -1,42 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
useLocation,
|
|
4
|
-
useOutlet,
|
|
5
|
-
UNSAFE_LocationContext,
|
|
6
|
-
} from "react-router-dom";
|
|
7
|
-
import {reduxTest} from "./reducer.js"
|
|
8
|
-
import "@css/base/index.scss";
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { Outlet } from "@tata1mg/router"
|
|
9
3
|
|
|
10
|
-
|
|
11
|
-
export const BaseOutlet = () => {
|
|
12
|
-
const o = useOutlet();
|
|
13
|
-
const [outlet] = useState(o);
|
|
14
|
-
|
|
15
|
-
return <>{outlet}</>;
|
|
16
|
-
};
|
|
17
4
|
const App = () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</UNSAFE_LocationContext.Provider>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
return (
|
|
28
|
-
<div className={"flexColumn"}>
|
|
29
|
-
<>
|
|
30
|
-
{/* <ShellLocusHeader /> */}
|
|
31
|
-
</>
|
|
32
|
-
<div>{page}</div>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<Outlet />
|
|
8
|
+
</>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
36
11
|
|
|
37
|
-
App.serverSideFunction = (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
12
|
+
App.serverSideFunction = () => {
|
|
13
|
+
return new Promise((resolve) => resolve())
|
|
14
|
+
}
|
|
41
15
|
|
|
42
|
-
export default App
|
|
16
|
+
export default App
|
|
@@ -8,7 +8,7 @@ export const appSlice = createSlice({
|
|
|
8
8
|
name: "shellReducer",
|
|
9
9
|
initialState: initialState,
|
|
10
10
|
reducers: {
|
|
11
|
-
reduxTest: (state
|
|
11
|
+
reduxTest: (state) => {
|
|
12
12
|
state.testActionDispatched = true
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -16,11 +16,3 @@ export const appSlice = createSlice({
|
|
|
16
16
|
|
|
17
17
|
export const { reduxTest } = appSlice.actions
|
|
18
18
|
export const shellReducer = appSlice.reducer
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { RouterDataProvider, MetaTag } from "@tata1mg/router"
|
|
3
|
+
import App from "@containers/App"
|
|
4
|
+
import routes from "./index.js"
|
|
5
|
+
|
|
6
|
+
export const preparedRoutes = ({ store, routerInitialState }) => {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
element: (
|
|
10
|
+
<RouterDataProvider config={{}} initialState={routerInitialState} fetcherArgs={{ store }}>
|
|
11
|
+
<MetaTag />
|
|
12
|
+
<App />
|
|
13
|
+
</RouterDataProvider>
|
|
14
|
+
),
|
|
15
|
+
children: getRoutes()?.map((route, index) => {
|
|
16
|
+
const Component = route.component
|
|
17
|
+
return {
|
|
18
|
+
...route,
|
|
19
|
+
element: <Component key={index} />,
|
|
20
|
+
}
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const getRoutes = () => {
|
|
27
|
+
return routes
|
|
28
|
+
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { configureStore as createStore } from "@reduxjs/toolkit"
|
|
2
|
-
import {combineReducers} from "redux"
|
|
3
|
-
import {shellReducer} from "@containers/App/reducer.js"
|
|
4
|
-
import fetchInstance from "
|
|
2
|
+
import { combineReducers } from "redux"
|
|
3
|
+
import { shellReducer } from "@containers/App/reducer.js"
|
|
4
|
+
import fetchInstance from "@api"
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Function that initializes the store with the initialstate and adds middlewares that can be used during action dispatch
|
|
8
|
+
* @param {object} initialState Default state
|
|
9
|
+
* @param {object} request Request object that we recieve on server, this is only recieved when store is initialized on the server.
|
|
10
|
+
* @return {object} The store itself
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const configureStore = (initialState) => {
|
|
7
14
|
const api = fetchInstance
|
|
8
15
|
const store = createStore({
|
|
9
|
-
reducer: combineReducers({shellReducer}),
|
|
16
|
+
reducer: combineReducers({ shellReducer }),
|
|
10
17
|
middleware: (getDefaultMiddleware) =>
|
|
11
18
|
getDefaultMiddleware({
|
|
12
19
|
thunk: {
|
|
@@ -18,5 +25,4 @@ const configureStore = (initialState,request) => {
|
|
|
18
25
|
return store
|
|
19
26
|
}
|
|
20
27
|
|
|
21
|
-
|
|
22
28
|
export default configureStore
|
package/my-app/.babelrc
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"presets": [
|
|
3
|
-
[
|
|
4
|
-
"@babel/preset-env",
|
|
5
|
-
{
|
|
6
|
-
"targets": {
|
|
7
|
-
"node": "current"
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
],
|
|
11
|
-
"@babel/preset-react"
|
|
12
|
-
],
|
|
13
|
-
"plugins": [
|
|
14
|
-
"@babel/plugin-proposal-object-rest-spread",
|
|
15
|
-
"transform-es2015-modules-commonjs",
|
|
16
|
-
"transform-class-properties",
|
|
17
|
-
"dynamic-import-node",
|
|
18
|
-
"@loadable/babel-plugin"
|
|
19
|
-
],
|
|
20
|
-
"env": {
|
|
21
|
-
"test": {
|
|
22
|
-
"presets": ["@babel/preset-react"]
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"ignore": ["__TEST__"]
|
|
26
|
-
}
|
package/my-app/.eslintignore
DELETED
package/my-app/.eslintrc
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@babel/eslint-parser",
|
|
3
|
-
"rules": {
|
|
4
|
-
"prettier/prettier": "error",
|
|
5
|
-
"no-console": "warn",
|
|
6
|
-
"react/prop-types": 1,
|
|
7
|
-
"react/display-name": [0, { "ignoreTranspilerName": true }],
|
|
8
|
-
"react-hooks/exhaustive-deps": "warn", // Checks effect dependencies
|
|
9
|
-
"no-prototype-builtins": "off",
|
|
10
|
-
"jam3/no-sanitizer-with-danger": 2,
|
|
11
|
-
"react/jsx-no-target-blank": [0, {
|
|
12
|
-
"enforceDynamicLinks": "never"
|
|
13
|
-
}]
|
|
14
|
-
},
|
|
15
|
-
"env": {
|
|
16
|
-
"browser": true,
|
|
17
|
-
"es6": true,
|
|
18
|
-
"jest": true,
|
|
19
|
-
"node": true
|
|
20
|
-
},
|
|
21
|
-
"globals": {
|
|
22
|
-
"expect": true,
|
|
23
|
-
"__non_webpack_require__": true,
|
|
24
|
-
"logger": "readonly",
|
|
25
|
-
"AppCallbacks": "readonly"
|
|
26
|
-
},
|
|
27
|
-
"extends": ["eslint:recommended", "plugin:react/recommended"],
|
|
28
|
-
"parserOptions": {
|
|
29
|
-
"sourceType": "module",
|
|
30
|
-
"ecmaFeatures": {
|
|
31
|
-
"experimentalObjectRestSpread": true,
|
|
32
|
-
"jsx": true
|
|
33
|
-
},
|
|
34
|
-
"babelOptions": {
|
|
35
|
-
"configFile": "./babel.config.js"
|
|
36
|
-
},
|
|
37
|
-
"ecmaVersion": 6
|
|
38
|
-
},
|
|
39
|
-
"plugins": ["babel", "react", "react-hooks", "prettier", "jam3"],
|
|
40
|
-
"settings": {
|
|
41
|
-
"react": {
|
|
42
|
-
"createClass": "createReactClass",
|
|
43
|
-
"pragma": "React",
|
|
44
|
-
"version": "detect"
|
|
45
|
-
},
|
|
46
|
-
"propWrapperFunctions": [
|
|
47
|
-
"forbidExtraProps",
|
|
48
|
-
{ "property": "freeze", "object": "Object" },
|
|
49
|
-
{ "property": "myFavoriteWrapper" }
|
|
50
|
-
],
|
|
51
|
-
"linkComponents": ["Hyperlink", { "name": "Link", "linkAttribute": "to" }]
|
|
52
|
-
}
|
|
53
|
-
}
|
package/my-app/.stylelintrc
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"stylelint-config-standard-scss",
|
|
4
|
-
"stylelint-config-prettier-scss",
|
|
5
|
-
"stylelint-config-css-modules"
|
|
6
|
-
],
|
|
7
|
-
"plugins": ["stylelint-prettier"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"property-no-vendor-prefix":null,
|
|
10
|
-
"scss/function-no-unknown": null,
|
|
11
|
-
"selector-class-pattern": null,
|
|
12
|
-
"prettier/prettier": true,
|
|
13
|
-
"color-no-invalid-hex": true,
|
|
14
|
-
"comment-empty-line-before": ["always", { "ignore": ["stylelint-commands", "after-comment"] }],
|
|
15
|
-
"indentation": 4,
|
|
16
|
-
"number-leading-zero": null,
|
|
17
|
-
"max-empty-lines": 2,
|
|
18
|
-
"declaration-no-important": true,
|
|
19
|
-
"block-no-empty": true,
|
|
20
|
-
"no-empty-source": null,
|
|
21
|
-
"selector-pseudo-class-no-unknown": null,
|
|
22
|
-
"selector-type-no-unknown": null,
|
|
23
|
-
"rule-empty-line-before": ["always", { "except": ["first-nested"], "ignore": ["after-comment"] }],
|
|
24
|
-
"declaration-property-unit-allowed-list": {
|
|
25
|
-
"/.*/": ["em", "rem", "%", "s", "vh", "vw", "px", "deg", "ms", "dpi", "dvh", "fr"]
|
|
26
|
-
},
|
|
27
|
-
"at-rule-no-unknown": null,
|
|
28
|
-
"scss/double-slash-comment-whitespace-inside": null,
|
|
29
|
-
"scss/at-mixin-pattern": null,
|
|
30
|
-
"scss/dollar-variable-pattern": null,
|
|
31
|
-
"selector-id-pattern": null,
|
|
32
|
-
"keyframes-name-pattern": null,
|
|
33
|
-
"selector-pseudo-element-no-unknown": null
|
|
34
|
-
}
|
|
35
|
-
}
|
package/my-app/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
## Getting Started
|
|
2
|
-
Commence development by initiating the application in development mode with the following commands:
|
|
3
|
-
|
|
4
|
-
For running the application in development mode, run:
|
|
5
|
-
|
|
6
|
-
```bash
|
|
7
|
-
npm run start
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
For a production build, utilize:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm run build
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
To serve the production build, execute:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm run serve
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Documentation
|
|
23
|
-
Explore the complete documentation at [https://catalyst.1mg.com](https://catalyst.1mg.com).
|
package/my-app/api.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const apiInstance = () => {
|
|
2
|
-
const fetchFunction = async (url, options) => {
|
|
3
|
-
let baseURL = process.env.API_URL
|
|
4
|
-
let finalUrl = baseURL + url
|
|
5
|
-
|
|
6
|
-
// Request Interceptor - you can modify request here
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// Add query params if exist
|
|
10
|
-
if (Object.keys(options?.params).length > 0) {
|
|
11
|
-
finalUrl = url + "?" + new URLSearchParams(options.params)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return fetch(finalUrl, options)
|
|
15
|
-
.then(async (response) => {
|
|
16
|
-
const parsedResponse = await response.json()
|
|
17
|
-
// Response Interceptor - you can modify response here
|
|
18
|
-
return parsedResponse
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
get: fetchFunction,
|
|
23
|
-
post: fetchFunction,
|
|
24
|
-
delete: fetchFunction,
|
|
25
|
-
patch: fetchFunction,
|
|
26
|
-
put: fetchFunction
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export default { apiInstance }
|
package/my-app/checkVersion.js
DELETED
package/my-app/client/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import "./styles"
|
|
3
|
-
import { hydrateRoot } from "react-dom/client"
|
|
4
|
-
import { loadableReady } from "@loadable/component"
|
|
5
|
-
import { Provider } from "react-redux"
|
|
6
|
-
import { createBrowserRouter, RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import { preparedRoutes } from "@routes"
|
|
8
|
-
import configureStore from "@store"
|
|
9
|
-
|
|
10
|
-
window.addEventListener("load", () => {
|
|
11
|
-
loadableReady(() => {
|
|
12
|
-
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
13
|
-
const store = configureStore(__INITIAL_STATE__ || {})
|
|
14
|
-
const router = createBrowserRouter(preparedRoutes({ store, routerInitialState: routerInitialData }))
|
|
15
|
-
|
|
16
|
-
const Application = (
|
|
17
|
-
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
18
|
-
<React.StrictMode>
|
|
19
|
-
<RouterProvider router={router} />
|
|
20
|
-
</React.StrictMode>
|
|
21
|
-
</Provider>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const container = document.getElementById("app")
|
|
25
|
-
hydrateRoot(container, Application)
|
|
26
|
-
})
|
|
27
|
-
})
|