create-catalyst-app 0.0.1-beta.9 → 0.0.2-canary.1
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/package.json +1 -1
- package/templates/common/config/config.json +5 -3
- package/templates/common/server/server.js +7 -2
- package/templates/common/src/js/containers/Home/{Home.js → Home.jsx} +1 -1
- package/templates/common/src/js/routes/{index.js → index.jsx} +1 -1
- package/templates/common/src/static/css/resources/index.scss +1 -0
- package/templates/none-js/client/index.jsx +18 -0
- package/templates/none-js/package.json +4 -5
- package/templates/none-js/src/js/containers/App/{index.js → index.jsx} +1 -1
- package/templates/none-js/src/js/routes/{utils.js → utils.jsx} +17 -5
- package/templates/redux-js/client/index.jsx +23 -0
- package/templates/redux-js/package.json +2 -3
- package/templates/redux-js/src/js/containers/App/{index.js → index.jsx} +1 -1
- package/templates/redux-js/src/js/containers/App/reducer.js +1 -1
- package/templates/{rtk-js/src/js/routes/utils.js → redux-js/src/js/routes/utils.jsx} +17 -5
- package/templates/redux-js/src/js/store/index.js +2 -1
- package/templates/rtk-js/client/index.jsx +23 -0
- package/templates/rtk-js/package.json +2 -3
- package/templates/rtk-js/src/js/containers/App/{index.js → index.jsx} +1 -1
- package/templates/{redux-js/src/js/routes/utils.js → rtk-js/src/js/routes/utils.jsx} +17 -5
- package/templates/rtk-js/src/js/store/index.js +2 -1
- package/templates/none-js/client/index.js +0 -23
- package/templates/redux-js/client/index.js +0 -28
- package/templates/rtk-js/client/index.js +0 -28
- /package/templates/common/server/{document.js → document.jsx} +0 -0
- /package/templates/common/src/js/containers/Home/{Home.scss → Home.module.scss} +0 -0
package/package.json
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
"WEBPACK_DEV_SERVER_HOSTNAME": "localhost",
|
|
5
5
|
"WEBPACK_DEV_SERVER_PORT": 3006,
|
|
6
6
|
"BUILD_OUTPUT_PATH": "build",
|
|
7
|
-
"PUBLIC_STATIC_ASSET_PATH": "/
|
|
7
|
+
"PUBLIC_STATIC_ASSET_PATH": "/client/",
|
|
8
8
|
"PUBLIC_STATIC_ASSET_URL": "http://localhost:3005",
|
|
9
9
|
"API_URL": "",
|
|
10
10
|
"ANALYZE_BUNDLE": false,
|
|
11
|
-
"CLIENT_ENV_VARIABLES": [
|
|
12
|
-
|
|
11
|
+
"CLIENT_ENV_VARIABLES": [
|
|
12
|
+
"API_URL"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import express from "express"
|
|
2
|
+
import path from "path"
|
|
3
|
+
import { fileURLToPath } from "node:url"
|
|
4
|
+
import { dirname } from "node:path"
|
|
5
|
+
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
+
const __dirname = dirname(__filename)
|
|
3
8
|
|
|
4
9
|
// Server middlewares are added here.
|
|
5
10
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import "./variables.scss";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import "./styles"
|
|
3
|
+
import { hydrateRoot } from "react-dom/client"
|
|
4
|
+
import { RouterProvider } from "catalyst-core"
|
|
5
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
6
|
+
|
|
7
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
|
|
8
|
+
|
|
9
|
+
const router = clientRouter({ routerInitialState: routerInitialData })
|
|
10
|
+
|
|
11
|
+
const Application = (
|
|
12
|
+
<React.StrictMode>
|
|
13
|
+
<RouterProvider router={router} />
|
|
14
|
+
</React.StrictMode>
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
const container = document.getElementById("app")
|
|
18
|
+
hydrateRoot(container, Application)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-catalyst-app-starter",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"scripts": {
|
|
5
6
|
"start": "catalyst start",
|
|
6
7
|
"build": "catalyst build",
|
|
@@ -17,14 +18,12 @@
|
|
|
17
18
|
"@css": "src/static/css",
|
|
18
19
|
"@routes": "src/js/routes/"
|
|
19
20
|
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"@loadable/component": "^5.16.3",
|
|
22
|
-
"@tata1mg/router": "^0.0.1-beta.5",
|
|
23
|
-
"catalyst-core": "^0.0.1-beta.8"
|
|
24
|
-
},
|
|
25
21
|
"devDependencies": {
|
|
26
22
|
"eslint": "^8.26.0",
|
|
27
23
|
"eslint-plugin-react": "^7.34.1",
|
|
28
24
|
"eslint-plugin-react-hooks": "^4.6.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"catalyst-core": "^0.0.2-canary.1"
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { RouterDataProvider, MetaTag } from "
|
|
3
|
-
import App from "@containers/App"
|
|
4
|
-
import routes from "./index.
|
|
1
|
+
import React, { Suspense } from "react"
|
|
2
|
+
import { RouterDataProvider, MetaTag } from "catalyst-core"
|
|
3
|
+
import App from "@containers/App/index.jsx"
|
|
4
|
+
import routes from "./index.jsx"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Making the routes array compatible with the format accepted by createBrowserRouter
|
|
@@ -12,10 +12,22 @@ import routes from "./index.js"
|
|
|
12
12
|
export const preparedRoutes = ({ routerInitialState }) => {
|
|
13
13
|
const getPreparedRoutes = (routes) => {
|
|
14
14
|
return routes.map((route, index) => {
|
|
15
|
+
let element = null
|
|
15
16
|
const Component = route.component
|
|
17
|
+
|
|
18
|
+
if (typeof Component === "object" && route.fallback) {
|
|
19
|
+
element = (
|
|
20
|
+
<Suspense fallback={route.fallback}>
|
|
21
|
+
<Component key={index} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
)
|
|
24
|
+
} else {
|
|
25
|
+
element = <Component key={index} />
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const routeToRender = {
|
|
17
29
|
...route,
|
|
18
|
-
element:
|
|
30
|
+
element: element,
|
|
19
31
|
}
|
|
20
32
|
if (route.children) {
|
|
21
33
|
routeToRender.children = getPreparedRoutes(route.children)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import "./styles"
|
|
3
|
+
import { hydrateRoot } from "react-dom/client"
|
|
4
|
+
import { Provider } from "react-redux"
|
|
5
|
+
import { RouterProvider } from "catalyst-core"
|
|
6
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import configureStore from "@store"
|
|
8
|
+
|
|
9
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
10
|
+
const store = configureStore(__INITIAL_STATE__ || {})
|
|
11
|
+
|
|
12
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
13
|
+
|
|
14
|
+
const Application = (
|
|
15
|
+
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
16
|
+
<React.StrictMode>
|
|
17
|
+
<RouterProvider router={router} />
|
|
18
|
+
</React.StrictMode>
|
|
19
|
+
</Provider>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const container = document.getElementById("app")
|
|
23
|
+
hydrateRoot(container, Application)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-catalyst-app-starter",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"scripts": {
|
|
5
6
|
"start": "catalyst start",
|
|
6
7
|
"build": "catalyst build",
|
|
@@ -19,10 +20,8 @@
|
|
|
19
20
|
"@store": "src/js/store/index.js"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@loadable/component": "^5.16.3",
|
|
23
|
-
"@tata1mg/router": "^0.0.1-beta.5",
|
|
24
|
-
"catalyst-core": "0.0.1-beta.8",
|
|
25
23
|
"@reduxjs/toolkit": "1.9.3",
|
|
24
|
+
"catalyst-core": "^0.0.2-canary.1",
|
|
26
25
|
"react-redux": "^8.1.3"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { RouterDataProvider, MetaTag } from "
|
|
3
|
-
import App from "@containers/App"
|
|
4
|
-
import routes from "./index.
|
|
1
|
+
import React, { Suspense } from "react"
|
|
2
|
+
import { RouterDataProvider, MetaTag } from "catalyst-core"
|
|
3
|
+
import App from "@containers/App/index.jsx"
|
|
4
|
+
import routes from "./index.jsx"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Making the routes array compatible with the format accepted by createBrowserRouter
|
|
@@ -12,10 +12,22 @@ import routes from "./index.js"
|
|
|
12
12
|
export const preparedRoutes = ({ store, routerInitialState }) => {
|
|
13
13
|
const getPreparedRoutes = (routes) => {
|
|
14
14
|
return routes.map((route, index) => {
|
|
15
|
+
let element = null
|
|
15
16
|
const Component = route.component
|
|
17
|
+
|
|
18
|
+
if (typeof Component === "object" && route.fallback) {
|
|
19
|
+
element = (
|
|
20
|
+
<Suspense fallback={route.fallback}>
|
|
21
|
+
<Component key={index} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
)
|
|
24
|
+
} else {
|
|
25
|
+
element = <Component key={index} />
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const routeToRender = {
|
|
17
29
|
...route,
|
|
18
|
-
element:
|
|
30
|
+
element: element,
|
|
19
31
|
}
|
|
20
32
|
if (route.children) {
|
|
21
33
|
routeToRender.children = getPreparedRoutes(route.children)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as toolkitRaw from "@reduxjs/toolkit"
|
|
2
|
+
const { configureStore: createStore } = toolkitRaw.default ?? toolkitRaw
|
|
2
3
|
import { combineReducers } from "redux"
|
|
3
4
|
import { shellReducer } from "@containers/App/reducer.js"
|
|
4
5
|
import fetchInstance from "@api"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import "./styles"
|
|
3
|
+
import { hydrateRoot } from "react-dom/client"
|
|
4
|
+
import { Provider } from "react-redux"
|
|
5
|
+
import { RouterProvider } from "catalyst-core"
|
|
6
|
+
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
+
import configureStore from "@store"
|
|
8
|
+
|
|
9
|
+
const { __ROUTER_INITIAL_DATA__: routerInitialData, __INITIAL_STATE__ } = window
|
|
10
|
+
const store = configureStore(__INITIAL_STATE__ || {})
|
|
11
|
+
|
|
12
|
+
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
13
|
+
|
|
14
|
+
const Application = (
|
|
15
|
+
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
16
|
+
<React.StrictMode>
|
|
17
|
+
<RouterProvider router={router} />
|
|
18
|
+
</React.StrictMode>
|
|
19
|
+
</Provider>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const container = document.getElementById("app")
|
|
23
|
+
hydrateRoot(container, Application)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-catalyst-app-starter",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"scripts": {
|
|
5
6
|
"start": "catalyst start",
|
|
6
7
|
"build": "catalyst build",
|
|
@@ -19,10 +20,8 @@
|
|
|
19
20
|
"@store": "src/js/store/index.js"
|
|
20
21
|
},
|
|
21
22
|
"dependencies": {
|
|
22
|
-
"@loadable/component": "^5.16.3",
|
|
23
|
-
"@tata1mg/router": "^0.0.1-beta.5",
|
|
24
|
-
"catalyst-core": "^0.0.1-beta.8",
|
|
25
23
|
"@reduxjs/toolkit": "1.9.3",
|
|
24
|
+
"catalyst-core": "^0.0.2-canary.1",
|
|
26
25
|
"react-redux": "^8.1.3"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import { RouterDataProvider, MetaTag } from "
|
|
3
|
-
import App from "@containers/App"
|
|
4
|
-
import routes from "./index.
|
|
1
|
+
import React, { Suspense } from "react"
|
|
2
|
+
import { RouterDataProvider, MetaTag } from "catalyst-core"
|
|
3
|
+
import App from "@containers/App/index.jsx"
|
|
4
|
+
import routes from "./index.jsx"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Making the routes array compatible with the format accepted by createBrowserRouter
|
|
@@ -12,10 +12,22 @@ import routes from "./index.js"
|
|
|
12
12
|
export const preparedRoutes = ({ store, routerInitialState }) => {
|
|
13
13
|
const getPreparedRoutes = (routes) => {
|
|
14
14
|
return routes.map((route, index) => {
|
|
15
|
+
let element = null
|
|
15
16
|
const Component = route.component
|
|
17
|
+
|
|
18
|
+
if (typeof Component === "object" && route.fallback) {
|
|
19
|
+
element = (
|
|
20
|
+
<Suspense fallback={route.fallback}>
|
|
21
|
+
<Component key={index} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
)
|
|
24
|
+
} else {
|
|
25
|
+
element = <Component key={index} />
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
const routeToRender = {
|
|
17
29
|
...route,
|
|
18
|
-
element:
|
|
30
|
+
element: element,
|
|
19
31
|
}
|
|
20
32
|
if (route.children) {
|
|
21
33
|
routeToRender.children = getPreparedRoutes(route.children)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as toolkitRaw from "@reduxjs/toolkit"
|
|
2
|
+
const { configureStore: createStore } = toolkitRaw.default ?? toolkitRaw
|
|
2
3
|
import { combineReducers } from "redux"
|
|
3
4
|
import { shellReducer } from "@containers/App/reducer.js"
|
|
4
5
|
import fetchInstance from "@api"
|
|
@@ -1,23 +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 { RouterProvider } from "@tata1mg/router"
|
|
6
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
7
|
-
|
|
8
|
-
window.addEventListener("load", () => {
|
|
9
|
-
loadableReady(() => {
|
|
10
|
-
const { __ROUTER_INITIAL_DATA__: routerInitialData } = window
|
|
11
|
-
|
|
12
|
-
const router = clientRouter({ routerInitialState: routerInitialData })
|
|
13
|
-
|
|
14
|
-
const Application = (
|
|
15
|
-
<React.StrictMode>
|
|
16
|
-
<RouterProvider router={router} />
|
|
17
|
-
</React.StrictMode>
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const container = document.getElementById("app")
|
|
21
|
-
hydrateRoot(container, Application)
|
|
22
|
-
})
|
|
23
|
-
})
|
|
@@ -1,28 +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 { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
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
|
-
|
|
15
|
-
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
16
|
-
|
|
17
|
-
const Application = (
|
|
18
|
-
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
19
|
-
<React.StrictMode>
|
|
20
|
-
<RouterProvider router={router} />
|
|
21
|
-
</React.StrictMode>
|
|
22
|
-
</Provider>
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
const container = document.getElementById("app")
|
|
26
|
-
hydrateRoot(container, Application)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
@@ -1,28 +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 { RouterProvider } from "@tata1mg/router"
|
|
7
|
-
import clientRouter from "catalyst-core/router/ClientRouter"
|
|
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
|
-
|
|
15
|
-
const router = clientRouter({ store, routerInitialState: routerInitialData })
|
|
16
|
-
|
|
17
|
-
const Application = (
|
|
18
|
-
<Provider store={store} serverState={__INITIAL_STATE__}>
|
|
19
|
-
<React.StrictMode>
|
|
20
|
-
<RouterProvider router={router} />
|
|
21
|
-
</React.StrictMode>
|
|
22
|
-
</Provider>
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
const container = document.getElementById("app")
|
|
26
|
-
hydrateRoot(container, Application)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
File without changes
|
|
File without changes
|