create-catalyst-app-internal 0.0.1-beta.70 → 0.0.1-beta.72

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/templates/common/server/document.js +1 -1
  3. package/templates/mcp-root/mcp/context.md +167 -2
  4. package/templates/none-js/client/index.js +1 -1
  5. package/templates/none-js/package.json +1 -1
  6. package/templates/none-ts/client/index.js +1 -1
  7. package/templates/none-ts/package.json +1 -1
  8. package/templates/redux-js/client/index.js +1 -1
  9. package/templates/redux-js/package.json +1 -1
  10. package/templates/redux-ts/client/index.js +1 -1
  11. package/templates/redux-ts/package.json +1 -1
  12. package/templates/rtk-js/client/index.js +1 -1
  13. package/templates/rtk-js/package.json +1 -1
  14. package/templates/rtk-ts/client/index.js +1 -1
  15. package/templates/rtk-ts/package.json +1 -1
  16. package/my-app/.eslintignore +0 -1
  17. package/my-app/.eslintrc +0 -28
  18. package/my-app/README.md +0 -25
  19. package/my-app/api.js +0 -16
  20. package/my-app/client/index.js +0 -23
  21. package/my-app/client/styles.js +0 -3
  22. package/my-app/config/config.json +0 -12
  23. package/my-app/mcp/context.md +0 -509
  24. package/my-app/mcp/mcp.js +0 -36
  25. package/my-app/package-lock.json +0 -11723
  26. package/my-app/package.json +0 -34
  27. package/my-app/postcss.config.js +0 -5
  28. package/my-app/public/favicon.ico +0 -0
  29. package/my-app/server/document.js +0 -12
  30. package/my-app/server/index.js +0 -2
  31. package/my-app/server/server.js +0 -8
  32. package/my-app/src/js/containers/App/index.js +0 -16
  33. package/my-app/src/js/containers/Home/Home.js +0 -23
  34. package/my-app/src/js/containers/Home/Home.scss +0 -34
  35. package/my-app/src/js/routes/index.js +0 -11
  36. package/my-app/src/js/routes/utils.js +0 -42
  37. package/my-app/src/static/css/base/index.scss +0 -2
  38. package/my-app/src/static/css/base/styles.scss +0 -3
  39. package/my-app/src/static/css/resources/_variables.scss +0 -0
  40. package/my-app/webpackConfig.js +0 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-catalyst-app-internal",
3
3
  "bin": "scripts/cli.cjs",
4
- "version": "0.0.1-beta.70",
4
+ "version": "0.0.1-beta.72",
5
5
  "description": "cli package to scaffold Catalyst application",
