create-catalyst-app 0.0.1-beta.0
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 +20 -0
- package/readme.md +53 -0
- package/scripts/cli.mjs +267 -0
- package/templates/common/.babelrc +26 -0
- package/templates/common/.editorconfig +12 -0
- package/templates/common/.eslintignore +6 -0
- package/templates/common/.eslintrc +53 -0
- package/templates/common/.prettierrc.json +7 -0
- package/templates/common/.stylelintrc +35 -0
- package/templates/common/README.md +29 -0
- package/templates/common/api.js +29 -0
- package/templates/common/checkVersion.js +3 -0
- package/templates/common/client/index.js +39 -0
- package/templates/common/client/styles.js +15 -0
- package/templates/common/config/config.json +18 -0
- package/templates/common/config/config_template.json +18 -0
- package/templates/common/config/index.js +77 -0
- package/templates/common/package.json +57 -0
- package/templates/common/server/CustomDocument.js +14 -0
- package/templates/common/server/customIndex.js +3 -0
- package/templates/common/server/customServer.js +16 -0
- package/templates/common/src/js/containers/App/actions.js +20 -0
- package/templates/common/src/js/containers/App/index.js +46 -0
- package/templates/common/src/js/containers/App/reducer.js +21 -0
- package/templates/common/src/js/containers/Home/Home.js +40 -0
- package/templates/common/src/js/containers/PDP/PDP.js +37 -0
- package/templates/common/src/js/reducer/index.js +80 -0
- package/templates/common/src/js/routes/index.js +50 -0
- package/templates/common/src/js/stateManager/stateProvider.js +34 -0
- package/templates/common/src/js/store/index.js +77 -0
- package/templates/common/src/static/css/base/_overrides.scss +81 -0
- package/templates/common/src/static/css/base/animations.js +38 -0
- package/templates/common/src/static/css/base/index.scss +8 -0
- package/templates/common/src/static/css/base/layout.scss +242 -0
- package/templates/common/src/static/css/base/styles.scss +163 -0
- package/templates/common/src/static/css/base/typography.scss +285 -0
- package/templates/common/src/static/css/resources/_mixins.scss +196 -0
- package/templates/common/src/static/css/resources/_variables.scss +172 -0
- package/templates/common/src/static/css/resources/_vendors.scss +1 -0
- 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 +26 -0
- package/templates/none-js/.eslintignore +6 -0
- package/templates/none-js/.eslintrc +53 -0
- package/templates/none-js/.prettierrc.json +7 -0
- package/templates/none-js/.stylelintrc +35 -0
- package/templates/none-js/README.md +22 -0
- package/templates/none-js/api.js +29 -0
- package/templates/none-js/checkVersion.js +3 -0
- package/templates/none-js/client/index.js +27 -0
- package/templates/none-js/client/styles.js +15 -0
- package/templates/none-js/config/config.json +15 -0
- package/templates/none-js/config/config_template.json +18 -0
- package/templates/none-js/config/index.js +44 -0
- package/templates/none-js/package.json +53 -0
- package/templates/none-js/server/document.js +14 -0
- package/templates/none-js/server/index.js +3 -0
- package/templates/none-js/server/server.js +16 -0
- package/templates/none-js/src/js/containers/App/index.js +40 -0
- package/templates/none-js/src/js/containers/DemoPage/DemoPage.js +39 -0
- package/templates/none-js/src/js/containers/DemoPage/DemoPage.scss +3 -0
- package/templates/none-js/src/js/containers/Home/Home.js +27 -0
- package/templates/none-js/src/js/containers/Home/Home.scss +36 -0
- package/templates/none-js/src/js/routes/index.js +49 -0
- package/templates/none-js/src/js/stateManager/stateProvider.js +19 -0
- package/templates/none-js/src/js/store/index.js +6 -0
- package/templates/none-js/src/static/css/base/index.scss +3 -0
- package/templates/none-js/src/static/css/base/styles.scss +11 -0
- package/templates/none-js/src/static/css/base/typography.scss +53 -0
- package/templates/none-js/src/static/css/resources/_variables.scss +1 -0
- 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 +5 -0
- package/templates/redux-js/.babelrc +26 -0
- package/templates/redux-js/.eslintignore +6 -0
- package/templates/redux-js/.eslintrc +53 -0
- package/templates/redux-js/.prettierrc.json +7 -0
- package/templates/redux-js/.stylelintrc +35 -0
- package/templates/redux-js/README.md +22 -0
- package/templates/redux-js/api.js +29 -0
- package/templates/redux-js/checkVersion.js +3 -0
- package/templates/redux-js/client/index.js +27 -0
- package/templates/redux-js/client/styles.js +15 -0
- package/templates/redux-js/config/config.json +15 -0
- package/templates/redux-js/config/config_template.json +18 -0
- package/templates/redux-js/config/index.js +44 -0
- package/templates/redux-js/package.json +53 -0
- package/templates/redux-js/server/document.js +14 -0
- package/templates/redux-js/server/index.js +3 -0
- package/templates/redux-js/server/server.js +16 -0
- package/templates/redux-js/src/js/containers/App/actions.js +20 -0
- package/templates/redux-js/src/js/containers/App/index.js +42 -0
- package/templates/redux-js/src/js/containers/App/reducer.js +21 -0
- package/templates/redux-js/src/js/containers/DemoPage/DemoPage.js +39 -0
- package/templates/redux-js/src/js/containers/DemoPage/DemoPage.scss +3 -0
- package/templates/redux-js/src/js/containers/Home/Home.js +27 -0
- package/templates/redux-js/src/js/containers/Home/Home.scss +36 -0
- package/templates/redux-js/src/js/reducer/index.js +80 -0
- package/templates/redux-js/src/js/routes/index.js +49 -0
- package/templates/redux-js/src/js/stateManager/stateProvider.js +34 -0
- package/templates/redux-js/src/js/store/index.js +79 -0
- package/templates/redux-js/src/static/css/base/index.scss +3 -0
- package/templates/redux-js/src/static/css/base/styles.scss +11 -0
- package/templates/redux-js/src/static/css/base/typography.scss +53 -0
- package/templates/redux-js/src/static/css/resources/_variables.scss +1 -0
- 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 +5 -0
- package/templates/rtk-js/.babelrc +26 -0
- package/templates/rtk-js/.eslintignore +6 -0
- package/templates/rtk-js/.eslintrc +53 -0
- package/templates/rtk-js/.prettierrc.json +7 -0
- package/templates/rtk-js/.stylelintrc +35 -0
- package/templates/rtk-js/README.md +23 -0
- package/templates/rtk-js/api.js +29 -0
- package/templates/rtk-js/checkVersion.js +3 -0
- package/templates/rtk-js/client/index.js +27 -0
- package/templates/rtk-js/client/styles.js +15 -0
- package/templates/rtk-js/config/config.json +15 -0
- package/templates/rtk-js/config/config_template.json +18 -0
- package/templates/rtk-js/config/index.js +44 -0
- package/templates/rtk-js/package.json +53 -0
- package/templates/rtk-js/server/document.js +14 -0
- package/templates/rtk-js/server/index.js +3 -0
- package/templates/rtk-js/server/server.js +16 -0
- package/templates/rtk-js/src/js/containers/App/index.js +42 -0
- package/templates/rtk-js/src/js/containers/App/reducer.js +26 -0
- package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.js +39 -0
- package/templates/rtk-js/src/js/containers/DemoPage/DemoPage.scss +3 -0
- package/templates/rtk-js/src/js/containers/Home/Home.js +27 -0
- package/templates/rtk-js/src/js/containers/Home/Home.scss +36 -0
- package/templates/rtk-js/src/js/reducer/index.js +80 -0
- package/templates/rtk-js/src/js/routes/index.js +49 -0
- package/templates/rtk-js/src/js/stateManager/stateProvider.js +34 -0
- package/templates/rtk-js/src/js/store/index.js +22 -0
- package/templates/rtk-js/src/static/css/base/index.scss +3 -0
- package/templates/rtk-js/src/static/css/base/styles.scss +11 -0
- package/templates/rtk-js/src/static/css/base/typography.scss +53 -0
- package/templates/rtk-js/src/static/css/resources/_variables.scss +1 -0
- 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 +5 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: Inter;
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 300;
|
|
5
|
+
font-display: block;
|
|
6
|
+
src: local("Inter Light"), local("Inter-Light"), url($font_url + "Inter-Light-Subset.otf");
|
|
7
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@font-face {
|
|
11
|
+
font-family: Inter;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
font-display: block;
|
|
15
|
+
src: local("Inter Regular"), local("Inter-Regular"), url($font_url + "Inter-Regular-Subset.otf");
|
|
16
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@font-face {
|
|
20
|
+
font-family: Inter;
|
|
21
|
+
font-style: italic;
|
|
22
|
+
font-weight: 400;
|
|
23
|
+
font-display: block;
|
|
24
|
+
src: local("Inter Italic"), local("Inter-Italic"), url($font_url + "Inter-Italic-Subset.otf");
|
|
25
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@font-face {
|
|
29
|
+
font-family: Inter;
|
|
30
|
+
font-style: normal;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
font-display: block;
|
|
33
|
+
src: local("Inter Medium"), local("Inter-Medium"), url($font_url + "Inter-Medium-Subset.otf");
|
|
34
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@font-face {
|
|
38
|
+
font-family: Inter;
|
|
39
|
+
font-style: normal;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
font-display: block;
|
|
42
|
+
src: local("Inter SemiBold"), local("Inter-SemiBold"), url($font_url + "Inter-SemiBold-Subset.otf");
|
|
43
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@font-face {
|
|
47
|
+
font-family: Inter;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: 700;
|
|
50
|
+
font-display: block;
|
|
51
|
+
src: local("Inter Bold"), local("Inter-Bold"), url($font_url + "Inter-Bold-Subset.otf");
|
|
52
|
+
unicode-range: U+0020-007F, U+201C, U+201D, U+00A;
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$sample-css-variable: #ff6f61;
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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).
|
|
@@ -0,0 +1,29 @@
|
|
|
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 }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { hydrateRoot } from "react-dom/client"
|
|
3
|
+
import { loadableReady } from "@loadable/component"
|
|
4
|
+
import { Provider } from "react-redux"
|
|
5
|
+
import { createBrowserRouter, RouterProvider } from "@tata1mg/router"
|
|
6
|
+
import { preparedRoutes } from "../src/js/routes/index.js"
|
|
7
|
+
import configureStore from "../src/js/store/index.js"
|
|
8
|
+
import "./styles"
|
|
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
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* Style Loader
|
|
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
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Include initial base styles.
|
|
14
|
+
import "normalize.css"
|
|
15
|
+
import "@css/base/index.scss"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"APPLICATION_PORT": "3005",
|
|
3
|
+
"APPLICATION_BASE_URL": "http://localhost:3005",
|
|
4
|
+
"SERVER_PATH": "http://localhost:3005",
|
|
5
|
+
"OUTPUT_PATH": "build",
|
|
6
|
+
"PUBLIC_OUTPUT_PATH": "build/public",
|
|
7
|
+
"PUBLIC_ASSET_PATH": "http://localhost:3006/assets/",
|
|
8
|
+
"LOCAL_ASSET_PATH": "/assets/",
|
|
9
|
+
"EXTERNAL_BASE_URL": "http://localhost:3005",
|
|
10
|
+
"DEV_SERVER_PORT": 3006,
|
|
11
|
+
"DEV_SERVER_HOSTNAME": "localhost",
|
|
12
|
+
"DEV_SERVER_HOST_URL": "http://localhost:3006",
|
|
13
|
+
"ENV_NAME": "local",
|
|
14
|
+
"BUILD_ENV": ""
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
"BUILD_ENV",
|
|
22
|
+
"EXTERNAL_BASE_URL",
|
|
23
|
+
"SERVER_PATH",
|
|
24
|
+
"ENV_NAME",
|
|
25
|
+
"src_path"
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
/* The identifier to use for css-modules.
|
|
29
|
+
*/
|
|
30
|
+
cssModulesIdentifierProd: "[name]__[local]__[hash:base64:5]",
|
|
31
|
+
cssModulesIdentifierDev: "[name]__[local]",
|
|
32
|
+
|
|
33
|
+
// Isomorphic configuration
|
|
34
|
+
isomorphicConfig: {
|
|
35
|
+
debug: true,
|
|
36
|
+
|
|
37
|
+
assets: {
|
|
38
|
+
images: {
|
|
39
|
+
extensions: ["png", "jpg", "jpeg", "gif", "ico", "svg", "json"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
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": "catalyst start",
|
|
9
|
+
"build": "catalyst build",
|
|
10
|
+
"serve": "catalyst serve"
|
|
11
|
+
},
|
|
12
|
+
"_moduleAliases": {
|
|
13
|
+
"@containers": "src/js/containers",
|
|
14
|
+
"@lib": "src/js/lib",
|
|
15
|
+
"$server": "server",
|
|
16
|
+
"@constants": "src/js/constants",
|
|
17
|
+
"@config": "config",
|
|
18
|
+
"@components": "src/js/components",
|
|
19
|
+
"@css": "src/static/css"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/tata1mg/catalyst"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@loadable/component": "^5.16.3",
|
|
27
|
+
"@tata1mg/router": "^0.0.1-alpha.13",
|
|
28
|
+
"catalyst-core":"0.0.1-beta.1",
|
|
29
|
+
"event-source-polyfill": "^1.0.31",
|
|
30
|
+
"express-static-gzip": "^2.1.7",
|
|
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
|
+
"pwa": "git+git@bitbucket.org:tata1mg/catalyst.git#framework-scaffolding",
|
|
36
|
+
"react-dfp": "^0.21.0",
|
|
37
|
+
"react-helmet-async":"^1.3.0",
|
|
38
|
+
"react-intersection-observer": "^9.5.3",
|
|
39
|
+
"react-loadable-visibility": "^3.0.2",
|
|
40
|
+
"react-redux": "^8.1.3",
|
|
41
|
+
"@reduxjs/toolkit": "1.9.3"
|
|
42
|
+
},
|
|
43
|
+
"author": "",
|
|
44
|
+
"license": "ISC",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/tata1mg/catalyst/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/tata1mg/catalyst#readme",
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@babel/core": "^7.23.7",
|
|
51
|
+
"@babel/node": "^7.22.19"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { useState } from "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";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export const BaseOutlet = () => {
|
|
12
|
+
const o = useOutlet();
|
|
13
|
+
const [outlet] = useState(o);
|
|
14
|
+
|
|
15
|
+
return <>{outlet}</>;
|
|
16
|
+
};
|
|
17
|
+
const App = () => {
|
|
18
|
+
|
|
19
|
+
const location = useLocation();
|
|
20
|
+
const page = (
|
|
21
|
+
<div key={location.pathname.includes("/auth") ? "" : location.pathname}>
|
|
22
|
+
<UNSAFE_LocationContext.Provider value={{ location }}>
|
|
23
|
+
<BaseOutlet />
|
|
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
|
+
};
|
|
36
|
+
|
|
37
|
+
App.serverSideFunction = ({store}) => {
|
|
38
|
+
store.dispatch(reduxTest())
|
|
39
|
+
return new Promise((resolve) => resolve());
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default App;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createSlice } from "@reduxjs/toolkit"
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
testActionDispatched: false,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const appSlice = createSlice({
|
|
8
|
+
name: "shellReducer",
|
|
9
|
+
initialState: initialState,
|
|
10
|
+
reducers: {
|
|
11
|
+
reduxTest: (state, action) => {
|
|
12
|
+
state.testActionDispatched = true
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const { reduxTest } = appSlice.actions
|
|
18
|
+
export const shellReducer = appSlice.reducer
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import { useCurrentRouteData, Link } from "@tata1mg/router";
|
|
3
|
+
import css from './DemoPage.scss'
|
|
4
|
+
|
|
5
|
+
const Demo = () => {
|
|
6
|
+
const { data, isFetched, loading } = useCurrentRouteData() || {}
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
console.log("data is =>", data)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
|
|
14
|
+
<div>
|
|
15
|
+
<div className={css.textColor}>Welcome to Demo page</div>
|
|
16
|
+
<Link to={"/"}>link</Link>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Demo.serverFetcher = async ({ req }, { store }) => {
|
|
22
|
+
console.log("server fetcher called!!")
|
|
23
|
+
const res = await fetch("https://jsonblob.com/api/1206830251241234432");
|
|
24
|
+
const json = await res.json();
|
|
25
|
+
return json;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
Demo.clientFetcher = async ({ }, { }) => {
|
|
29
|
+
console.log("client fetcher called")
|
|
30
|
+
const res = await fetch("https://jsonblob.com/api/1206830251241234432");
|
|
31
|
+
const json = await res.json();
|
|
32
|
+
return json;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
Demo.MetaTagFunction = (routerData) => {
|
|
36
|
+
return [<title key="PDP">PDP</title>]
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Demo;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Link } from "@tata1mg/router";
|
|
3
|
+
import css from './Home.scss'
|
|
4
|
+
|
|
5
|
+
function Landing() {
|
|
6
|
+
return (
|
|
7
|
+
<div className={css.app}>
|
|
8
|
+
<header className={css.appHeader}>
|
|
9
|
+
<h1 className={css.heading}>Catalyst</h1>
|
|
10
|
+
<p>
|
|
11
|
+
Edit files inside src directory and save to reload.
|
|
12
|
+
</p>
|
|
13
|
+
<a
|
|
14
|
+
className={css.appLink}
|
|
15
|
+
href="https://catalyst.1mg.com"
|
|
16
|
+
target="_blank"
|
|
17
|
+
rel="noopener noreferrer"
|
|
18
|
+
>
|
|
19
|
+
Learn Catalyst
|
|
20
|
+
</a>
|
|
21
|
+
<Link to="/demo" className={css.appLink}>Navigate to demo page</Link>
|
|
22
|
+
</header>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default Landing
|