create-catalyst-app-internal 0.0.1-beta.12 → 0.0.1-beta.14
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 +52 -0
- package/license +10 -0
- package/package.json +1 -1
- package/templates/common/README.md +2 -2
- package/templates/common/api.js +3 -3
- package/templates/common/client/styles.js +1 -12
- package/templates/common/config/config.json +1 -18
- package/templates/common/public/favicon.ico +0 -0
- package/templates/common/server/index.js +1 -0
- package/templates/common/server/server.js +5 -5
- package/templates/none-js/package.json +1 -1
- package/templates/none-js/src/js/routes/utils.js +28 -0
- package/templates/redux-js/package.json +1 -1
- package/templates/rtk-js/package.json +1 -1
- package/templates/rtk-js/src/js/routes/utils.js +28 -0
- /package/templates/{common → redux-js}/src/js/routes/utils.js +0 -0
package/Readme.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Creating a Catalyst App
|
|
2
|
+
|
|
3
|
+
Scaffold your Catalyst app swiftly with `create-catalyst-app`. This tool expedites the process by initializing your project with predefined configurations. To kickstart your project, execute the following command:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx create-catalyst-app@latest
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Upon execution, you'll be prompted to name your project. Once named, a template will be cloned into the specified directory.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
✔ What is your project named? my-app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Next, select your preferred state management tool from the provided options.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
? Choose state management: › - Use arrow-keys. Return to submit .
|
|
19
|
+
❯ Redux
|
|
20
|
+
Redux Toolkit (RTK)
|
|
21
|
+
None
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Following your selection, a default template will be cloned into the directory, and all necessary packages will be installed.
|
|
25
|
+
|
|
26
|
+
## Getting Started
|
|
27
|
+
Commence development by initiating the application in development mode with the following commands:
|
|
28
|
+
|
|
29
|
+
Navigate into the directory
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd my-app
|
|
33
|
+
```
|
|
34
|
+
For running the application in development mode, run:
|
|
35
|
+
```bash
|
|
36
|
+
npm run start
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For a production build, change NODE_ENV to "production" in config/config.json, and then run :
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm run build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
To serve the production build, execute:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm run serve
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
Explore the complete documentation at [https://catalyst.1mg.com](https://catalyst.1mg.com).
|
package/license
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 1mg Healthcare Solutions Private Limited.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Getting Started
|
|
2
2
|
|
|
3
|
-
Commence development by initiating the
|
|
3
|
+
Commence development by initiating the the following commands:
|
|
4
4
|
|
|
5
5
|
For running the application in development mode, run:
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ For running the application in development mode, run:
|
|
|
8
8
|
npm run start
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
For a production build,
|
|
11
|
+
For a production build, change NODE_ENV to "production" in config/config.json, then run :
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npm run build
|
package/templates/common/api.js
CHANGED
|
@@ -3,16 +3,16 @@ const apiInstance = () => {
|
|
|
3
3
|
let baseURL = process.env.API_URL
|
|
4
4
|
let finalUrl = baseURL + url
|
|
5
5
|
|
|
6
|
-
// Request Interceptor -
|
|
6
|
+
// Request Interceptor - modify request here
|
|
7
7
|
|
|
8
|
-
// Add query params
|
|
8
|
+
// Add query params
|
|
9
9
|
if (Object.keys(options?.params).length > 0) {
|
|
10
10
|
finalUrl = url + "?" + new URLSearchParams(options.params)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
return fetch(finalUrl, options).then(async (response) => {
|
|
14
14
|
const parsedResponse = await response.json()
|
|
15
|
-
// Response Interceptor -
|
|
15
|
+
// Response Interceptor - modify response here
|
|
16
16
|
return parsedResponse
|
|
17
17
|
})
|
|
18
18
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* Anything imported in here will either be added to the vendor CSS chunk, or
|
|
4
|
-
* the main app CSS chunk. Where they will go depends on its location or its
|
|
5
|
-
* extension.
|
|
6
|
-
*
|
|
7
|
-
* Files will be added to the vendor.css chunk if:
|
|
8
|
-
* - they are located inside `node_modules`, or
|
|
9
|
-
* - they are plain .css files.
|
|
10
|
-
* Otherwise, files will be added to the main app.css chunk.
|
|
11
|
-
*/
|
|
1
|
+
// Include initial base styles. Global styles will come here.
|
|
12
2
|
|
|
13
|
-
// Include initial base styles.
|
|
14
3
|
import "@css/base/index.scss"
|
|
@@ -10,23 +10,6 @@
|
|
|
10
10
|
"API_URL": "",
|
|
11
11
|
"ANALYZE_BUNDLE": false,
|
|
12
12
|
"CLIENT_ENV_VARIABLES": [
|
|
13
|
-
"
|
|
14
|
-
"NODE_SERVER_PORT",
|
|
15
|
-
"WEBPACK_DEV_SERVER_HOSTNAME",
|
|
16
|
-
"WEBPACK_DEV_SERVER_PORT",
|
|
17
|
-
"BUILD_OUTPUT_PATH",
|
|
18
|
-
"PUBLIC_STATIC_ASSET_PATH",
|
|
19
|
-
"PUBLIC_STATIC_ASSET_URL",
|
|
20
|
-
"NODE_ENV",
|
|
21
|
-
"BUILD_ENV",
|
|
22
|
-
"API_URL",
|
|
23
|
-
"ANALYZE_BUNDLE",
|
|
24
|
-
"ENABLE_DEBUG_LOGS",
|
|
25
|
-
"ENABLE_FILE_LOGGING",
|
|
26
|
-
"ENABLE_CONSOLE_LOGGING",
|
|
27
|
-
"ANALYZE_BUNDLE",
|
|
28
|
-
"ENABLE_DEBUG_LOGS",
|
|
29
|
-
"ENABLE_FILE_LOGGING",
|
|
30
|
-
"ENABLE_CONSOLE_LOGGING"
|
|
13
|
+
"API_URL"
|
|
31
14
|
]
|
|
32
15
|
}
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const express = require(
|
|
2
|
-
const path = require(
|
|
1
|
+
const express = require("express")
|
|
2
|
+
const path = require("path")
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
app.use('/favicon.ico', express.static(path.join(__dirname, '../public/favicon.ico')));
|
|
4
|
+
// Server middlewares are added here.
|
|
7
5
|
|
|
6
|
+
export function addMiddlewares(app) {
|
|
7
|
+
app.use("/favicon.ico", express.static(path.join(__dirname, "../public/favicon.ico")))
|
|
8
8
|
}
|
|
@@ -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 = ({ routerInitialState }) => {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
element: (
|
|
10
|
+
<RouterDataProvider config={{}} initialState={routerInitialState}>
|
|
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
|
+
}
|
|
@@ -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
|
+
}
|
|
File without changes
|