catalyst-core 0.0.1-beta.4 → 0.0.1-beta.6
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/babel.config.json +1 -0
- package/bin/catalyst.js +2 -5
- package/changelog.md +14 -22
- package/dist/caching.js +1 -0
- package/dist/index.js +1 -0
- package/dist/logger.js +10 -0
- package/dist/router/ClientRouter.js +3 -0
- package/dist/router/ServerRouter.js +1 -0
- package/dist/router.js +1 -0
- package/dist/scripts/build.js +10 -0
- package/dist/scripts/centralImport.js +1 -0
- package/dist/scripts/checkVersion.js +1 -0
- package/dist/scripts/devBuild.js +10 -0
- package/dist/scripts/devServe.js +5 -0
- package/dist/scripts/loadEnvironmentVariables.js +5 -0
- package/dist/scripts/loadScriptsBeforeServerStarts.js +4 -0
- package/dist/scripts/registerAliases.js +2 -0
- package/dist/scripts/scriptUtils.js +2 -0
- package/dist/scripts/serve.js +5 -0
- package/dist/scripts/start.js +6 -0
- package/dist/scripts/validator.js +1 -0
- package/dist/server/expressServer.js +9 -0
- package/dist/server/renderer/document/Body.js +14 -0
- package/dist/server/renderer/document/Head.js +9 -0
- package/dist/server/renderer/document/index.js +1 -0
- package/dist/server/renderer/extract.js +21 -0
- package/dist/server/renderer/handler.js +17 -0
- package/dist/server/renderer/index.js +1 -0
- package/dist/server/renderer/render.js +21 -0
- package/dist/server/startServer.js +6 -0
- package/dist/server/utils/userAgentUtil.js +9 -0
- package/dist/server/utils/validator.js +1 -0
- package/dist/webpack/babel-plugins/remove-client.plugin.js +5 -0
- package/dist/webpack/babel-plugins/remove-ssr.plugin.js +5 -0
- package/dist/webpack/babel.config.client.js +1 -0
- package/dist/webpack/babel.config.ssr.js +1 -0
- package/dist/webpack/base.babel.js +8 -0
- package/dist/webpack/development.client.babel.js +4 -0
- package/dist/webpack/production.client.babel.js +4 -0
- package/dist/webpack/production.ssr.babel.js +4 -0
- package/dist/webpack/scssParams.js +9 -0
- package/package.json +109 -87
- package/.eslintignore +0 -9
- package/.eslintrc +0 -92
- package/caching.js +0 -16
- package/index.js +0 -16
- package/logger.js +0 -99
- package/router/ClientRouter.js +0 -19
- package/router/ServerRouter.js +0 -19
- package/router/index.js +0 -32
- package/router.js +0 -16
- package/scripts/build.js +0 -42
- package/scripts/checkVersion.js +0 -5
- package/scripts/devBuild.js +0 -42
- package/scripts/devServe.js +0 -43
- package/scripts/loadEnvironmentVariables.js +0 -24
- package/scripts/loadScriptsBeforeServerStarts.js +0 -47
- package/scripts/prepare.js +0 -19
- package/scripts/registerAliases.js +0 -30
- package/scripts/serve.js +0 -43
- package/scripts/start.js +0 -35
- package/scripts/validator.js +0 -127
- package/server/expressServer.js +0 -50
- package/server/mainIndex.js +0 -65
- package/server/mainServer.js +0 -70
- package/server/renderer/document/Body.js +0 -36
- package/server/renderer/document/Head.js +0 -43
- package/server/renderer/document/index.js +0 -27
- package/server/renderer/extract.js +0 -87
- package/server/renderer/handler.js +0 -240
- package/server/renderer/index.js +0 -12
- package/server/renderer/render.js +0 -84
- package/server/renderer/userAgentUtil.js +0 -55
- package/server/startServer.js +0 -66
- package/server/utils/metaTags.js +0 -13
- package/server/utils/userAgentUtil.js +0 -51
- package/server/utils/validator.js +0 -127
- package/tsconfig.json +0 -110
- package/webpack/babel-plugins/remove-client.plugin.js +0 -31
- package/webpack/babel-plugins/remove-ssr.plugin.js +0 -21
- package/webpack/babel.config.client.js +0 -24
- package/webpack/babel.config.js +0 -20
- package/webpack/babel.config.ssr.js +0 -24
- package/webpack/base.babel.js +0 -175
- package/webpack/development.client.babel.js +0 -85
- package/webpack/plugins/mime-types.js +0 -82
- package/webpack/plugins/route-manifest-copy.js +0 -122
- package/webpack/plugins/route-manifest-plugin.js +0 -122
- package/webpack/plugins/upload-assets-plugin.js +0 -181
- package/webpack/production.client.babel.js +0 -78
- package/webpack/production.ssr.babel.js +0 -61
- package/webpack/scssParams.js +0 -51
package/package.json
CHANGED
|
@@ -1,89 +1,111 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
2
|
+
"name": "catalyst-core",
|
|
3
|
+
"version": "0.0.1-beta.6",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"description": "Web framework that provides great performance out of the box",
|
|
6
|
+
"bin": {
|
|
7
|
+
"catalyst": "bin/catalyst.js"
|
|
8
|
+
},
|
|
9
|
+
"_moduleAliases": {
|
|
10
|
+
"@catalyst/template": ".",
|
|
11
|
+
"@catalyst/template/src": "src",
|
|
12
|
+
"@catalyst/template/routes": "src/js/routes",
|
|
13
|
+
"@catalyst/template/server": "server",
|
|
14
|
+
"@catalyst/template/store": "src/js/store",
|
|
15
|
+
"@catalyst/template/config": "config",
|
|
16
|
+
"@catalyst": ".",
|
|
17
|
+
"@catalyst/root": "../",
|
|
18
|
+
"@catalyst/router": "router",
|
|
19
|
+
"@catalyst/scripts": "scripts",
|
|
20
|
+
"@catalyst/server": "server",
|
|
21
|
+
"@catalyst/webpack": "webpack"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": "./dist/index.js",
|
|
25
|
+
"./logger": "./dist/logger.js",
|
|
26
|
+
"./caching": "./dist/caching.js",
|
|
27
|
+
"./router/ClientRouter": "./dist/router/ClientRouter.js"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"lint-staged": "lint-staged",
|
|
32
|
+
"prettify": "prettier . --write",
|
|
33
|
+
"prepare": "babel src --out-dir ./dist",
|
|
34
|
+
"prepublishOnly": "npm i && npm run prepare"
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@babel/cli": "^7.23.0",
|
|
39
|
+
"@babel/core": "^7.23.2",
|
|
40
|
+
"@babel/node": "^7.22.19",
|
|
41
|
+
"@babel/preset-env": "^7.23.2",
|
|
42
|
+
"@babel/preset-react": "^7.22.15",
|
|
43
|
+
"@babel/register": "^7.22.15",
|
|
44
|
+
"@dr.pogodin/css-modules-require-hook": "^4.7.3",
|
|
45
|
+
"@loadable/babel-plugin": "^5.16.1",
|
|
46
|
+
"@loadable/component": "^5.15.3",
|
|
47
|
+
"@loadable/server": "^5.16.1",
|
|
48
|
+
"@loadable/webpack-plugin": "^5.15.2",
|
|
49
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
50
|
+
"@svgr/webpack": "^8.1.0",
|
|
51
|
+
"@tata1mg/router": "^0.0.1-beta.2",
|
|
52
|
+
"app-root-path": "^3.1.0",
|
|
53
|
+
"babel-loader": "^9.1.3",
|
|
54
|
+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
55
|
+
"body-parser": "^1.20.2",
|
|
56
|
+
"chokidar": "^3.6.0",
|
|
57
|
+
"compression": "^1.7.4",
|
|
58
|
+
"cookie-parser": "^1.4.6",
|
|
59
|
+
"css-hot-loader": "^1.4.4",
|
|
60
|
+
"css-loader": "^6.8.1",
|
|
61
|
+
"express": "^4.18.2",
|
|
62
|
+
"express-static-gzip": "^2.1.7",
|
|
63
|
+
"file-loader": "^6.2.0",
|
|
64
|
+
"html-loader": "^4.2.0",
|
|
65
|
+
"img-loader": "^4.0.0",
|
|
66
|
+
"mini-css-extract-plugin": "^2.7.6",
|
|
67
|
+
"module-alias": "^2.2.3",
|
|
68
|
+
"picocolors": "^1.0.0",
|
|
69
|
+
"postcss-loader": "^7.3.3",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"react-dom": "^18.2.0",
|
|
72
|
+
"react-redux": "^8.1.3",
|
|
73
|
+
"react-refresh": "^0.14.0",
|
|
74
|
+
"react-router-dom": "^6.16.0",
|
|
75
|
+
"redux": "^4.2.1",
|
|
76
|
+
"sass": "^1.69.5",
|
|
77
|
+
"sass-loader": "^13.3.2",
|
|
78
|
+
"sass-resources-loader": "^2.2.5",
|
|
79
|
+
"ua-parser-js": "^1.0.37",
|
|
80
|
+
"url": "^0.11.3",
|
|
81
|
+
"url-loader": "^4.1.1",
|
|
82
|
+
"webpack": "^5.88.2",
|
|
83
|
+
"webpack-bundle-analyzer": "^4.9.1",
|
|
84
|
+
"webpack-cli": "^5.1.4",
|
|
85
|
+
"webpack-dev-server": "^4.15.2",
|
|
86
|
+
"webpack-merge": "^5.9.0",
|
|
87
|
+
"webpack-node-externals": "^3.0.0",
|
|
88
|
+
"winston": "^3.11.0",
|
|
89
|
+
"winston-daily-rotate-file": "^5.0.0"
|
|
90
|
+
},
|
|
91
|
+
"devDependencies": {
|
|
92
|
+
"@babel/eslint-parser": "^7.19.1",
|
|
93
|
+
"@commitlint/cli": "^19.3.0",
|
|
94
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
95
|
+
"eslint": "^8.26.0",
|
|
96
|
+
"eslint-plugin-babel": "^5.3.1",
|
|
97
|
+
"eslint-plugin-react": "^7.34.1",
|
|
98
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
99
|
+
"eslint-plugin-risxss": "^2.1.0",
|
|
100
|
+
"eslint-plugin-security": "^3.0.0",
|
|
101
|
+
"husky": "^9.0.11",
|
|
102
|
+
"lint-staged": "^15.2.2",
|
|
103
|
+
"prettier": "^3.2.5"
|
|
104
|
+
},
|
|
105
|
+
"lint-staged": {
|
|
106
|
+
"*.{js,jsx}": [
|
|
107
|
+
"eslint .",
|
|
108
|
+
"prettier . --write"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
89
111
|
}
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@babel/eslint-parser",
|
|
3
|
-
"rules": {
|
|
4
|
-
"no-console": "error",
|
|
5
|
-
"react/prop-types": 1,
|
|
6
|
-
"react/display-name": [
|
|
7
|
-
0,
|
|
8
|
-
{
|
|
9
|
-
"ignoreTranspilerName": true
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"react-hooks/exhaustive-deps": "error", // Checks effect dependencies
|
|
13
|
-
"no-prototype-builtins": "off",
|
|
14
|
-
"security/detect-possible-timing-attacks": "error",
|
|
15
|
-
"security/detect-child-process": "error",
|
|
16
|
-
"security/detect-eval-with-expression": "error",
|
|
17
|
-
"security/detect-new-buffer": "error",
|
|
18
|
-
"security/detect-no-csrf-before-method-override": "error",
|
|
19
|
-
"risxss/catch-potential-xss-react": [
|
|
20
|
-
"error",
|
|
21
|
-
{
|
|
22
|
-
"trustedLibraries": [
|
|
23
|
-
"@commonUtils"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"react/jsx-no-target-blank": [
|
|
28
|
-
0,
|
|
29
|
-
{
|
|
30
|
-
"enforceDynamicLinks": "never"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
"env": {
|
|
35
|
-
"browser": true,
|
|
36
|
-
"es6": true,
|
|
37
|
-
"jest": true,
|
|
38
|
-
"node": true
|
|
39
|
-
},
|
|
40
|
-
"globals": {
|
|
41
|
-
"expect": true,
|
|
42
|
-
"__non_webpack_require__": true,
|
|
43
|
-
"logger": "readonly",
|
|
44
|
-
"AppCallbacks": "readonly"
|
|
45
|
-
},
|
|
46
|
-
"extends": [
|
|
47
|
-
"eslint:recommended",
|
|
48
|
-
"plugin:react/recommended"
|
|
49
|
-
],
|
|
50
|
-
"parserOptions": {
|
|
51
|
-
"sourceType": "module",
|
|
52
|
-
"ecmaFeatures": {
|
|
53
|
-
"experimentalObjectRestSpread": true,
|
|
54
|
-
"jsx": true
|
|
55
|
-
},
|
|
56
|
-
"babelOptions": {
|
|
57
|
-
"configFile": "./babel.config.json"
|
|
58
|
-
},
|
|
59
|
-
"ecmaVersion": 6
|
|
60
|
-
},
|
|
61
|
-
"plugins": [
|
|
62
|
-
"babel",
|
|
63
|
-
"react",
|
|
64
|
-
"react-hooks",
|
|
65
|
-
"security",
|
|
66
|
-
"risxss"
|
|
67
|
-
],
|
|
68
|
-
"settings": {
|
|
69
|
-
"react": {
|
|
70
|
-
"createClass": "createReactClass",
|
|
71
|
-
"pragma": "React",
|
|
72
|
-
"version": "detect"
|
|
73
|
-
},
|
|
74
|
-
"propWrapperFunctions": [
|
|
75
|
-
"forbidExtraProps",
|
|
76
|
-
{
|
|
77
|
-
"property": "freeze",
|
|
78
|
-
"object": "Object"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"property": "myFavoriteWrapper"
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
"linkComponents": [
|
|
85
|
-
"Hyperlink",
|
|
86
|
-
{
|
|
87
|
-
"name": "Link",
|
|
88
|
-
"linkAttribute": "to"
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
}
|
package/caching.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _apiCaching = require("@tata1mg/api-caching");
|
|
7
|
-
Object.keys(_apiCaching).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _apiCaching[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _apiCaching[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
package/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _index = require("./server/renderer/document/index");
|
|
7
|
-
Object.keys(_index).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _index[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _index[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
package/logger.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const winston = require("winston");
|
|
4
|
-
const DailyRotateFile = require("winston-daily-rotate-file");
|
|
5
|
-
const pc = require("picocolors");
|
|
6
|
-
const {
|
|
7
|
-
createLogger,
|
|
8
|
-
format,
|
|
9
|
-
transports
|
|
10
|
-
} = winston;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @description Logger library with rotational strategy. Creates a logs folder in root.
|
|
14
|
-
* With debug, error and info log directories with their respective log files.
|
|
15
|
-
*
|
|
16
|
-
* @format Logstash with timestamp
|
|
17
|
-
* @param config { @enableDebugLogs: Bool // default: true }
|
|
18
|
-
* @returns loggerInstance
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
const configureLogger = (config = {}) => {
|
|
22
|
-
const {
|
|
23
|
-
enableDebugLogs = true,
|
|
24
|
-
enableFileLogging = true,
|
|
25
|
-
enableConsoleLogging = true
|
|
26
|
-
} = config;
|
|
27
|
-
const consoleTransport = new transports.Console({
|
|
28
|
-
level: "debug"
|
|
29
|
-
});
|
|
30
|
-
const fileTransport = (type = "info") => {
|
|
31
|
-
return new DailyRotateFile({
|
|
32
|
-
filename: `./logs/${type}/%DATE%.${type}.log`,
|
|
33
|
-
datePattern: "YYYY-MM-DD",
|
|
34
|
-
maxFiles: "3d",
|
|
35
|
-
// Logs will be removed after 2days,
|
|
36
|
-
loglevel: type,
|
|
37
|
-
level: type
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
const infoLogger = createLogger({
|
|
41
|
-
format: format.combine(format.timestamp({
|
|
42
|
-
format: "YYYY-MM-DD HH:mm:ss"
|
|
43
|
-
}), format.json()),
|
|
44
|
-
defaultMeta: {
|
|
45
|
-
loglevel: "info"
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const debugLogger = createLogger({
|
|
49
|
-
format: format.combine(format.timestamp({
|
|
50
|
-
format: "YYYY-MM-DD HH:mm:ss"
|
|
51
|
-
}), format.json()),
|
|
52
|
-
defaultMeta: {
|
|
53
|
-
loglevel: "debug"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
const errorLogger = createLogger({
|
|
57
|
-
format: format.combine(format.timestamp({
|
|
58
|
-
format: "YYYY-MM-DD HH:mm:ss"
|
|
59
|
-
}), format.json()),
|
|
60
|
-
defaultMeta: {
|
|
61
|
-
loglevel: "error"
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
if (enableConsoleLogging && JSON.parse(enableConsoleLogging)) {
|
|
65
|
-
infoLogger.add(consoleTransport);
|
|
66
|
-
debugLogger.add(consoleTransport);
|
|
67
|
-
errorLogger.add(consoleTransport);
|
|
68
|
-
}
|
|
69
|
-
if (enableFileLogging && JSON.parse(enableFileLogging)) {
|
|
70
|
-
infoLogger.add(fileTransport("info"));
|
|
71
|
-
debugLogger.add(fileTransport("debug"));
|
|
72
|
-
errorLogger.add(fileTransport("error"));
|
|
73
|
-
}
|
|
74
|
-
const Logger = {
|
|
75
|
-
debug: () => {},
|
|
76
|
-
error: msg => {
|
|
77
|
-
/* eslint-disable no-console */
|
|
78
|
-
console.log(pc.red(pc.bold("ERROR: " + JSON.stringify(msg))));
|
|
79
|
-
errorLogger.error(msg);
|
|
80
|
-
},
|
|
81
|
-
info: msg => {
|
|
82
|
-
/* eslint-disable no-console */
|
|
83
|
-
console.log(pc.green(pc.bold("INFO: " + JSON.stringify(msg))));
|
|
84
|
-
infoLogger.info(msg);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
if (enableDebugLogs && JSON.parse(enableDebugLogs)) {
|
|
88
|
-
Logger.debug = msg => {
|
|
89
|
-
/* eslint-disable no-console */
|
|
90
|
-
console.log(pc.yellow(pc.bold("DEBUG: " + JSON.stringify(msg))));
|
|
91
|
-
debugLogger.debug(msg);
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
if (global) global.logger = Logger;
|
|
95
|
-
return Logger;
|
|
96
|
-
};
|
|
97
|
-
module.exports = {
|
|
98
|
-
configureLogger
|
|
99
|
-
};
|
package/router/ClientRouter.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _router = require("@tata1mg/router");
|
|
8
|
-
var _utils = require("@routes/utils.js");
|
|
9
|
-
/**
|
|
10
|
-
* @returns returns browsers routers (client routes)
|
|
11
|
-
*/
|
|
12
|
-
const clientRouter = ({
|
|
13
|
-
store,
|
|
14
|
-
routerInitialState
|
|
15
|
-
}) => (0, _router.createBrowserRouter)((0, _utils.preparedRoutes)({
|
|
16
|
-
store,
|
|
17
|
-
routerInitialState
|
|
18
|
-
}));
|
|
19
|
-
var _default = exports.default = clientRouter;
|
package/router/ServerRouter.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _router = require("@tata1mg/router");
|
|
8
|
-
var _utils = require("@routes/utils.js");
|
|
9
|
-
const ServerRouter = reduxData => {
|
|
10
|
-
const {
|
|
11
|
-
store,
|
|
12
|
-
intialData
|
|
13
|
-
} = reduxData;
|
|
14
|
-
return (0, _router.useRoutes)((0, _utils.preparedRoutes)({
|
|
15
|
-
store,
|
|
16
|
-
routerInitialState: intialData
|
|
17
|
-
}));
|
|
18
|
-
};
|
|
19
|
-
var _default = exports.default = ServerRouter;
|
package/router/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.preparedRoutes = exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _validator = require("../scripts/validator.js");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const {
|
|
11
|
-
default: routes
|
|
12
|
-
} = require(`${process.env.src_path}src/js/routes/index.js`);
|
|
13
|
-
/**
|
|
14
|
-
* @description prepares routes from routes defined inside template.
|
|
15
|
-
* Adds path and element key inside each route.
|
|
16
|
-
* @returns returns routes list after modifiing template routes
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const getRoutes = (0, _validator.validateGetRoutes)(routes) ? routes : [];
|
|
20
|
-
const preparedRoutes = () => {
|
|
21
|
-
return getRoutes()?.map((route, index) => {
|
|
22
|
-
const Component = route.element;
|
|
23
|
-
return {
|
|
24
|
-
path: route.path,
|
|
25
|
-
element: /*#__PURE__*/_react.default.createElement(Component, {
|
|
26
|
-
key: index
|
|
27
|
-
})
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
exports.preparedRoutes = preparedRoutes;
|
|
32
|
-
var _default = exports.default = getRoutes;
|
package/router.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _router = require("@tata1mg/router");
|
|
7
|
-
Object.keys(_router).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _router[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _router[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
package/scripts/build.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
spawnSync
|
|
5
|
-
} = require("child_process");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const {
|
|
8
|
-
name
|
|
9
|
-
} = require(`${process.env.PWD}/package.json`);
|
|
10
|
-
const {
|
|
11
|
-
BUILD_OUTPUT_PATH
|
|
12
|
-
} = require(`${process.env.PWD}/config/config.json`);
|
|
13
|
-
function arrayToObject(array) {
|
|
14
|
-
const obj = {};
|
|
15
|
-
array.forEach(item => {
|
|
16
|
-
const [key, value] = item.split("=");
|
|
17
|
-
if (value) obj[key] = value;
|
|
18
|
-
});
|
|
19
|
-
return obj;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description - creates a production build of the application.
|
|
24
|
-
*/
|
|
25
|
-
function start() {
|
|
26
|
-
const commandLineArguments = process.argv.slice(2);
|
|
27
|
-
const argumentsObject = arrayToObject(commandLineArguments);
|
|
28
|
-
const dirname = path.resolve(__dirname, "../");
|
|
29
|
-
spawnSync("npm", ["run", "build", `--src_path=${process.env.PWD}`, `--app_name=${name || "catalyst_app"}`], {
|
|
30
|
-
cwd: dirname,
|
|
31
|
-
stdio: "inherit",
|
|
32
|
-
env: {
|
|
33
|
-
...process.env,
|
|
34
|
-
src_path: process.env.PWD,
|
|
35
|
-
build_output_path: BUILD_OUTPUT_PATH,
|
|
36
|
-
NODE_ENV: "production",
|
|
37
|
-
IS_DEV_COMMAND: false,
|
|
38
|
-
...argumentsObject
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
start();
|
package/scripts/checkVersion.js
DELETED
package/scripts/devBuild.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
spawnSync
|
|
5
|
-
} = require("child_process");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const {
|
|
8
|
-
name
|
|
9
|
-
} = require(`${process.env.PWD}/package.json`);
|
|
10
|
-
const {
|
|
11
|
-
BUILD_OUTPUT_PATH
|
|
12
|
-
} = require(`${process.env.PWD}/config/config.json`);
|
|
13
|
-
function arrayToObject(array) {
|
|
14
|
-
const obj = {};
|
|
15
|
-
array.forEach(item => {
|
|
16
|
-
const [key, value] = item.split("=");
|
|
17
|
-
if (value) obj[key] = value;
|
|
18
|
-
});
|
|
19
|
-
return obj;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description - creates a production build of the application.
|
|
24
|
-
*/
|
|
25
|
-
function start() {
|
|
26
|
-
const commandLineArguments = process.argv.slice(2);
|
|
27
|
-
const argumentsObject = arrayToObject(commandLineArguments);
|
|
28
|
-
const dirname = path.resolve(__dirname, "../");
|
|
29
|
-
spawnSync("npm", ["run", "build", `--src_path=${process.env.PWD}`, `--app_name=${name || "catalyst_app"}`], {
|
|
30
|
-
cwd: dirname,
|
|
31
|
-
stdio: "inherit",
|
|
32
|
-
env: {
|
|
33
|
-
...process.env,
|
|
34
|
-
src_path: process.env.PWD,
|
|
35
|
-
build_output_path: BUILD_OUTPUT_PATH,
|
|
36
|
-
NODE_ENV: "production",
|
|
37
|
-
IS_DEV_COMMAND: true,
|
|
38
|
-
...argumentsObject
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
start();
|