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.
Files changed (237) hide show
  1. package/{readme.md → Readme.md} +2 -3
  2. package/license +10 -0
  3. package/package.json +20 -18
  4. package/scripts/cli.cjs +242 -0
  5. package/templates/common/.babelrc +11 -11
  6. package/templates/common/README.md +16 -20
  7. package/templates/common/api.js +9 -11
  8. package/templates/common/client/styles.js +1 -13
  9. package/templates/common/config/config.json +13 -16
  10. package/templates/common/public/favicon.ico +0 -0
  11. package/templates/{none-js → common}/server/document.js +1 -2
  12. package/templates/common/server/index.js +2 -0
  13. package/templates/common/server/server.js +8 -0
  14. package/templates/common/src/js/containers/Home/Home.js +23 -40
  15. package/templates/common/src/js/containers/Home/Home.scss +34 -0
  16. package/templates/common/src/js/routes/index.js +9 -42
  17. package/templates/common/src/static/css/base/index.scss +0 -7
  18. package/templates/common/src/static/css/base/styles.scss +0 -160
  19. package/templates/common/src/static/css/resources/_variables.scss +0 -172
  20. package/{my-app → templates/common}/webpackConfig.js +2 -2
  21. package/templates/none-js/client/index.js +9 -13
  22. package/templates/none-js/package.json +6 -36
  23. package/templates/none-js/src/js/containers/App/index.js +12 -36
  24. package/templates/none-js/src/js/routes/utils.js +28 -0
  25. package/templates/redux-js/client/index.js +6 -5
  26. package/templates/redux-js/package.json +9 -36
  27. package/templates/redux-js/src/js/containers/App/actions.js +1 -4
  28. package/templates/redux-js/src/js/containers/App/index.js +12 -38
  29. package/templates/redux-js/src/js/containers/App/reducer.js +15 -16
  30. package/templates/redux-js/src/js/routes/utils.js +28 -0
  31. package/templates/redux-js/src/js/store/index.js +17 -68
  32. package/templates/rtk-js/client/index.js +6 -5
  33. package/templates/rtk-js/package.json +9 -36
  34. package/templates/rtk-js/src/js/containers/App/index.js +12 -38
  35. package/templates/rtk-js/src/js/containers/App/reducer.js +1 -9
  36. package/templates/rtk-js/src/js/routes/utils.js +28 -0
  37. package/templates/rtk-js/src/js/store/index.js +12 -6
  38. package/my-app/.babelrc +0 -26
  39. package/my-app/.eslintignore +0 -6
  40. package/my-app/.eslintrc +0 -53
  41. package/my-app/.stylelintrc +0 -35
  42. package/my-app/README.md +0 -23
  43. package/my-app/api.js +0 -29
  44. package/my-app/checkVersion.js +0 -3
  45. package/my-app/client/index.js +0 -27
  46. package/my-app/client/styles.js +0 -14
  47. package/my-app/config/config.json +0 -15
  48. package/my-app/config/config_template.json +0 -18
  49. package/my-app/config/index.js +0 -44
  50. package/my-app/package.json +0 -28
  51. package/my-app/server/document.js +0 -14
  52. package/my-app/server/index.js +0 -3
  53. package/my-app/server/server.js +0 -3
  54. package/my-app/src/js/containers/App/actions.js +0 -20
  55. package/my-app/src/js/containers/App/index.js +0 -16
  56. package/my-app/src/js/containers/App/reducer.js +0 -26
  57. package/my-app/src/js/containers/DemoPage/DemoPage.js +0 -39
  58. package/my-app/src/js/containers/DemoPage/DemoPage.scss +0 -3
  59. package/my-app/src/js/containers/Home/Home.js +0 -25
  60. package/my-app/src/js/containers/Home/Home.scss +0 -36
  61. package/my-app/src/js/reducer/index.js +0 -80
  62. package/my-app/src/js/routes/index.js +0 -43
  63. package/my-app/src/js/stateManager/stateProvider.js +0 -34
  64. package/my-app/src/js/store/index.js +0 -22
  65. package/my-app/src/static/css/base/index.scss +0 -2
  66. package/my-app/src/static/css/base/styles.scss +0 -3
  67. package/my-app/src/static/css/base/typography.scss +0 -53
  68. package/my-app/src/static/css/resources/_variables.scss +0 -0
  69. package/my-app/src/static/fonts/.gitkeep +0 -0
  70. package/my-app/src/static/fonts/Inter-Bold-Subset.otf +0 -0
  71. package/my-app/src/static/fonts/Inter-Italic-Subset.otf +0 -0
  72. package/my-app/src/static/fonts/Inter-Light-Subset.otf +0 -0
  73. package/my-app/src/static/fonts/Inter-Medium-Subset.otf +0 -0
  74. package/my-app/src/static/fonts/Inter-Regular-Subset.otf +0 -0
  75. package/my-app/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
  76. package/my-app/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
  77. package/my-app/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
  78. package/my-app/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
  79. package/my-app/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
  80. package/my-app/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
  81. package/scripts/cli.mjs +0 -266
  82. package/templates/common/.editorconfig +0 -12
  83. package/templates/common/.eslintignore +0 -6
  84. package/templates/common/.eslintrc +0 -53
  85. package/templates/common/.prettierrc.json +0 -7
  86. package/templates/common/.stylelintrc +0 -35
  87. package/templates/common/checkVersion.js +0 -3
  88. package/templates/common/client/index.js +0 -39
  89. package/templates/common/config/config_template.json +0 -18
  90. package/templates/common/config/index.js +0 -77
  91. package/templates/common/package.json +0 -56
  92. package/templates/common/server/CustomDocument.js +0 -14
  93. package/templates/common/server/customIndex.js +0 -3
  94. package/templates/common/server/customServer.js +0 -16
  95. package/templates/common/src/js/containers/App/actions.js +0 -20
  96. package/templates/common/src/js/containers/App/index.js +0 -46
  97. package/templates/common/src/js/containers/App/reducer.js +0 -21
  98. package/templates/common/src/js/containers/PDP/PDP.js +0 -37
  99. package/templates/common/src/js/reducer/index.js +0 -80
  100. package/templates/common/src/js/stateManager/stateProvider.js +0 -34
  101. package/templates/common/src/js/store/index.js +0 -77
  102. package/templates/common/src/static/css/base/_overrides.scss +0 -81
  103. package/templates/common/src/static/css/base/animations.js +0 -38
  104. package/templates/common/src/static/css/base/layout.scss +0 -242
  105. package/templates/common/src/static/css/base/typography.scss +0 -285
  106. package/templates/common/src/static/css/resources/_mixins.scss +0 -196
  107. package/templates/common/src/static/css/resources/_vendors.scss +0 -1
  108. package/templates/common/src/static/fonts/.gitkeep +0 -0
  109. package/templates/common/src/static/fonts/Inter-Bold-Subset.otf +0 -0
  110. package/templates/common/src/static/fonts/Inter-Italic-Subset.otf +0 -0
  111. package/templates/common/src/static/fonts/Inter-Light-Subset.otf +0 -0
  112. package/templates/common/src/static/fonts/Inter-Medium-Subset.otf +0 -0
  113. package/templates/common/src/static/fonts/Inter-Regular-Subset.otf +0 -0
  114. package/templates/common/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
  115. package/templates/common/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
  116. package/templates/common/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
  117. package/templates/common/src/static/fonts/Poppins-Light-Subset.woff2 +0 -0
  118. package/templates/common/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
  119. package/templates/common/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
  120. package/templates/common/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
  121. package/templates/none-js/.babelrc +0 -26
  122. package/templates/none-js/.eslintignore +0 -6
  123. package/templates/none-js/.eslintrc +0 -53
  124. package/templates/none-js/.prettierrc.json +0 -7
  125. package/templates/none-js/.stylelintrc +0 -35
  126. package/templates/none-js/README.md +0 -22
  127. package/templates/none-js/api.js +0 -29
  128. package/templates/none-js/checkVersion.js +0 -3
  129. package/templates/none-js/client/styles.js +0 -15
  130. package/templates/none-js/config/config.json +0 -15
  131. package/templates/none-js/config/config_template.json +0 -18
  132. package/templates/none-js/config/index.js +0 -44
  133. package/templates/none-js/server/index.js +0 -3
  134. package/templates/none-js/server/server.js +0 -16
  135. package/templates/none-js/src/js/containers/DemoPage/DemoPage.js +0 -39
  136. package/templates/none-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
  137. package/templates/none-js/src/js/containers/Home/Home.js +0 -27
  138. package/templates/none-js/src/js/containers/Home/Home.scss +0 -36
  139. package/templates/none-js/src/js/routes/index.js +0 -49
  140. package/templates/none-js/src/js/stateManager/stateProvider.js +0 -19
  141. package/templates/none-js/src/js/store/index.js +0 -6
  142. package/templates/none-js/src/static/css/base/index.scss +0 -3
  143. package/templates/none-js/src/static/css/base/styles.scss +0 -11
  144. package/templates/none-js/src/static/css/base/typography.scss +0 -53
  145. package/templates/none-js/src/static/css/resources/_variables.scss +0 -1
  146. package/templates/none-js/src/static/fonts/.gitkeep +0 -0
  147. package/templates/none-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
  148. package/templates/none-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
  149. package/templates/none-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
  150. package/templates/none-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
  151. package/templates/none-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
  152. package/templates/none-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
  153. package/templates/none-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
  154. package/templates/none-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
  155. package/templates/none-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
  156. package/templates/none-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
  157. package/templates/none-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
  158. package/templates/none-js/webpackConfig.js +0 -5
  159. package/templates/redux-js/.babelrc +0 -26
  160. package/templates/redux-js/.eslintignore +0 -6
  161. package/templates/redux-js/.eslintrc +0 -53
  162. package/templates/redux-js/.prettierrc.json +0 -7
  163. package/templates/redux-js/.stylelintrc +0 -35
  164. package/templates/redux-js/README.md +0 -22
  165. package/templates/redux-js/api.js +0 -29
  166. package/templates/redux-js/checkVersion.js +0 -3
  167. package/templates/redux-js/client/styles.js +0 -15
  168. package/templates/redux-js/config/config.json +0 -15
  169. package/templates/redux-js/config/config_template.json +0 -18
  170. package/templates/redux-js/config/index.js +0 -44
  171. package/templates/redux-js/server/document.js +0 -14
  172. package/templates/redux-js/server/index.js +0 -3
  173. package/templates/redux-js/server/server.js +0 -16
  174. package/templates/redux-js/src/js/containers/DemoPage/DemoPage.js +0 -39
  175. package/templates/redux-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
  176. package/templates/redux-js/src/js/containers/Home/Home.js +0 -27
  177. package/templates/redux-js/src/js/containers/Home/Home.scss +0 -36
  178. package/templates/redux-js/src/js/reducer/index.js +0 -80
  179. package/templates/redux-js/src/js/routes/index.js +0 -49
  180. package/templates/redux-js/src/js/stateManager/stateProvider.js +0 -34
  181. package/templates/redux-js/src/static/css/base/index.scss +0 -3
  182. package/templates/redux-js/src/static/css/base/styles.scss +0 -11
  183. package/templates/redux-js/src/static/css/base/typography.scss +0 -53
  184. package/templates/redux-js/src/static/css/resources/_variables.scss +0 -1
  185. package/templates/redux-js/src/static/fonts/.gitkeep +0 -0
  186. package/templates/redux-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
  187. package/templates/redux-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
  188. package/templates/redux-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
  189. package/templates/redux-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
  190. package/templates/redux-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
  191. package/templates/redux-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
  192. package/templates/redux-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
  193. package/templates/redux-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
  194. package/templates/redux-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
  195. package/templates/redux-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
  196. package/templates/redux-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
  197. package/templates/redux-js/webpackConfig.js +0 -5
  198. package/templates/rtk-js/.babelrc +0 -26
  199. package/templates/rtk-js/.eslintignore +0 -6
  200. package/templates/rtk-js/.eslintrc +0 -53
  201. package/templates/rtk-js/.prettierrc.json +0 -7
  202. package/templates/rtk-js/.stylelintrc +0 -35
  203. package/templates/rtk-js/README.md +0 -23
  204. package/templates/rtk-js/api.js +0 -29
  205. package/templates/rtk-js/checkVersion.js +0 -3
  206. package/templates/rtk-js/client/styles.js +0 -15
  207. package/templates/rtk-js/config/config.json +0 -15
  208. package/templates/rtk-js/config/config_template.json +0 -18
  209. package/templates/rtk-js/config/index.js +0 -44
  210. package/templates/rtk-js/server/document.js +0 -14
  211. package/templates/rtk-js/server/index.js +0 -3
  212. package/templates/rtk-js/server/server.js +0 -16
  213. package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.js +0 -39
  214. package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.scss +0 -3
  215. package/templates/rtk-js/src/js/containers/Home/Home.js +0 -27
  216. package/templates/rtk-js/src/js/containers/Home/Home.scss +0 -36
  217. package/templates/rtk-js/src/js/reducer/index.js +0 -80
  218. package/templates/rtk-js/src/js/routes/index.js +0 -49
  219. package/templates/rtk-js/src/js/stateManager/stateProvider.js +0 -34
  220. package/templates/rtk-js/src/static/css/base/index.scss +0 -3
  221. package/templates/rtk-js/src/static/css/base/styles.scss +0 -11
  222. package/templates/rtk-js/src/static/css/base/typography.scss +0 -53
  223. package/templates/rtk-js/src/static/css/resources/_variables.scss +0 -1
  224. package/templates/rtk-js/src/static/fonts/.gitkeep +0 -0
  225. package/templates/rtk-js/src/static/fonts/Inter-Bold-Subset.otf +0 -0
  226. package/templates/rtk-js/src/static/fonts/Inter-Italic-Subset.otf +0 -0
  227. package/templates/rtk-js/src/static/fonts/Inter-Light-Subset.otf +0 -0
  228. package/templates/rtk-js/src/static/fonts/Inter-Medium-Subset.otf +0 -0
  229. package/templates/rtk-js/src/static/fonts/Inter-Regular-Subset.otf +0 -0
  230. package/templates/rtk-js/src/static/fonts/Inter-SemiBold-Subset.otf +0 -0
  231. package/templates/rtk-js/src/static/fonts/Poppins-Bold-Subset.woff2 +0 -0
  232. package/templates/rtk-js/src/static/fonts/Poppins-Italic-Subset.woff2 +0 -0
  233. package/templates/rtk-js/src/static/fonts/Poppins-Medium-Subset.woff2 +0 -0
  234. package/templates/rtk-js/src/static/fonts/Poppins-Regular-Subset.woff2 +0 -0
  235. package/templates/rtk-js/src/static/fonts/Poppins-SemiBold-Subset.woff2 +0 -0
  236. package/templates/rtk-js/webpackConfig.js +0 -5
  237. /package/{my-app/.prettierrc.json → .prettierrc.json} +0 -0
