@common-stack/generate-plugin 6.0.6-alpha.8 → 6.0.6-alpha.81
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/CHANGELOG.md +270 -0
- package/README.md +157 -211
- package/cde-config.json +43 -42
- package/docker-releases/backend/package.json +136 -0
- package/docker-releases/frontend/antd/package.json +122 -0
- package/generators.json +5 -0
- package/lib/{constants/index.cjs → common/constants.cjs} +1 -1
- package/lib/common/constants.cjs.map +1 -0
- package/lib/{constants/index.mjs → common/constants.mjs} +1 -1
- package/lib/common/constants.mjs.map +1 -0
- package/lib/generators/add-backend/files/package.json +3 -4
- package/lib/generators/add-backend/files/src/api/root-schema.graphqls +1 -7
- package/lib/generators/add-backend/generator.cjs +12 -3
- package/lib/generators/add-backend/generator.cjs.map +1 -1
- package/lib/generators/add-backend/generator.mjs +12 -3
- package/lib/generators/add-backend/generator.mjs.map +1 -1
- package/lib/generators/add-backend/schema.json +6 -1
- package/lib/generators/add-frontend/frameworks/antui/root.tsx.template +2 -2
- package/lib/generators/add-frontend/frameworks/chakraui/root.tsx.template +4 -3
- package/lib/generators/add-frontend/frameworks/tailwindui/root.tsx.template +2 -2
- package/lib/generators/add-frontend/generator.cjs +17 -13
- package/lib/generators/add-frontend/generator.cjs.map +1 -1
- package/lib/generators/add-frontend/generator.mjs +12 -8
- package/lib/generators/add-frontend/generator.mjs.map +1 -1
- package/lib/generators/add-frontend/schema.json +8 -3
- package/lib/generators/add-frontend/templates/config.json +2 -47
- package/lib/generators/add-frontend/templates/package.json +5 -8
- package/lib/generators/add-frontend/templates/tools/checkQueryUsage.mjs +192 -0
- package/lib/generators/add-frontend/templates/tools/mergeConfig.js +5 -2
- package/lib/generators/add-frontend/templates/vite.config.ts.template +53 -32
- package/lib/generators/add-fullstack/files/Jenkinsfile +7 -7
- package/lib/generators/add-fullstack/files/package.json +20 -14
- package/lib/generators/add-fullstack/files/tools/html-plugin-template.ejs +28 -0
- package/lib/generators/add-fullstack/files/tools/update-dependencies.mjs +95 -63
- package/lib/generators/add-fullstack/files/tools/update-dependency-link.mjs +12 -10
- package/lib/generators/add-fullstack/files/tools/{update-dependency-version.js → update-dependency-version.mjs} +57 -26
- package/lib/generators/add-fullstack/generator.cjs +39 -30
- package/lib/generators/add-fullstack/generator.cjs.map +1 -1
- package/lib/generators/add-fullstack/generator.mjs +39 -30
- package/lib/generators/add-fullstack/generator.mjs.map +1 -1
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.cjs +8 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.cjs.map +1 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.d.ts +2 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.mjs +8 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.mjs.map +1 -0
- package/lib/generators/add-fullstack/updates/ignoreUpdate.cjs +19 -0
- package/lib/generators/add-fullstack/updates/ignoreUpdate.cjs.map +1 -0
- package/lib/generators/add-fullstack/updates/ignoreUpdate.d.ts +3 -0
- package/lib/generators/add-fullstack/updates/ignoreUpdate.mjs +19 -0
- package/lib/generators/add-fullstack/updates/ignoreUpdate.mjs.map +1 -0
- package/lib/generators/add-fullstack/updates/index.d.ts +4 -0
- package/lib/generators/add-fullstack/updates/jenkinsfileUpdate.cjs +5 -4
- package/lib/generators/add-fullstack/updates/jenkinsfileUpdate.cjs.map +1 -1
- package/lib/generators/add-fullstack/updates/jenkinsfileUpdate.d.ts +2 -1
- package/lib/generators/add-fullstack/updates/jenkinsfileUpdate.mjs +5 -4
- package/lib/generators/add-fullstack/updates/jenkinsfileUpdate.mjs.map +1 -1
- package/lib/generators/add-fullstack/updates/lernaJsonUpdate.cjs +45 -0
- package/lib/generators/add-fullstack/updates/lernaJsonUpdate.cjs.map +1 -0
- package/lib/generators/add-fullstack/updates/lernaJsonUpdate.d.ts +3 -0
- package/lib/generators/add-fullstack/updates/lernaJsonUpdate.mjs +45 -0
- package/lib/generators/add-fullstack/updates/lernaJsonUpdate.mjs.map +1 -0
- package/lib/generators/add-fullstack/updates/licenseUpdate.cjs +19 -0
- package/lib/generators/add-fullstack/updates/licenseUpdate.cjs.map +1 -0
- package/lib/generators/add-fullstack/updates/licenseUpdate.d.ts +2 -0
- package/lib/generators/add-fullstack/updates/licenseUpdate.mjs +19 -0
- package/lib/generators/add-fullstack/updates/licenseUpdate.mjs.map +1 -0
- package/lib/generators/add-fullstack/updates/packageJsonUpdate.cjs +38 -4
- package/lib/generators/add-fullstack/updates/packageJsonUpdate.cjs.map +1 -1
- package/lib/generators/add-fullstack/updates/packageJsonUpdate.d.ts +2 -1
- package/lib/generators/add-fullstack/updates/packageJsonUpdate.mjs +38 -4
- package/lib/generators/add-fullstack/updates/packageJsonUpdate.mjs.map +1 -1
- package/lib/generators/add-moleculer/files/charts/chart/Chart.yaml +1 -1
- package/lib/generators/add-moleculer/files/package.json +5 -5
- package/lib/generators/add-moleculer/generator.cjs +7 -4
- package/lib/generators/add-moleculer/generator.cjs.map +1 -1
- package/lib/generators/add-moleculer/generator.mjs +7 -4
- package/lib/generators/add-moleculer/generator.mjs.map +1 -1
- package/lib/generators/add-moleculer/schema.json +9 -4
- package/lib/generators/add-package/generator.cjs +50 -0
- package/lib/generators/add-package/generator.cjs.map +1 -0
- package/lib/generators/add-package/generator.d.ts +5 -0
- package/lib/generators/add-package/generator.mjs +50 -0
- package/lib/generators/add-package/generator.mjs.map +1 -0
- package/lib/generators/add-package/schema.json +29 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -4
- package/lib/index.mjs +1 -1
- package/lib/utils/filesConfig.cjs +76 -0
- package/lib/utils/filesConfig.cjs.map +1 -0
- package/lib/utils/filesConfig.d.ts +2 -0
- package/lib/utils/filesConfig.mjs +76 -0
- package/lib/utils/filesConfig.mjs.map +1 -0
- package/lib/utils/index.cjs +28 -2
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.mjs +28 -2
- package/lib/utils/index.mjs.map +1 -1
- package/lib/utils/syncConfig.cjs +116 -0
- package/lib/utils/syncConfig.cjs.map +1 -0
- package/lib/utils/syncConfig.d.ts +9 -0
- package/lib/utils/syncConfig.mjs +116 -0
- package/lib/utils/syncConfig.mjs.map +1 -0
- package/package.json +3 -4
- package/rollup.config.mjs +2 -8
- package/src/generators/add-backend/generator.ts +14 -3
- package/src/generators/add-backend/schema.d.ts +1 -0
- package/src/generators/add-backend/schema.json +6 -1
- package/src/generators/add-frontend/frameworks/antui/root.tsx.template +2 -2
- package/src/generators/add-frontend/frameworks/chakraui/root.tsx.template +4 -3
- package/src/generators/add-frontend/frameworks/tailwindui/root.tsx.template +2 -2
- package/src/generators/add-frontend/generator.ts +12 -8
- package/src/generators/add-frontend/schema.d.ts +1 -0
- package/src/generators/add-frontend/schema.json +8 -3
- package/src/generators/add-fullstack/files/Jenkinsfile +7 -7
- package/src/generators/add-fullstack/files/LICENSE-IST +39 -0
- package/src/generators/add-fullstack/files/package.json +20 -14
- package/src/generators/add-fullstack/files/tools/html-plugin-template.ejs +28 -0
- package/src/generators/add-fullstack/files/tools/update-dependencies.mjs +95 -63
- package/src/generators/add-fullstack/files/tools/update-dependency-link.mjs +12 -10
- package/src/generators/add-fullstack/files/tools/{update-dependency-version.js → update-dependency-version.mjs} +57 -26
- package/src/generators/add-fullstack/generator.ts +64 -38
- package/src/generators/add-fullstack/updates/htmlPluginUpdate.ts +11 -0
- package/src/generators/add-fullstack/updates/ignoreUpdate.ts +23 -0
- package/src/generators/add-fullstack/updates/index.ts +4 -0
- package/src/generators/add-fullstack/updates/jenkinsfileUpdate.ts +6 -4
- package/src/generators/add-fullstack/updates/lernaJsonUpdate.ts +53 -0
- package/src/generators/add-fullstack/updates/licenseUpdate.ts +23 -0
- package/src/generators/add-fullstack/updates/packageJsonUpdate.ts +45 -4
- package/src/generators/add-moleculer/files/charts/chart/Chart.yaml +1 -1
- package/src/generators/add-moleculer/files/package.json +5 -5
- package/src/generators/add-moleculer/generator.spec.ts +1 -1
- package/src/generators/add-moleculer/generator.ts +8 -3
- package/src/generators/add-moleculer/schema.d.ts +2 -1
- package/src/generators/add-moleculer/schema.json +9 -4
- package/src/generators/{add-core-package → add-package}/generator.spec.ts +5 -5
- package/src/generators/add-package/generator.ts +62 -0
- package/src/generators/add-package/schema.d.ts +6 -0
- package/src/generators/add-package/schema.json +29 -0
- package/src/index.ts +1 -4
- package/src/utils/filesConfig.ts +84 -0
- package/src/utils/index.ts +31 -0
- package/src/utils/syncConfig.ts +128 -0
- package/lib/constants/index.cjs.map +0 -1
- package/lib/constants/index.mjs.map +0 -1
- package/lib/generators/add-browser-package/files/jest.config.js +0 -8
- package/lib/generators/add-browser-package/files/package.json +0 -49
- package/lib/generators/add-browser-package/files/rollup.config.mjs +0 -29
- package/lib/generators/add-browser-package/files/src/index.ts.template +0 -4
- package/lib/generators/add-browser-package/files/src/interfaces/index.ts.template +0 -1
- package/lib/generators/add-browser-package/files/src/interfaces/interfaces.ts.template +0 -1
- package/lib/generators/add-browser-package/files/src/module.tsx.template +0 -7
- package/lib/generators/add-browser-package/files/tsconfig.json +0 -28
- package/lib/generators/add-browser-package/files/webpack.config.js +0 -71
- package/lib/generators/add-browser-package/generator.cjs +0 -17
- package/lib/generators/add-browser-package/generator.cjs.map +0 -1
- package/lib/generators/add-browser-package/generator.d.ts +0 -5
- package/lib/generators/add-browser-package/generator.mjs +0 -17
- package/lib/generators/add-browser-package/generator.mjs.map +0 -1
- package/lib/generators/add-browser-package/schema.json +0 -19
- package/lib/generators/add-client-package/files/CHANGELOG.md +0 -807
- package/lib/generators/add-client-package/files/jest.config.js +0 -13
- package/lib/generators/add-client-package/files/package.json +0 -30
- package/lib/generators/add-client-package/files/rollup.config.mjs +0 -29
- package/lib/generators/add-client-package/files/src/components/index.tsx.template +0 -1
- package/lib/generators/add-client-package/files/src/index.ts.template +0 -1
- package/lib/generators/add-client-package/files/tsconfig.json +0 -27
- package/lib/generators/add-client-package/files/webpack.config.js +0 -72
- package/lib/generators/add-client-package/generator.cjs +0 -17
- package/lib/generators/add-client-package/generator.cjs.map +0 -1
- package/lib/generators/add-client-package/generator.d.ts +0 -5
- package/lib/generators/add-client-package/generator.mjs +0 -17
- package/lib/generators/add-client-package/generator.mjs.map +0 -1
- package/lib/generators/add-client-package/generator.spec.d.ts +0 -1
- package/lib/generators/add-client-package/schema.json +0 -19
- package/lib/generators/add-core-package/files/jest.config.js +0 -3
- package/lib/generators/add-core-package/files/package.json +0 -30
- package/lib/generators/add-core-package/files/rollup.config.mjs +0 -65
- package/lib/generators/add-core-package/files/src/constants/index.ts.template +0 -1
- package/lib/generators/add-core-package/files/src/constants/types.ts.template +0 -3
- package/lib/generators/add-core-package/files/src/index.ts.template +0 -2
- package/lib/generators/add-core-package/files/src/types/index.ts.template +0 -1
- package/lib/generators/add-core-package/files/src/types/types.ts.template +0 -17
- package/lib/generators/add-core-package/files/tsconfig.json +0 -22
- package/lib/generators/add-core-package/files/webpack.config.js +0 -53
- package/lib/generators/add-core-package/generator.cjs +0 -17
- package/lib/generators/add-core-package/generator.cjs.map +0 -1
- package/lib/generators/add-core-package/generator.d.ts +0 -5
- package/lib/generators/add-core-package/generator.mjs +0 -17
- package/lib/generators/add-core-package/generator.mjs.map +0 -1
- package/lib/generators/add-core-package/generator.spec.d.ts +0 -1
- package/lib/generators/add-core-package/schema.json +0 -19
- package/lib/generators/add-fullstack/files/CHANGELOG.md +0 -20
- package/lib/generators/add-server-package/files/CHANGELOG.md +0 -2599
- package/lib/generators/add-server-package/files/LICENSE +0 -674
- package/lib/generators/add-server-package/files/jest.config.js +0 -32
- package/lib/generators/add-server-package/files/package.json +0 -78
- package/lib/generators/add-server-package/files/rollup.config.mjs +0 -30
- package/lib/generators/add-server-package/files/src/constants/constants.ts.template +0 -62
- package/lib/generators/add-server-package/files/src/constants/index.ts.template +0 -1
- package/lib/generators/add-server-package/files/src/constants/types.ts.template +0 -21
- package/lib/generators/add-server-package/files/src/index.ts.template +0 -6
- package/lib/generators/add-server-package/files/src/module.ts.template +0 -6
- package/lib/generators/add-server-package/files/tsconfig.json +0 -27
- package/lib/generators/add-server-package/generator.cjs +0 -17
- package/lib/generators/add-server-package/generator.cjs.map +0 -1
- package/lib/generators/add-server-package/generator.d.ts +0 -5
- package/lib/generators/add-server-package/generator.mjs +0 -17
- package/lib/generators/add-server-package/generator.mjs.map +0 -1
- package/lib/generators/add-server-package/generator.spec.d.ts +0 -1
- package/lib/generators/add-server-package/schema.json +0 -19
- package/src/generators/add-browser-package/generator.spec.ts +0 -20
- package/src/generators/add-browser-package/generator.ts +0 -24
- package/src/generators/add-browser-package/schema.d.ts +0 -4
- package/src/generators/add-browser-package/schema.json +0 -19
- package/src/generators/add-client-package/generator.spec.ts +0 -20
- package/src/generators/add-client-package/generator.ts +0 -24
- package/src/generators/add-client-package/schema.d.ts +0 -4
- package/src/generators/add-client-package/schema.json +0 -19
- package/src/generators/add-core-package/generator.ts +0 -24
- package/src/generators/add-core-package/schema.d.ts +0 -4
- package/src/generators/add-core-package/schema.json +0 -19
- package/src/generators/add-fullstack/files/CHANGELOG.md +0 -28
- package/src/generators/add-server-package/generator.spec.ts +0 -20
- package/src/generators/add-server-package/generator.ts +0 -24
- package/src/generators/add-server-package/schema.d.ts +0 -4
- package/src/generators/add-server-package/schema.json +0 -19
- /package/lib/{constants/index.d.ts → common/constants.d.ts} +0 -0
- /package/lib/generators/{add-browser-package/files/LICENSE → add-fullstack/files/LICENSE-GNU} +0 -0
- /package/lib/generators/{add-core-package/files/LICENSE → add-fullstack/files/LICENSE-IST} +0 -0
- /package/lib/generators/add-fullstack/files/{LICENSE → LICENSE-MIT} +0 -0
- /package/lib/generators/{add-browser-package → add-package}/generator.spec.d.ts +0 -0
- /package/src/{constants/index.ts → common/constants.ts} +0 -0
- /package/{lib/generators/add-client-package/files/LICENSE → src/generators/add-fullstack/files/LICENSE-GNU} +0 -0
- /package/src/generators/add-fullstack/files/{LICENSE → LICENSE-MIT} +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {__awaiter}from'tslib';import {generateFiles,updateJson,formatFiles}from'@nx/devkit';import*as path from'path';import {deepMerge}from'@common-stack/rollup-vite-utils/lib/utils/setupConfig.cjs';import {isValid,getValid}from'../../utils/index.mjs';import {FRAMEWORK_ANTUI,FRAMEWORK_CHAKRAUI,FRAMEWORK_TAILWINDUI}from'../../constants
|
|
1
|
+
import {__awaiter}from'tslib';import {generateFiles,updateJson,formatFiles}from'@nx/devkit';import*as path from'path';import {deepMerge}from'@common-stack/rollup-vite-utils/lib/utils/setupConfig.cjs';import {isValid,getValid}from'../../utils/index.mjs';import {FRAMEWORK_ANTUI,FRAMEWORK_CHAKRAUI,FRAMEWORK_TAILWINDUI}from'../../common/constants.mjs';const DEFAULT_FRAMEWORK = FRAMEWORK_ANTUI;
|
|
2
|
+
const DEFAULT_SERVER_NAME = 'frontend-server';
|
|
2
3
|
function addFrontendGenerator(tree, options) {
|
|
3
4
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4
|
-
const projectName = isValid(options.
|
|
5
|
+
const projectName = isValid(options.name) ? `frontend-${getValid(options.name)}-server` : DEFAULT_SERVER_NAME;
|
|
5
6
|
const configs = Object.assign(Object.assign({}, options), { name: projectName });
|
|
6
7
|
return yield generateFrontend(tree, configs);
|
|
7
8
|
});
|
|
8
9
|
}
|
|
9
10
|
const generateFrontend = (tree, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10
11
|
var _a, _b;
|
|
11
|
-
|
|
12
|
+
let projectName = (_a = getValid(options.name)) !== null && _a !== void 0 ? _a : DEFAULT_SERVER_NAME;
|
|
12
13
|
const projectRoot = isValid(options.directory) ? `${getValid(options.directory)}/${projectName}` : projectName;
|
|
14
|
+
projectName = isValid(options.ns) ? `${getValid(options.ns)}-${projectName}` : projectName;
|
|
13
15
|
const projectSrc = `${projectRoot}/src`;
|
|
14
16
|
const framework = (_b = getValid(options.framework)) !== null && _b !== void 0 ? _b : DEFAULT_FRAMEWORK;
|
|
15
17
|
console.log('UI framework specified: ', framework);
|
|
@@ -26,16 +28,18 @@ const generateFrontend = (tree, options) => __awaiter(void 0, void 0, void 0, fu
|
|
|
26
28
|
packageJson['name'] = projectName;
|
|
27
29
|
if (framework === FRAMEWORK_ANTUI) {
|
|
28
30
|
packageJson['dependencies']["@admin-layout/ant-design-pro"] = "latest";
|
|
29
|
-
packageJson['dependencies']["@adminide-stack/user-auth0-browser-ant"] = "latest";
|
|
30
|
-
packageJson['dependencies']["@ant-design/pro-layout"] = "^7.6.1";
|
|
31
31
|
packageJson['dependencies']["@ant-design/static-style-extract"] = "^1.0.2";
|
|
32
|
+
packageJson['dependencies']["@emotion/react"] = "^11.10.0";
|
|
33
|
+
packageJson['dependencies']["@emotion/server"] = "^11.10.0";
|
|
34
|
+
packageJson['dependencies']["@emotion/css"] = "^11.10.0";
|
|
35
|
+
packageJson['dependencies']["@emotion/styled"] = "^11.10.4";
|
|
32
36
|
packageJson['dependencies']["antd"] = "^5.14.0";
|
|
33
37
|
}
|
|
34
38
|
else if (framework === FRAMEWORK_CHAKRAUI) {
|
|
35
|
-
packageJson['dependencies']["@admin-layout/chakra-design-pro"] = "latest";
|
|
36
|
-
packageJson['dependencies']["@admin-layout/chakra-ui"] = "latest";
|
|
37
|
-
packageJson['dependencies']["@adminide-stack/user-auth0-browser-chakra"] = "latest";
|
|
38
39
|
packageJson['dependencies']["@chakra-ui/react"] = "^2.8.2";
|
|
40
|
+
packageJson['dependencies']["framer-motion"] = "^11.5.4";
|
|
41
|
+
packageJson['dependencies']["@emotion/react"] = "^11.10.0";
|
|
42
|
+
packageJson['dependencies']["@emotion/server"] = "^11.10.0";
|
|
39
43
|
packageJson['dependencies']["@emotion/css"] = "^11.10.0";
|
|
40
44
|
packageJson['dependencies']["@emotion/styled"] = "^11.10.4";
|
|
41
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.mjs","sources":["../../../src/generators/add-frontend/generator.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.mjs","sources":["../../../src/generators/add-frontend/generator.ts"],"sourcesContent":[null],"names":[],"mappings":"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"}
|
|
@@ -7,18 +7,23 @@
|
|
|
7
7
|
"ns": {
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "The project namespace",
|
|
10
|
-
"x-prompt": "What
|
|
10
|
+
"x-prompt": "What namespace would you like to use?"
|
|
11
11
|
},
|
|
12
12
|
"directory": {
|
|
13
13
|
"type": "string",
|
|
14
14
|
"description": "",
|
|
15
15
|
"x-prompt": "What directory would you like to create in?"
|
|
16
16
|
},
|
|
17
|
+
"name": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The module name(optional)",
|
|
20
|
+
"x-prompt": "What name would you like to use for this frontend server module?(optional)"
|
|
21
|
+
},
|
|
17
22
|
"framework": {
|
|
18
23
|
"type": "string",
|
|
19
24
|
"description": "",
|
|
20
|
-
"x-prompt": "What UI framework would you like to use in [antui, chakraui, tailwindui]?"
|
|
25
|
+
"x-prompt": "What UI framework would you like to use in [antui, chakraui, tailwindui]?(default: antui)"
|
|
21
26
|
}
|
|
22
27
|
},
|
|
23
|
-
"required": ["ns", "directory"
|
|
28
|
+
"required": ["ns", "directory"]
|
|
24
29
|
}
|
|
@@ -1,50 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
"appPath": "app",
|
|
4
|
-
"frontendStackPath": "frontend-stack-react"
|
|
5
|
-
},
|
|
6
|
-
"copyOperations": [
|
|
7
|
-
{
|
|
8
|
-
"packageName": "@common-stack/frontend-stack-react",
|
|
9
|
-
"destPath": "$.commonPaths.frontendStackPath",
|
|
10
|
-
"generateModule": true
|
|
11
|
-
}
|
|
12
|
-
],
|
|
13
|
-
"i18n": {
|
|
14
|
-
"enabled": true,
|
|
15
|
-
"fallbackLng": "en",
|
|
16
|
-
"supportedLngs": [
|
|
17
|
-
"en",
|
|
18
|
-
"de",
|
|
19
|
-
"es"
|
|
20
|
-
],
|
|
21
|
-
"defaultNS": "common",
|
|
22
|
-
"react": {
|
|
23
|
-
"useSuspense": false
|
|
24
|
-
},
|
|
25
|
-
"backend": {
|
|
26
|
-
"loadPath": "/cdm-locales/{{lng}}/{{ns}}.json",
|
|
27
|
-
"loadServerPath": "./public/cdm-locales/{{lng}}/{{ns}}.json"
|
|
28
|
-
},
|
|
29
|
-
"packages": [
|
|
30
|
-
]
|
|
31
|
-
},
|
|
2
|
+
|
|
32
3
|
"modules": [
|
|
33
|
-
]
|
|
34
|
-
"buildConfig": {
|
|
35
|
-
"__CLIENT__": false,
|
|
36
|
-
"__SERVER__": true,
|
|
37
|
-
"__DEV__": false,
|
|
38
|
-
"__TEST__": false,
|
|
39
|
-
"__CDN_URL__": "",
|
|
40
|
-
"__GRAPHQL_URL__": "http://localhost:8080/graphql",
|
|
41
|
-
"__DEBUGGING__": false,
|
|
42
|
-
"__SSR__": true,
|
|
43
|
-
"__API_URL__": "/graphql",
|
|
44
|
-
"__FRONTEND_BUILD_DIR__": "./dist/client",
|
|
45
|
-
"__WEB_DEV_SERVER_PORT__": 3000,
|
|
46
|
-
"__GRAPHQL_ENDPOINT__": "/graphql",
|
|
47
|
-
"__LOCAL_SERVER_HOST__": "localhost",
|
|
48
|
-
"__BACKEND_URL__": "http://localhost:3000"
|
|
49
|
-
}
|
|
4
|
+
]
|
|
50
5
|
}
|
|
@@ -52,9 +52,7 @@
|
|
|
52
52
|
"watch:test": "cross-env ENV_FILE=../../config/test/test.env node ./server.js"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@emotion/server": "^11.10.0",
|
|
57
|
-
"@common-stack/frontend-stack-react": "6.0.6-alpha.6",
|
|
55
|
+
"@common-stack/frontend-stack-react": "6.0.6-alpha.73",
|
|
58
56
|
"@react-icons/all-files": "^4.1.0",
|
|
59
57
|
"classnames": "^2.2.6",
|
|
60
58
|
"compression": "^1.7.4",
|
|
@@ -82,10 +80,9 @@
|
|
|
82
80
|
},
|
|
83
81
|
"devDependencies": {
|
|
84
82
|
"@cdmbase/vite-plugin-i18next-loader": "^2.0.12",
|
|
85
|
-
"@common-stack/
|
|
86
|
-
"@
|
|
87
|
-
"@remix-run/
|
|
88
|
-
"@remix-run/serve": "^2.8.1",
|
|
83
|
+
"@common-stack/rollup-vite-utils": "6.0.6-alpha.80",
|
|
84
|
+
"@remix-run/dev": "~2.10.1",
|
|
85
|
+
"@remix-run/serve": "~2.10.1",
|
|
89
86
|
"cross-env": "^7.0.3",
|
|
90
87
|
"dotenv-esm": "^16.0.3-4",
|
|
91
88
|
"pm2": "^5.2.2",
|
|
@@ -93,7 +90,7 @@
|
|
|
93
90
|
"rimraf": "^3.0.2",
|
|
94
91
|
"tsx": "^4.7.0",
|
|
95
92
|
"typescript": "^5.4.5",
|
|
96
|
-
"uuid": "^
|
|
93
|
+
"uuid": "^10.0.0",
|
|
97
94
|
"vite": "^5.1.0",
|
|
98
95
|
"vite-plugin-cjs-interop": "^2.1.1",
|
|
99
96
|
"vite-tsconfig-paths": "^4.2.1"
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import glob from'glob';
|
|
4
|
+
|
|
5
|
+
// Regex to find `use<QueryName>Query` calls, capturing query name and arguments
|
|
6
|
+
const queryPattern = /use([A-Za-z0-9]+Query)\(([^)]*)\)/g;
|
|
7
|
+
const fileExtensions = ['.js', '.ts', '.jsx', '.tsx'];
|
|
8
|
+
const excludeFiles = ['react-hooks', 'generated'];
|
|
9
|
+
const basePath = process.cwd();
|
|
10
|
+
|
|
11
|
+
const findPackageJsonFiles = () => {
|
|
12
|
+
const monorepoRoot = path.join(basePath, '..', '..');
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
glob(
|
|
15
|
+
`${monorepoRoot}/+(servers|portable-devices|packages|packages-modules)/**/package.json`,
|
|
16
|
+
{ nodir: true, ignore: '**/node_modules/**' },
|
|
17
|
+
(err, files) => {
|
|
18
|
+
if (err) reject(`Unable to scan directory: ${err}`);
|
|
19
|
+
resolve(files);
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Function to transform componentPath from `lib` to `src` path and handle package names
|
|
26
|
+
const transformComponentPath = (componentPath, packageName) => {
|
|
27
|
+
return componentPath
|
|
28
|
+
.replace('/lib/', '/src/')
|
|
29
|
+
.replace(packageName + '/', '')
|
|
30
|
+
.replace('.js', '');
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Normalize file paths for consistent comparison (remove extensions and resolve absolute paths)
|
|
34
|
+
const normalizePath = (filePath) => {
|
|
35
|
+
const resolvedPath = path.resolve(filePath).replace(/\.[jt]sx?$/, ''); // Remove .js, .ts, .jsx, .tsx extensions
|
|
36
|
+
return resolvedPath;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Function to extract component paths and queries from routes.json
|
|
40
|
+
async function extractComponentPathsAndQueries(routesFile, packageName) {
|
|
41
|
+
let componentQueries = {};
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const content = await fs.promises.readFile(routesFile, 'utf-8');
|
|
45
|
+
const routes = JSON.parse(content);
|
|
46
|
+
|
|
47
|
+
// Traverse routes to extract componentPath and queries
|
|
48
|
+
routes.forEach(routeObj => {
|
|
49
|
+
Object.keys(routeObj).forEach(routeKey => {
|
|
50
|
+
const route = routeObj[routeKey];
|
|
51
|
+
if (route.hasComponent && route.componentPath) {
|
|
52
|
+
const transformedPath = normalizePath(transformComponentPath(route.componentPath, packageName));
|
|
53
|
+
const queries = Object.keys(route.queries || {});
|
|
54
|
+
if (queries.length > 0) {
|
|
55
|
+
componentQueries[transformedPath] = queries;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
console.log('Extracted components and queries from routes.json:', componentQueries);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
console.error(`Error reading routes.json file: ${routesFile}`, err);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return componentQueries;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Function to recursively search for useQuery in files and validate if the file is a data component
|
|
70
|
+
async function checkFiles(dir, componentQueries) {
|
|
71
|
+
const files = await fs.promises.readdir(dir, { withFileTypes: true });
|
|
72
|
+
|
|
73
|
+
for (const file of files) {
|
|
74
|
+
const fullPath = path.join(dir, file.name);
|
|
75
|
+
|
|
76
|
+
if (file.isDirectory()) {
|
|
77
|
+
// Recurse into subdirectories
|
|
78
|
+
await checkFiles(fullPath, componentQueries);
|
|
79
|
+
} else if (fileExtensions.includes(path.extname(file.name)) && !excludeFiles.includes(path.parse(file.name).name)) {
|
|
80
|
+
await checkForInvalidQueryUsage(fullPath, componentQueries);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Function to extract query details from a match
|
|
86
|
+
const extractQueryDetails = (queryMatch) => {
|
|
87
|
+
const [fullMatch, queryName, queryArgs] = queryMatch;
|
|
88
|
+
return {
|
|
89
|
+
queryName,
|
|
90
|
+
fullMatch,
|
|
91
|
+
queryArgs: queryArgs.trim(),
|
|
92
|
+
isLazyQuery: queryName.endsWith('LazyQuery'),
|
|
93
|
+
hasCacheOnlyFetchPolicy: queryArgs.includes("fetchPolicy: 'cache-only'"),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Function to check for query usage in a file and validate if it is allowed
|
|
98
|
+
async function checkForInvalidQueryUsage(filePath, componentQueries) {
|
|
99
|
+
try {
|
|
100
|
+
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
101
|
+
let match;
|
|
102
|
+
const usedQueries = [];
|
|
103
|
+
const queriesMissingCacheOnly = [];
|
|
104
|
+
const queriesWithNoArguments = [];
|
|
105
|
+
const queryNames = [];
|
|
106
|
+
|
|
107
|
+
while ((match = queryPattern.exec(content)) !== null) {
|
|
108
|
+
const queryDetails = extractQueryDetails(match);
|
|
109
|
+
usedQueries.push(queryDetails);
|
|
110
|
+
queryNames.push(queryDetails.queryName);
|
|
111
|
+
|
|
112
|
+
// Ignore LazyQuery for fetchPolicy check
|
|
113
|
+
if (!queryDetails.isLazyQuery && !queryDetails.hasCacheOnlyFetchPolicy) {
|
|
114
|
+
queriesMissingCacheOnly.push(queryDetails.queryName);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Check for queries without arguments
|
|
118
|
+
if (queryDetails.queryArgs === '') {
|
|
119
|
+
queriesWithNoArguments.push(queryDetails.queryName);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (usedQueries.length > 0) {
|
|
124
|
+
const normalizedFilePath = normalizePath(filePath);
|
|
125
|
+
const isDataComponent = componentQueries[normalizedFilePath];
|
|
126
|
+
|
|
127
|
+
const warnings = [];
|
|
128
|
+
|
|
129
|
+
// Warning if a data component has more than 3 queries
|
|
130
|
+
if (isDataComponent && usedQueries.length > 3) {
|
|
131
|
+
warnings.push(`Warning: Data component "${filePath}" has more than 3 queries. Consider splitting into multiple data components with a layout component as the parent.`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Consolidate missing cache-only fetchPolicy warnings
|
|
135
|
+
if (queriesMissingCacheOnly.length > 0) {
|
|
136
|
+
warnings.push(`Warning: The following queries are missing fetchPolicy: "cache-only":\n - ${queriesMissingCacheOnly.join('\n - ')}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Warn for queries without arguments (which could fetch all data)
|
|
140
|
+
if (queriesWithNoArguments.length > 0) {
|
|
141
|
+
warnings.push(`Warning: The following queries have no arguments and could fetch all data. Consider narrowing the search and using pagination:\n - ${queriesWithNoArguments.join('\n - ')}`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Warning for non-data components with queries
|
|
145
|
+
if (!isDataComponent) {
|
|
146
|
+
warnings.push(`Warning: File "${filePath}" is a non-data component (not listed in routes.json) but is using queries.`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Display queries first, then display all warnings together
|
|
150
|
+
if (warnings.length > 0) {
|
|
151
|
+
console.log('----------------------------------------------------');
|
|
152
|
+
console.log(`File: ${filePath}`);
|
|
153
|
+
console.log('Queries:');
|
|
154
|
+
usedQueries.forEach(query => console.log(` - ${query.fullMatch}`)); // Display full query details
|
|
155
|
+
console.log('\nWarnings:');
|
|
156
|
+
warnings.forEach(warning => console.log(` - ${warning}`));
|
|
157
|
+
console.log('----------------------------------------------------\n');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.error(`Error reading file: ${filePath}`, err);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Check in a single package
|
|
166
|
+
async function checkPackage(packageDir, packageName) {
|
|
167
|
+
const routesFile = path.resolve(path.join(packageDir, './lib/routes.json'));
|
|
168
|
+
const sourceDir = path.resolve(path.join(packageDir, './src'));
|
|
169
|
+
let componentQueries = {};
|
|
170
|
+
|
|
171
|
+
if (fs.existsSync(routesFile)) {
|
|
172
|
+
console.log(`Extracting component paths and queries from ${routesFile}...`);
|
|
173
|
+
componentQueries = await extractComponentPathsAndQueries(routesFile, packageName);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
console.log(`Searching for query usage in files under ${sourceDir}...`);
|
|
177
|
+
await checkFiles(sourceDir, componentQueries);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Run the script
|
|
181
|
+
(async () => {
|
|
182
|
+
console.log('Checking useQuery usage ...');
|
|
183
|
+
|
|
184
|
+
const packageJsonFiles = await findPackageJsonFiles();
|
|
185
|
+
for (const file of packageJsonFiles) {
|
|
186
|
+
const packageJson = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
187
|
+
const packageDir = path.dirname(file);
|
|
188
|
+
await checkPackage(packageDir, packageJson.name);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
console.log('Completed checking useQuery usage.');
|
|
192
|
+
})();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { setupConfig } from '@common-stack/rollup-vite-utils/lib/utils/setupConfig.js';
|
|
4
|
-
import
|
|
4
|
+
import { updateFromConfig } from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginUpdateFromConfig.js';
|
|
5
|
+
const projectConfigPath = path.resolve('./config.json');
|
|
5
6
|
|
|
6
7
|
// Function to merge configurations
|
|
7
|
-
const mergeConfigs = setupConfig(
|
|
8
|
+
const mergeConfigs = setupConfig(projectConfigPath);
|
|
8
9
|
|
|
9
10
|
// Ensure the 'app' directory exists
|
|
10
11
|
const appDir = path.resolve('app');
|
|
@@ -32,3 +33,5 @@ if (!gitignoreContent.includes('app')) {
|
|
|
32
33
|
fs.appendFileSync(gitignorePath, '\napp\n');
|
|
33
34
|
console.log('Added "app" to .gitignore');
|
|
34
35
|
}
|
|
36
|
+
|
|
37
|
+
updateFromConfig(finalConfigPath);
|
|
@@ -14,24 +14,62 @@ import config from './app/cde-webconfig.json' assert { type: 'json' };
|
|
|
14
14
|
|
|
15
15
|
// This installs globals such as "fetch", "Response", "Request" and "Headers".
|
|
16
16
|
installGlobals();
|
|
17
|
+
|
|
17
18
|
const directoryName = dirname(fileURLToPath(import.meta.url));
|
|
18
19
|
|
|
19
|
-
export default defineConfig(({ isSsrBuild }) => {
|
|
20
|
-
console.log('---IS SSR BUILD', isSsrBuild);
|
|
20
|
+
export default defineConfig(async ({ isSsrBuild }) => {
|
|
21
|
+
console.log('--- IS SSR BUILD:', isSsrBuild);
|
|
21
22
|
|
|
23
|
+
// Load environment variables from dotenv or other config
|
|
22
24
|
const dotEnvResult = loadEnvConfig(directoryName);
|
|
23
25
|
|
|
26
|
+
// Define environment variables for Vite
|
|
27
|
+
const envVariables = {
|
|
28
|
+
__ENV__: JSON.stringify(dotEnvResult?.parsed),
|
|
29
|
+
__SERVER__: true,
|
|
30
|
+
__CLIENT__: false,
|
|
31
|
+
...Object.fromEntries(
|
|
32
|
+
Object.entries(config.buildConfig).map(([key, value]) => [
|
|
33
|
+
key,
|
|
34
|
+
typeof value === 'string' ? `"${value.replace(/\\/g, '\\\\')}"` : value,
|
|
35
|
+
])
|
|
36
|
+
),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Define routes configuration
|
|
40
|
+
const routesConfig = async (defineRoutes) => {
|
|
41
|
+
// In production, perform required file copy operations
|
|
42
|
+
if (process.env.NODE_ENV === 'production') {
|
|
43
|
+
await performCopyOperations(config);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Load metadata for routes
|
|
47
|
+
let metaJson = null;
|
|
48
|
+
try {
|
|
49
|
+
metaJson = await import('./app/sync-meta.json');
|
|
50
|
+
} catch {
|
|
51
|
+
console.warn('No sync-meta.json found, continuing without metadata.');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Return routes definition
|
|
55
|
+
return defineRoutes((routeFn) =>
|
|
56
|
+
defineRoutesConfig(
|
|
57
|
+
routeFn,
|
|
58
|
+
{
|
|
59
|
+
routesFileName: 'routes.json',
|
|
60
|
+
packages: config.modules,
|
|
61
|
+
paths: config.paths,
|
|
62
|
+
iconsRepository: config?.iconsRepository,
|
|
63
|
+
rootPath: resolve(directoryName, '../..'),
|
|
64
|
+
},
|
|
65
|
+
metaJson
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Vite configuration
|
|
24
71
|
const viteConfig = {
|
|
25
|
-
define:
|
|
26
|
-
__ENV__: JSON.stringify(dotEnvResult?.parsed),
|
|
27
|
-
...Object.assign(
|
|
28
|
-
...Object.entries(config.buildConfig).map(([k, v]) => ({
|
|
29
|
-
[k]: typeof v !== 'string' ? v : `"${v.replace(/\\/g, '\\\\')}"`,
|
|
30
|
-
__SERVER__: true,
|
|
31
|
-
__CLIENT__: false,
|
|
32
|
-
}))
|
|
33
|
-
),
|
|
34
|
-
},
|
|
72
|
+
define: envVariables,
|
|
35
73
|
plugins: [
|
|
36
74
|
i18nInternationalizationPlugin({
|
|
37
75
|
folderName: 'cdm-locales',
|
|
@@ -43,31 +81,14 @@ export default defineConfig(({ isSsrBuild }) => {
|
|
|
43
81
|
}),
|
|
44
82
|
remix({
|
|
45
83
|
appDirectory: 'src',
|
|
46
|
-
routes:
|
|
47
|
-
if (process.env.NODE_ENV === 'production') {
|
|
48
|
-
await performCopyOperations(config);
|
|
49
|
-
}
|
|
50
|
-
const metaJson = await import('./app/sync-meta.json').catch(() => null);
|
|
51
|
-
return defineRoutes((routeFn) => {
|
|
52
|
-
defineRoutesConfig(
|
|
53
|
-
routeFn,
|
|
54
|
-
{
|
|
55
|
-
routesFileName: 'routes.json',
|
|
56
|
-
packages: config.modules,
|
|
57
|
-
paths: config.paths,
|
|
58
|
-
rootPath: resolve(directoryName, '../..'),
|
|
59
|
-
},
|
|
60
|
-
metaJson,
|
|
61
|
-
);
|
|
62
|
-
});
|
|
63
|
-
},
|
|
84
|
+
routes: routesConfig,
|
|
64
85
|
}),
|
|
65
86
|
tsconfigPaths({ ignoreConfigErrors: true }),
|
|
66
87
|
],
|
|
67
88
|
resolve: {
|
|
68
89
|
alias: {
|
|
69
|
-
'@app': resolve(
|
|
70
|
-
'@src': resolve(
|
|
90
|
+
'@app': resolve(directoryName, 'app'),
|
|
91
|
+
'@src': resolve(directoryName, 'src'),
|
|
71
92
|
},
|
|
72
93
|
},
|
|
73
94
|
};
|
|
@@ -13,23 +13,23 @@ pipeline {
|
|
|
13
13
|
string(name: 'CONNECTION_ID', defaultValue: 'test', description: 'connection id', trim: true)
|
|
14
14
|
string(name: 'WORKSPACE_ID', defaultValue: 'fullstack-pro', description: 'workspace id', trim: true)
|
|
15
15
|
string(name: 'UNIQUE_NAME', defaultValue: 'default', description: 'chart name', trim: true)
|
|
16
|
-
string(name: 'VERSION', defaultValue: '
|
|
16
|
+
string(name: 'VERSION', defaultValue: 'v1', description: 'version of the deployment', trim: true)
|
|
17
17
|
string(name: 'HEMERA_LOG_LEVEL', defaultValue: 'info', description: 'log level for hemera')
|
|
18
18
|
string(name: 'LOG_LEVEL', defaultValue: 'info', description: 'log level')
|
|
19
19
|
string(name: 'DEPLOYMENT_PATH', defaultValue: '/servers', description: 'folder path to load helm charts')
|
|
20
|
-
string(name: 'PUBLISH_BRANCH', defaultValue: '
|
|
20
|
+
string(name: 'PUBLISH_BRANCH', defaultValue: 'devpublish', description: 'the publish branch for packages release')
|
|
21
21
|
string(name: 'EXCLUDE_SETTING_NAMESPACE_FILTER', defaultValue: 'brigade', description: 'exclude setting namespace that matches search string')
|
|
22
22
|
string(name: 'GIT_CREDENTIAL_ID', defaultValue: 'fullstack-pro-github-deploy-key', description: 'jenkins credential id of git deploy secret')
|
|
23
23
|
string(name: 'BUILD_MODULE_TO_INCLUDE', defaultValue: '@sample-stack*', description: 'build env')
|
|
24
24
|
string(name: 'REPOSITORY_SSH_URL', defaultValue: 'git@github.com:CDEBase/fullstack-pro.git', description: 'ssh url of the git repository')
|
|
25
|
-
string(name: 'REPOSITORY_BRANCH', defaultValue: '
|
|
26
|
-
string(name: 'DEVELOP_BRANCH', defaultValue: '
|
|
25
|
+
string(name: 'REPOSITORY_BRANCH', defaultValue: 'develop', description: 'the branch with changes')
|
|
26
|
+
string(name: 'DEVELOP_BRANCH', defaultValue: 'develop', description: 'the branch for the development')
|
|
27
27
|
string(name: 'MASTER_BRANCH', defaultValue: 'master', description: 'Master branch as default branch for production.')
|
|
28
28
|
|
|
29
29
|
// by default first value of the choice will be choosen
|
|
30
30
|
choice choices: ['auto', 'force'], description: 'Choose merge strategy', name: 'NPM_PUBLISH_STRATEGY'
|
|
31
31
|
choice choices: ['yarn', 'npm'], description: 'Choose build strategy', name: 'BUILD_STRATEGY'
|
|
32
|
-
choice choices: ['0.7.
|
|
32
|
+
choice choices: ['0.7.11','0.7.9', '0.6.0'], description: 'Choose Idestack chart version', name: 'IDESTACK_CHART_VERSION'
|
|
33
33
|
choice choices: ['nodejs20', 'nodejs18', 'nodejs22'], description: 'Choose NodeJS version', name: 'NODEJS_TOOL_VERSION'
|
|
34
34
|
choice choices: ['buildOnly', 'buildAndTest', 'buildAndPublish', 'mobileBuild', 'mobilePreview', 'mobilePreviewLocal', 'mobilePreviewSubmit', 'mobileProd', 'mobileProdSubmit', 'devDeployOnly', 'stageDeploy', 'stageDeployOnly', 'prodDeploy', 'prodDeployOnly', 'allenv'], description: 'Where to deploy micro services?', name: 'ENV_CHOICE'
|
|
35
35
|
choice choices: ['all', 'ios', 'android' ], description: 'Mobile type if it is mobile build?', name: 'MOBILE_CHOICE'
|
|
@@ -100,9 +100,9 @@ pipeline {
|
|
|
100
100
|
rm .npmrc
|
|
101
101
|
npx lerna exec --scope=*mobile-device ${params.BUILD_STRATEGY} ${env.BUILD_COMMAND}
|
|
102
102
|
git checkout -- .npmrc
|
|
103
|
+
yarn git:pull
|
|
103
104
|
yarn gitcommit
|
|
104
|
-
git
|
|
105
|
-
git push origin ${params.REPOSITORY_BRANCH}
|
|
105
|
+
yarn git:push
|
|
106
106
|
"""
|
|
107
107
|
}
|
|
108
108
|
}
|