6
6
  "dependencies": {
7
7
  "commander": "^8.2.0",
@@ -1,5 +1,5 @@
1
1
  import React from "react"
2
- import { Head, Body } from "catalyst-core"
2
+ import { Head, Body } from "catalyst-core-internal"
3
3
 
4
4
  function Document(props) {
5
5
  return (
@@ -17,6 +17,17 @@ CODE:
17
17
  npx create-catalyst-app@latest -y
18
18
  ```
19
19
 
20
+ Catalyst has native support for typescript, tailwind, redux, and a local MCP server
21
+ To configure these options, a new catalyst app can be created without using the default "-y" flag
22
+ Creating an app using this will ask for prompts from the user to configure specific options
23
+
24
+ LANGUAGE: bash
25
+ CODE:
26
+
27
+ ```
28
+ npx create-catalyst-app@latest
29
+ ```
30
+
20
31
  ---
21
32
 
22
33
  ---
@@ -39,6 +50,32 @@ npm run start
39
50
 
40
51
  ---
41
52
 
53
+ TITLE: Building and serving the production version
54
+
55
+ DESCRIPTION:
56
+
57
+ - To create an optimized production build of your Catalyst application, use the following command. This will generate the production-ready assets in the build directory.
58
+
59
+ LANGUAGE: bash
60
+ CODE:
61
+
62
+ ```
63
+ npm run build
64
+ ```
65
+
66
+ - To serve the production build locally (for testing or preview), use the following command. This will start a server that serves your built application, typically on `http://localhost:3005`.
67
+
68
+ LANGUAGE: bash
69
+ CODE:
70
+
71
+ ```
72
+ npm run serve
73
+ ```
74
+
75
+ ---
76
+
77
+ ---
78
+
42
79
  TITLE: Adding routes in catalyst
43
80
 
44
81
  DESCRIPTION:
@@ -154,7 +191,7 @@ CODE:
154
191
 
155
192
  ```
156
193
  Page.clientFetcher = async ({ route, location, params, searchParams, navigate }, { store }) => {
157
- const res = await await fetch('<https://api.example.com/data>');
194
+ const res = await fetch('<https://api.example.com/data>');
158
195
  const json = await res.json();
159
196
  return json;
160
197
  };
@@ -166,7 +203,7 @@ LANGUAGE: js
166
203
  CODE:
167
204
 
168
205
  ```
169
- Page.serverFunction = async ({ route, location, params, searchParams, navigate },{ store }) => {
206
+ Page.serverFetcher = async ({ route, location, params, searchParams, navigate },{ store }) => {
170
207
  const res = await fetch('<https://api.example.com/data>');
171
208
  const json = await res.json();
172
209
  return json;
@@ -507,3 +544,131 @@ module.exports = {
507
544
  ```
508
545
 
509
546
  ---
547
+
548
+ ---
549
+
550
+ TITLE: State management
551
+
552
+ DESCRIPTION:
553
+
554
+ - To address use cases where a global store is needed and must be accessible on both the client and server, Catalyst provides built-in support for Redux and Redux Toolkit
555
+ - The Redux store should be defined in src/js/store/index.js
556
+
557
+ Redux integration demo
558
+
559
+ LANGUAGE: js
560
+ FILE: src/js/store/index.js
561
+ CODE:
562
+
563
+ ```
564
+ import { compose, createStore, applyMiddleware } from "redux"
565
+ import homeReducer from "@reducers/homeReducer.js"
566
+
567
+ export default function configureStore(initialState,request) {
568
+ // request object is available when the store is initialized on the server
569
+ // creating store with homeReducer and initialData recieved from server
570
+ const store = createStore(
571
+ homeReducer
572
+ initialState,
573
+ )
574
+ return store
575
+ }
576
+ ```
577
+
578
+ RTK integration demo
579
+
580
+ LANGUAGE: js
581
+ FILE: src/js/store/index.js
582
+ CODE:
583
+
584
+ ```
585
+ import { configureStore as createStore } from "@reduxjs/toolkit"
586
+ import { combineReducers } from "redux"
587
+ import { shellReducer } from "@containers/App/reducer.js"
588
+ import fetchInstance from "@api"
589
+
590
+ const configureStore = (initialState) => {
591
+ const api = fetchInstance
592
+ const store = createStore({
593
+ reducer: combineReducers({ shellReducer }),
594
+ middleware: (getDefaultMiddleware) =>
595
+ getDefaultMiddleware({
596
+ thunk: {
597
+ extraArgument: { api },
598
+ },
599
+ }),
600
+ preloadedState: initialState,
601
+ })
602
+ return store
603
+ }
604
+
605
+ export default configureStore
606
+
607
+ ```
608
+
609
+ - This store is available in both clientFetcher and serverFetcher
610
+
611
+ LANGUAGE: js
612
+ CODE:
613
+
614
+ ```
615
+ HomePage.serverFetcher = async ({ req }, { store }) => {
616
+ dispatch(isLoading())
617
+ // returning async action
618
+ return dispatch(getHomePageData())
619
+ }
620
+ HomePage.clientFetcher = async ({ req }, { store }) => {
621
+ dispatch(isLoading())
622
+ // returning async action
623
+ return dispatch(getHomePageData())
624
+ }
625
+ ```
626
+
627
+ ---
628
+
629
+ ---
630
+
631
+ TITLE: Universal App
632
+
633
+ DESCRIPTION:
634
+
635
+ - Catalyst also provides support to build native iOS/android applications
636
+ - This feature is currently only available in the canary version, setup the application using `npx create-catalyst-app@0.0.3-canary.6`
637
+
638
+ To install the android simulator
639
+
640
+ 1. Download and install Android Studio
641
+ 2. Launch Android Studio
642
+ 3. From the welcome screen, click More Actions and select SDK Manager
643
+ 4. Navigate to Settings > Languages & Frameworks > Android SDK
644
+ 5. In the SDK Platforms tab:
645
+ - Select the latest Android version (API level)
646
+ - Make sure the box next to the selected version is checked
647
+ 6. Switch to the SDK Tools tab and ensure these components are installed:
648
+ - At least one version of Android SDK Build-Tools
649
+ - Android Emulator
650
+ - Android SDK Platform-Tools
651
+ 7. Important: Note down the Android SDK Location path displayed at the top
652
+ - You'll need this path for environment variables or other development tools
653
+ 8. Click Apply and then OK to begin the installation
654
+ - Wait for all selected components to download and install
655
+ - This may take several minutes depending on your internet connection
656
+
657
+ To install the ios simulator
658
+
659
+ 1. Install Xcode
660
+ 2. Install Xcode Command Line Tools
661
+
662
+ ```
663
+ # Check if already installed
664
+ xcode-select -p
665
+
666
+ # If not installed, run:
667
+ xcode-select --install
668
+ ```
669
+
670
+ - To configure the android / iOS simulators, run `npm run setupEmulator:android` or `npm run setupEmulator:ios`
671
+ - To run the application, first start the development server `npm run start`
672
+ - Then in a new terminal, build the app using `npm run buildApp:android` or `npm run buildApp:ios`
673
+
674
+ ---
@@ -3,7 +3,7 @@ import "./styles"
3
3
  import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { RouterProvider } from "@tata1mg/router"
6
- import clientRouter from "catalyst-core/router/ClientRouter"
6
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
7
7
 
8
8
  window.addEventListener("load", () => {
9
9
  loadableReady(() => {
@@ -20,7 +20,7 @@
20
20
  "dependencies": {
21
21
  "@loadable/component": "^5.16.3",
22
22
  "@tata1mg/router": "^0.0.1-beta.7",
23
- "catalyst-core": "0.0.1-beta.14"
23
+ "catalyst-core-internal": "0.0.1-beta.66"
24
24
  },
25
25
  "devDependencies": {
26
26
  "eslint": "^8.26.0",
@@ -3,7 +3,7 @@ import "./styles"
3
3
  import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { RouterProvider } from "@tata1mg/router"
6
- import clientRouter from "catalyst-core/router/ClientRouter"
6
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
7
7
 
8
8
  window.addEventListener("load", () => {
9
9
  loadableReady(() => {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.14"
24
+ "catalyst-core-internal": "0.0.1-beta.66"
25
25
  },
26
26
  "devDependencies": {
27
27
  "eslint": "^8.26.0",
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { Provider } from "react-redux"
6
6
  import { RouterProvider } from "@tata1mg/router"
7
- import clientRouter from "catalyst-core/router/ClientRouter"
7
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
8
  import configureStore from "@store"
9
9
 
10
10
  window.addEventListener("load", () => {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.14",
24
+ "catalyst-core-internal": "0.0.1-beta.66",
25
25
  "@reduxjs/toolkit": "1.9.3",
26
26
  "react-redux": "^8.1.3"
27
27
  },
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { Provider } from "react-redux"
6
6
  import { RouterProvider } from "@tata1mg/router"
7
- import clientRouter from "catalyst-core/router/ClientRouter"
7
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
8
  import configureStore from "@store"
9
9
 
10
10
  window.addEventListener("load", () => {
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@loadable/component": "^5.16.3",
24
24
  "@tata1mg/router": "^0.0.1-beta.7",
25
- "catalyst-core": "0.0.1-beta.14",
25
+ "catalyst-core-internal": "0.0.1-beta.66",
26
26
  "@reduxjs/toolkit": "1.9.3",
27
27
  "react-redux": "^8.1.3"
28
28
  },
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { Provider } from "react-redux"
6
6
  import { RouterProvider } from "@tata1mg/router"
7
- import clientRouter from "catalyst-core/router/ClientRouter"
7
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
8
  import configureStore from "@store"
9
9
 
10
10
  window.addEventListener("load", () => {
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@loadable/component": "^5.16.3",
23
23
  "@tata1mg/router": "^0.0.1-beta.7",
24
- "catalyst-core": "0.0.1-beta.14",
24
+ "catalyst-core-internal": "0.0.1-beta.66",
25
25
  "@reduxjs/toolkit": "1.9.3",
26
26
  "react-redux": "^8.1.3"
27
27
  },
@@ -4,7 +4,7 @@ import { hydrateRoot } from "react-dom/client"
4
4
  import { loadableReady } from "@loadable/component"
5
5
  import { Provider } from "react-redux"
6
6
  import { RouterProvider } from "@tata1mg/router"
7
- import clientRouter from "catalyst-core/router/ClientRouter"
7
+ import clientRouter from "catalyst-core-internal/router/ClientRouter"
8
8
  import configureStore from "@store"
9
9
 
10
10
  window.addEventListener("load", () => {
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "@loadable/component": "^5.16.3",
24
24
  "@tata1mg/router": "^0.0.1-beta.7",
25
- "catalyst-core": "0.0.1-beta.14",
25
+ "catalyst-core-internal": "0.0.1-beta.66",
26
26
  "@reduxjs/toolkit": "1.9.3",
27
27
  "react-redux": "^8.1.3"
28
28
  },
@@ -1 +0,0 @@
1
- **/build/*
package/my-app/.eslintrc DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "rules": {
3
- "react-hooks/exhaustive-deps": "error" // Checks effect dependencies
4
- },
5
- "env": {
6
- "browser": true,
7
- "es6": true,
8
- "node": true
9
- },
10
- "extends": [
11
- "eslint:recommended",
12
- "plugin:react/recommended",
13
- ],
14
- "parserOptions": {
15
- "sourceType": "module",
16
- "ecmaVersion": "latest"
17
- },
18
- "plugins": [
19
- "react",
20
- "react-hooks"
21
- ],
22
- "settings": {
23
- "react": {
24
- "pragma": "React",
25
- "version": "detect"
26
- }
27
- }
28
- }
package/my-app/README.md DELETED
@@ -1,25 +0,0 @@
1
- ## Getting Started
2
-
3
- Commence development by initiating the the following commands:
4
-
5
- For running the application in development mode, run:
6
-
7
- ```bash
8
- npm run start
9
- ```
10
-
11
- For a production build, change NODE_ENV to "production" in config/config.json, then run :
12
-
13
- ```bash
14
- npm run build
15
- ```
16
-
17
- To serve the production build, execute:
18
-
19
- ```bash
20
- npm run serve
21
- ```
22
-
23
- ## Documentation
24
-
25
- Explore the complete documentation at [https://catalyst.1mg.com](https://catalyst.1mg.com).
package/my-app/api.js DELETED
@@ -1,16 +0,0 @@
1
- const fetchFunction = (url, options) => {
2
- let baseURL = process.env.API_URL
3
- let finalUrl = baseURL + url
4
-
5
- // Request Interceptor - modify request here
6
-
7
- return fetch(finalUrl, options)
8
- .then(response => {
9
- return response.json().then(parsedResponse => {
10
- // Response Interceptor - modify response here
11
- return parsedResponse
12
- })
13
- })
14
- }
15
-
16
- export default fetchFunction
@@ -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,3 +0,0 @@
1
- // Include initial base styles. Global styles will come here.
2
-
3
- import "@css/base/index.scss"
@@ -1,12 +0,0 @@
1
- {
2
- "NODE_SERVER_HOSTNAME": "localhost",
3
- "NODE_SERVER_PORT": 3005,
4
- "WEBPACK_DEV_SERVER_HOSTNAME": "localhost",
5
- "WEBPACK_DEV_SERVER_PORT": 3006,
6
- "BUILD_OUTPUT_PATH": "build",
7
- "PUBLIC_STATIC_ASSET_PATH": "/assets/",
8
- "PUBLIC_STATIC_ASSET_URL": "http://localhost:3005",
9
- "API_URL": "",
10
- "ANALYZE_BUNDLE": false,
11
- "CLIENT_ENV_VARIABLES": ["API_URL"]
12
- }