package/scripts/cli.mjs DELETED
@@ -1,266 +0,0 @@
1
- #!/usr/bin/env node
2
- import { exec, execSync } from "child_process";
3
- import Commander, { Option } from "commander";
4
- import prompts from "prompts";
5
- import { red, green, cyan, yellow } from "picocolors";
6
- import ora from "ora";
7
- import packageJson from "../package.json" assert { type: "json" };
8
- import tar from "tar";
9
- import path from "path";
10
- import fs from "fs";
11
-
12
-
13
-
14
- // Hardcoded branch
15
- let projectName = null;
16
- const program = new Commander.Command(packageJson.name)
17
- .version(packageJson.version)
18
- .description("Copy code from a specific branch of a GitHub repository.")
19
- .arguments("[folderName]")
20
- .usage(`${green("[folderName]")} [options]`)
21
- .action((name) => (projectName = name))
22
- // .addOption(
23
- // new Option(
24
- // "-l, --lang <lang>",
25
- // "Specify the language (js or ts)",
26
- // /^(js|ts)$/i
27
- // )
28
- // )
29
- .addOption(
30
- new Option(
31
- "-s, --state-management [stateManagement]",
32
- "Specify state management (rtk, redux, or none)",
33
- /^(rtk|redux|none)$/i,
34
- "none"
35
- )
36
- )
37
- .action(async (folderName = null, cmd) => {
38
- try {
39
- // Use options provided through commander or prompt the user
40
- validateOptions(cmd);
41
- const projectName = folderName || (await promptProjectName());
42
- const language = "js"
43
- const stateManagement =
44
- cmd.stateManagement || (await promptStateManagement());
45
-
46
- const resolvedProjectPath = path.resolve(projectName.trim());
47
- const projectPath = path.basename(resolvedProjectPath);
48
- const root = path.resolve(projectPath);
49
- console.log("project path is ====>", root);
50
-
51
- // Define mapping of options to repository suffixes
52
- const repositorySuffixes = {
53
- js: "js",
54
- ts: "ts",
55
- redux: "redux",
56
- rtk: "rtk",
57
- none: "none",
58
- };
59
-
60
-
61
- const packageName = packageJson.name;
62
- const packageVersion = packageJson.version;
63
-
64
- const subdirectoryToExtract = `package/templates/${repositorySuffixes[stateManagement]}-${repositorySuffixes[language]}`;
65
-
66
- const extractionDestination = `/${projectName}/`;
67
- const spinner = ora(
68
- `Cloning.....`
69
- ).start();
70
- (() => {
71
- try {
72
-
73
-
74
- const tempDir = createTempDir();
75
-
76
- console.log(`\nPacking npm package: ${packageName}@${packageVersion}`);
77
- const packageFilePath = packNpmPackage(
78
- packageName,
79
- packageVersion,
80
- tempDir
81
- );
82
-
83
- console.log(cyan(`Extracting`));
84
- extractSubdirectory(packageFilePath);
85
- console.log(green(`Extraction Complete`));
86
- console.log(cyan("generating npmrc"))
87
- generateNPMRC(projectName)
88
- console.log(cyan(`Installing Packages`));
89
- execSync(
90
- `cd ${projectName} && npm i`
91
- ,{stdio:"inherit"})
92
- spinner.stop()
93
-
94
- // Optionally, you can delete the temporary directory
95
- // fs.rmdirSync(tempDir, { recursive: true });
96
- deleteDirectory(tempDir)
97
- } catch (error) {
98
- spinner.stop()
99
- console.error(`Error: ${error.message}`);
100
- process.exit(1);
101
- }
102
- })();
103
-
104
-
105
- function packNpmPackage (packageName, packageVersion, tempDir) {
106
- const tarballFileName = `${packageName}-${packageVersion}.tgz`;
107
- const tarballFilePath = path.join(tempDir, tarballFileName);
108
-
109
- try {
110
- execSync(`npm pack ${packageName}@${packageVersion} --silent`, {
111
- cwd: tempDir,
112
- })
113
-
114
- return tarballFilePath;
115
- } catch (error) {
116
- console.error(`Error packing npm package: ${error.message}`);
117
- throw error;
118
- }
119
- }
120
-
121
- // Function to create a temporary directory
122
- function createTempDir() {
123
- const tempDir = fs.mkdtempSync(path.join(process.cwd(), "temp-"));
124
- console.log("temp dir is ===>",tempDir)
125
- return tempDir;
126
- }
127
-
128
- // Function to extract subdirectory from npm package and delete tar file
129
- function extractSubdirectory(packageFilePath) {
130
- tar.extract({
131
- file: packageFilePath,
132
- sync: true,
133
- filter: (path, entry) => {
134
- return path.startsWith(`${subdirectoryToExtract}/`);
135
- },
136
- cwd: path.join(process.cwd()),
137
- onentry: (entry) => {
138
- // Modify entry path to remove the initial 'package/' prefix
139
- entry.path = entry.path.replace(
140
- `${subdirectoryToExtract}/`,
141
- extractionDestination
142
- );
143
- },
144
- });
145
-
146
-
147
-
148
- if (stateManagement !== "none") {
149
- console.log(
150
- cyan(
151
- `You chose ${language}, ${stateManagement}. You can now start working on your project!`
152
- )
153
- );
154
- } else {
155
- console.log(
156
- cyan(
157
- `You chose ${language} without state management. You can now start working on your project!`
158
- )
159
- );
160
- }
161
-
162
-
163
-
164
- }
165
- } catch (error) {
166
-
167
- console.error(red("An error occurred:"), error.message);
168
- process.exit(1);
169
- }
170
- })
171
- .allowUnknownOption();
172
-
173
- program.parse(process.argv);
174
-
175
- async function promptLanguage() {
176
- const response = await prompts({
177
- type: "select",
178
- name: "lang",
179
- message: "Choose the language:",
180
- choices: [
181
- { title: "js", value: "js" },
182
- { title: "ts", value: "ts" },
183
- ],
184
- });
185
-
186
- return response.lang;
187
- }
188
-
189
- async function promptStateManagement() {
190
- const response = await prompts({
191
- type: "select",
192
- name: "stateManagement",
193
- message: "Choose state management:",
194
- choices: [
195
- { title: "Redux", value: "redux" },
196
- { title: "Redux Toolkit (RTK)", value: "rtk" },
197
- { title: "None", value: "none" },
198
- ],
199
- });
200
-
201
- return response.stateManagement;
202
- }
203
- async function promptProjectName() {
204
- const res = await prompts({
205
- type: "text",
206
- name: "path",
207
- message: "What is your project named?",
208
- initial: "my-app",
209
- });
210
-
211
- if (typeof res.path === "string") {
212
- projectName = res.path.trim();
213
- return res.path;
214
- }
215
-
216
- if (!res.path || projectName === "") {
217
- console.log(
218
- "\nPlease specify the project directory:\n" +
219
- ` ${cyan(program.name())} ${green("<project-directory>")}\n` +
220
- "For example:\n" +
221
- ` ${cyan(program.name())} ${green("my-next-app")}\n\n` +
222
- `Run ${cyan(`${program.name()} --help`)} to see all options.`
223
- );
224
- process.exit(1);
225
- }
226
- }
227
-
228
- function validateOptions(cmd) {
229
- // Validate language option
230
- if (cmd.lang && !["js", "ts"].includes(cmd.lang.toLowerCase())) {
231
- throw new Error('Invalid language option. Use "js" or "ts".');
232
- }
233
-
234
- // Validate state management option
235
- if (
236
- cmd.stateManagement &&
237
- !["rtk", "redux", "none"].includes(cmd.stateManagement.toLowerCase())
238
- ) {
239
- throw new Error(
240
- 'Invalid state management option. Use "rtk", "redux", or "none".'
241
- );
242
- }
243
- }
244
-
245
- function deleteDirectory(dirPath) {
246
- if (fs.existsSync(dirPath)) {
247
- fs.readdirSync(dirPath).forEach((file) => {
248
- const currentPath = path.join(dirPath, file);
249
- if (fs.lstatSync(currentPath).isDirectory()) {
250
- deleteDirectory(currentPath);
251
- } else {
252
- fs.unlinkSync(currentPath);
253
- }
254
- });
255
- fs.rmdirSync(dirPath);
256
- }
257
- }
258
-
259
- function generateNPMRC (projectName) {
260
-
261
-
262
- const npmrcContent = "//registry.npmjs.org/:_authToken=${NPM_TOKEN}"
263
-
264
- fs.writeFileSync(process.cwd()+`/${projectName}/.npmrc`,npmrcContent);
265
-
266
- }
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 4
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
@@ -1,6 +0,0 @@
1
- **/node_modules/*
2
- **/dist/*
3
- **/build/*
4
- **/coverage/*
5
- **/eventScripts/*
6
- **/docs/*
@@ -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", "plugin:prettier/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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "trailingComma": "es5",
3
- "tabWidth": 4,
4
- "semi": false,
5
- "arrowParens": "always",
6
- "printWidth": 110
7
- }
@@ -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
- }
@@ -1,3 +0,0 @@
1
- if(process.versions.node.split(".")[0]<20){
2
- console.error('\x1b[31m%s\x1b[0m', 'use node version >=20');
3
- }
@@ -1,39 +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 {createBrowserRouter,RouterProvider } from "@tata1mg/router"
6
- import {ClientProvider} from "../src/js/stateManager/stateProvider.js"
7
- import { preparedRoutes } from "../src/js/routes/index.js"
8
- import configureStore from "../src/js/store/index.js"
9
- window.addEventListener("load", () => {
10
- loadableReady(() => {
11
-
12
-
13
- // Hydrate the redux store from server state.
14
- // visitor id is sent with ga track events but we observed multiple cases where visitor id was not being passed. It could be due to the case that maybe cookie is not accessible in some cases. Hence, setting it here as a fallback in case gtmUtility.js is not able to get it any other way.
15
- // window.visitorId = store.getState()?.shellReducer?.visitorId
16
- // const platform = store.getState()?.shellReducer?.webviewPlatform
17
- // const store = {}
18
-
19
-
20
- const {__ROUTER_INITIAL_DATA__:routerInitialData,__INITIAL_STATE__ } = window
21
- // console.log("router initila data is ====>",routerInitialData)
22
- const store = configureStore(__INITIAL_STATE__||{})
23
- const router = createBrowserRouter(
24
- preparedRoutes({ store, routerInitialState:(routerInitialData) })
25
- )
26
-
27
- const Application = (
28
- <ClientProvider>
29
- <React.StrictMode>
30
- <RouterProvider router={router}/>
31
- </React.StrictMode>
32
- </ClientProvider>
33
- )
34
- // localStorage.setItem("isWebview", window.__INITIAL_STATE__?.shellReducer?.isWebview)
35
-
36
- const container = document.getElementById("app")
37
- hydrateRoot(container, Application)
38
- })
39
- })
@@ -1,18 +0,0 @@
1
- {
2
- "S3_BUCKET": "",
3
- "S3_FOLDER": "",
4
- "CDN_ASSET_PATH": "",
5
- "APPLICATION_PORT": "",
6
- "APPLICATION_BASE_URL": "",
7
- "SERVER_PATH": "",
8
- "OUTPUT_PATH": "",
9
- "PUBLIC_OUTPUT_PATH": "",
10
- "PUBLIC_ASSET_PATH": "",
11
- "LOCAL_ASSET_PATH": "",
12
- "EXTERNAL_BASE_URL": "",
13
- "DEV_SERVER_PORT": 0,
14
- "DEV_SERVER_HOSTNAME": "",
15
- "DEV_SERVER_HOST_URL": "",
16
- "ENV_NAME": "",
17
- "BUILD_ENV": ""
18
- }
@@ -1,77 +0,0 @@
1
- module.exports = {
2
- // Enable or disable server-side rendering
3
- enableSSR: true,
4
-
5
- // Enable or disable dynamic imports (code splitting)
6
- enableDynamicImports: true,
7
-
8
- // Enable or disable speed measure plugin to measure your webpack build speed
9
- enableSpeedMeasure: false,
10
-
11
- // The env vars to expose on the client side. If you add them here, they will
12
- // be available on the client as process.env[VAR_NAME], same as they would be
13
- // in node.js.
14
- //
15
- // **WARNING**: Be careful not to expose any secrets here!
16
- clientEnv: [
17
- "NODE_ENV",
18
- "APPLICATION_BASE_URL",
19
- "LOCAL_ASSET_PATH",
20
- "INTERNAL_NODE_API_URL",
21
- "EXTERNAL_CLOUDFLARE_API_URL",
22
- "EXTERNAL_DIRECT_API_URL",
23
- "DOCTORS_EXTERNAL_DIRECT_API_URL",
24
- "EXTERNAL_LABS_DIRECT_API_URL",
25
- "BUILD_ENV",
26
- "EXTERNAL_BASE_URL",
27
- "GTM_ID",
28
- "DOCTORS_API_URL",
29
- "TOKEN",
30
- "AWS_ACCESS_KEY_ID",
31
- "AWS_SECRET_ACCESS_KEY",
32
- "CDN_ASSET_PATH",
33
- "S3_FOLDER",
34
- "S3_BUCKET",
35
- "TC_APP_NAME",
36
- "TC_LANGUAGE_LOCALE",
37
- "TC_PARTNER_KEY",
38
- "TC_TITLE_STRING",
39
- "RECAPTCHA_KEY",
40
- "SERVER_PATH",
41
- "BUILD_NUMBER",
42
- "RUDDER_KEY",
43
- "RUDDER_AMP_KEY",
44
- "RUDDER_URI",
45
- "RUDDER_URL",
46
- "GPT_ID",
47
- "PUBLIC_ASSET_PATH",
48
- "TATA_CLIENT_ID",
49
- "TATA_SSO_SCRIPT",
50
- "LOCAL_BUILD_PUBLIC_ASSET_PATH",
51
- "APPLICATION",
52
- "OUTPUT_PATH",
53
- "PUBLIC_OUTPUT_PATH",
54
- "UHI_HOST",
55
- "GOOGLE_API_KEY_CLIENT",
56
- "ENV_NAME",
57
- "HIDE_OTP_ON_CALL",
58
- "FACEBOOK_PIXEL_ID",
59
- ],
60
-
61
- /* The identifier to use for css-modules.
62
- */
63
- cssModulesIdentifierProd: "[name]__[local]__[hash:base64:5]",
64
- cssModulesIdentifierDev: "[name]__[local]",
65
-
66
- // Isomorphic configuration
67
- isomorphicConfig: {
68
- debug: true,
69
-
70
- assets: {
71
- images: {
72
- extensions: ["png", "jpg", "jpeg", "gif", "ico", "svg", "json"],
73
- },
74
- },
75
- },
76
- defaultCity: "New Delhi",
77
- }
@@ -1,56 +0,0 @@
1
- {
2
- "name": "create-catalyst-app-starter",
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
- "scripts": {
8
- "start": "node checkVersion && npx babel-node node_modules/catalyst/webpack/development.client.babel & npx babel-node -r ./node_modules/catalyst/scripts/loadScriptsBeforeServerStarts.js node_modules/catalyst/server/index.js --watch-path=node_modules/catalyst/server --watch-path=src --watch-path=server",
9
- "build": "rm -rf build & node ./node_modules/catalyst/scripts/loadScriptsBeforeServerStarts.js & APPLICATION=mweb NODE_ENV=production webpack --config node_modules/catalyst/webpack/production.client.babel.js --progress && APPLICATION=mweb NODE_ENV=production SSR=true webpack --config node_modules/catalyst/webpack/production.ssr.babel.js --progress && APPLICATION=mweb NODE_ENV=production npx babel node_modules/catalyst/server --out-dir ./build --ignore '**/*.test.js,node_modules/catalyst/server/renderer/handler.js' && APPLICATION=mweb npx babel ./server --out-dir ./build",
10
- "build:client": "NODE_ENV=production webpack --config node_modules/catalyst/webpack/production.client.babel.js --progress",
11
- "serve": "APPLICATION=mweb NODE_ENV=production node -r ./node_modules/catalyst/scripts/loadScriptsBeforeServerStarts.js ./build/index.js",
12
- "build:ssr": "SSR=true webpack --config node_modules/catalyst/webpack/production.ssr.babel.js --progress",
13
- "analyze": "webpack-bundle-analyzer ./build/public/loadable-stats.json"
14
- },
15
- "_moduleAliases": {
16
- "@containers": "src/js/containers",
17
- "@lib": "src/js/lib",
18
- "$server": "server/",
19
- "@commonUtils": "commonUtils",
20
- "@constants": "src/js/constants",
21
- "@config": "config",
22
- "@components": "src/js/components",
23
- "@widgets": "src/js/widgets",
24
- "@wrappers": "src/js/wrappers",
25
- "@flows": "src/js/flows",
26
- "@css": "src/static/css"
27
- },
28
- "repository": {
29
- "type": "git",
30
- "url": "https://github.com/tata1mg/catalyst"
31
- },
32
- "dependencies": {
33
- "@loadable/component": "^5.16.3",
34
- "@tata1mg/cacheable-api-proxy": "^1.0.2",
35
- "@tata1mg/router": "^0.0.1-alpha.10",
36
- "catalyst": "bitbucket:tata1mg/catalyst#scaffolding_final",
37
- "event-source-polyfill": "^1.0.31",
38
- "express-static-gzip": "^2.1.7",
39
- "framer-motion": "^10.18.0",
40
- "isomorphic-dompurify": "^2.2.0",
41
- "prop-types": "^15.8.1",
42
- "react-helmet-async": "^2.0.4",
43
- "react-intersection-observer": "^9.5.3",
44
- "react-loadable-visibility": "^3.0.2"
45
- },
46
- "author": "",
47
- "license": "ISC",
48
- "bugs": {
49
- "url": "https://github.com/tata1mg/catalyst/issues"
50
- },
51
- "homepage": "https://github.com/tata1mg/catalyst#readme",
52
- "devDependencies": {
53
- "@babel/core": "^7.23.7",
54
- "@babel/node": "^7.22.19"
55
- }
56
- }
@@ -1,14 +0,0 @@
1
- import React from "react"
2
- import { Head, Body } from "catalyst-core"
3
-
4
- function Document(props) {
5
- return (
6
- <html lang={props.lang}>
7
- <Head {...props}>
8
- <meta charset="final-order" />
9
- </Head>
10
- <Body {...props} />
11
- </html>
12
- )
13
- }
14
- export default Document
@@ -1,3 +0,0 @@
1
- export const preServerInit = () => {
2
- console.log("preServerInit")
3
- }
@@ -1,16 +0,0 @@
1
- export function addMiddlewares(app) {
2
- const env = process.env.NODE_ENV || "development"
3
- console.log("custom server called !!!!")
4
-
5
- app.use("/pwa-api/service-worker.js", (req, res, next) => {
6
-
7
- res.send("ok")
8
- })
9
- app.use(
10
- "/favicon.ico",
11
- (req, res, next) => {
12
-
13
- res.send("ok")
14
- }
15
- )
16
- }
@@ -1,20 +0,0 @@
1
- const createActionTypes = (prefix, actionTypeList = []) => {
2
- const actionTypesObject = {}
3
- actionTypeList.forEach((item) => {
4
- actionTypesObject[item] = `${prefix}/${item}`
5
- })
6
-
7
- return actionTypesObject
8
- }
9
-
10
- export default createActionTypes
11
-
12
- export const ShellActions = createActionTypes("shellActions", [
13
- "REDUX_TEST"
14
- ])
15
- export const reduxTest = () => {
16
-
17
- return {
18
- type: ShellActions.REDUX_TEST,
19
- }
20
- }