@common-stack/generate-plugin 6.0.6-alpha.2 → 6.0.6-alpha.21
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 +76 -0
- package/README.md +156 -210
- package/cde-config.json +43 -42
- 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 +4 -3
- 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 +18 -14
- package/lib/generators/add-frontend/generator.cjs.map +1 -1
- package/lib/generators/add-frontend/generator.mjs +13 -9
- 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/package.json +4 -5
- package/lib/generators/add-frontend/templates/tools/mergeConfig.js +3 -0
- package/lib/generators/add-fullstack/files/Jenkinsfile +5 -5
- package/lib/generators/add-fullstack/files/package.json +16 -13
- package/lib/generators/add-fullstack/files/tools/html-plugin-template.ejs +28 -0
- 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 +40 -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 +40 -0
- package/lib/generators/add-package/generator.mjs.map +1 -0
- package/lib/generators/{add-client-package → add-package}/schema.json +7 -2
- 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 +14 -9
- 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 +5 -5
- package/src/generators/add-fullstack/files/LICENSE-IST +39 -0
- package/src/generators/add-fullstack/files/package.json +16 -13
- package/src/generators/add-fullstack/files/tools/html-plugin-template.ejs +28 -0
- 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 +54 -0
- package/src/generators/add-package/schema.d.ts +5 -0
- package/{lib/generators/add-server-package → src/generators/add-package}/schema.json +7 -2
- 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-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-fullstack/files/docs/Moleculer.md +0 -10
- package/lib/generators/add-fullstack/files/docs/References.md +0 -13
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Adding_New_Modules.md +0 -84
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Desktop_Setup.md +0 -12
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/DoAndDont.md +0 -35
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/GitHooks.md +0 -3
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/HowToContribute.md +0 -14
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/How_to_Run_Various_Options.md +0 -95
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Known_Issues.md +0 -19
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Lint_And_Formatter.md +0 -9
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Project_Setup.md +0 -159
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Dynamically_Render_Components.md +0 -57
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/HOC_With_Render_Props.md +0 -87
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Mongoose_Connection.md +0 -45
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/React_Componet_Extensions.md +0 -11
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/RxJS_notes.md +0 -3
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Styles_With_Type.md +0 -52
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/Tutorials.md +0 -12
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/faq.md +0 -17
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/installation_issues.md +0 -9
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/lerna-build-tools.md +0 -504
- package/lib/generators/add-fullstack/files/docs/development/CodeContribution/lerna-yarn-workspaces.md +0 -82
- package/lib/generators/add-fullstack/files/docs/development/Database/mongodb-test.md +0 -6
- package/lib/generators/add-fullstack/files/docs/development/Deployment/How_To_Setup_Jenkins.md +0 -60
- package/lib/generators/add-fullstack/files/docs/development/Deployment/JenkinsDeployment.md +0 -16
- package/lib/generators/add-fullstack/files/docs/development/Expo/expo-commands.md +0 -5
- package/lib/generators/add-fullstack/files/docs/development/Mobile/How_To_Make_Expo_Wrok_With_Monorepos.md +0 -9
- package/lib/generators/add-fullstack/files/docs/development/Mobile/React-Native-FAQ.md +0 -4
- package/lib/generators/add-fullstack/files/docs/development/Mobile/Run_mobile.md +0 -9
- 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/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-fullstack/files/docs/Moleculer.md +0 -10
- package/src/generators/add-fullstack/files/docs/References.md +0 -13
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Adding_New_Modules.md +0 -84
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Desktop_Setup.md +0 -12
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/DoAndDont.md +0 -35
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/GitHooks.md +0 -3
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/HowToContribute.md +0 -14
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/How_to_Run_Various_Options.md +0 -95
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Known_Issues.md +0 -19
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Lint_And_Formatter.md +0 -9
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Project_Setup.md +0 -159
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Dynamically_Render_Components.md +0 -57
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/HOC_With_Render_Props.md +0 -87
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Mongoose_Connection.md +0 -45
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/React_Componet_Extensions.md +0 -11
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/RxJS_notes.md +0 -3
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/React-Patterns/Styles_With_Type.md +0 -52
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/Tutorials.md +0 -12
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/faq.md +0 -17
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/installation_issues.md +0 -9
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/lerna-build-tools.md +0 -504
- package/src/generators/add-fullstack/files/docs/development/CodeContribution/lerna-yarn-workspaces.md +0 -82
- package/src/generators/add-fullstack/files/docs/development/Database/mongodb-test.md +0 -6
- package/src/generators/add-fullstack/files/docs/development/Deployment/How_To_Setup_Jenkins.md +0 -60
- package/src/generators/add-fullstack/files/docs/development/Deployment/JenkinsDeployment.md +0 -16
- package/src/generators/add-fullstack/files/docs/development/Expo/expo-commands.md +0 -5
- package/src/generators/add-fullstack/files/docs/development/Mobile/How_To_Make_Expo_Wrok_With_Monorepos.md +0 -9
- package/src/generators/add-fullstack/files/docs/development/Mobile/React-Native-FAQ.md +0 -4
- package/src/generators/add-fullstack/files/docs/development/Mobile/Run_mobile.md +0 -9
- 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
|
@@ -7,12 +7,17 @@
|
|
|
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
|
+
},
|
|
17
|
+
"name": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The module name(optional)",
|
|
20
|
+
"x-prompt": "What name would you like to use for this backend server module?(optional)"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"required": ["ns", "directory"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Links, Meta, Outlet, Scripts, ScrollRestoration,
|
|
3
|
+
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, useRouteError, json } from '@remix-run/react';
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import publicEnv from '@src/config/public-config';
|
|
6
6
|
import { PluginArea } from '@common-stack/client-react';
|
|
@@ -34,7 +34,7 @@ export function shouldRevalidate(params: any) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
37
|
-
const data =
|
|
37
|
+
const data = useRouteLoaderData<{ locale: any }>('root');
|
|
38
38
|
const locale = data?.locale;
|
|
39
39
|
|
|
40
40
|
const { i18n } = useTranslation();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
import { Links, Meta, Outlet, Scripts, ScrollRestoration,
|
|
4
|
+
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData } from '@remix-run/react';
|
|
5
5
|
import { json } from '@remix-run/node';
|
|
6
6
|
import { PluginArea } from '@common-stack/client-react';
|
|
7
7
|
import { subscribeReduxRouter } from '@common-stack/remix-router-redux';
|
|
@@ -79,8 +79,9 @@ export function shouldRevalidate(params: any) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export default function App() {
|
|
82
|
-
|
|
83
|
-
const locale =
|
|
82
|
+
const data = useRouteLoaderData<{ locale: any }>('root');
|
|
83
|
+
const locale = data?.locale;
|
|
84
|
+
|
|
84
85
|
useChangeLanguage(locale);
|
|
85
86
|
|
|
86
87
|
React.useEffect(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Links, Meta, Outlet, Scripts, ScrollRestoration,
|
|
3
|
+
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, useRouteError, json } from '@remix-run/react';
|
|
4
4
|
import type { LinksFunction } from "@remix-run/node";
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import publicEnv from '@src/config/public-config';
|
|
@@ -36,7 +36,7 @@ export function shouldRevalidate(params: any) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
39
|
-
const data =
|
|
39
|
+
const data = useRouteLoaderData<{ locale: any }>('root');
|
|
40
40
|
const locale = data?.locale;
|
|
41
41
|
|
|
42
42
|
const { i18n } = useTranslation();
|
|
@@ -4,20 +4,22 @@ import * as fs from 'node:fs';
|
|
|
4
4
|
import { deepMerge } from '@common-stack/rollup-vite-utils/lib/utils/setupConfig.cjs';
|
|
5
5
|
import { AddFrontendGeneratorSchema } from './schema';
|
|
6
6
|
import { isValid, getValid } from '../../utils';
|
|
7
|
-
import { FRAMEWORK_ANTUI, FRAMEWORK_CHAKRAUI, FRAMEWORK_TAILWINDUI } from '../../constants';
|
|
7
|
+
import { FRAMEWORK_ANTUI, FRAMEWORK_CHAKRAUI, FRAMEWORK_TAILWINDUI } from '../../common/constants';
|
|
8
8
|
|
|
9
9
|
const DEFAULT_FRAMEWORK = FRAMEWORK_ANTUI;
|
|
10
|
+
const DEFAULT_SERVER_NAME = 'frontend-server';
|
|
10
11
|
|
|
11
12
|
export async function addFrontendGenerator(tree: Tree, options: AddFrontendGeneratorSchema) {
|
|
12
|
-
const projectName = isValid(options.
|
|
13
|
+
const projectName = isValid(options.name) ? `frontend-${getValid(options.name)}-server` : DEFAULT_SERVER_NAME;
|
|
13
14
|
const configs: any = {...options, name: projectName};
|
|
14
15
|
|
|
15
16
|
return await generateFrontend(tree, configs);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export const generateFrontend = async (tree: Tree, options: any) => {
|
|
19
|
-
|
|
20
|
+
let projectName = getValid(options.name) ?? DEFAULT_SERVER_NAME;
|
|
20
21
|
const projectRoot = isValid(options.directory) ? `${getValid(options.directory)}/${projectName}` : projectName;
|
|
22
|
+
projectName = isValid(options.ns) ? `${getValid(options.ns)}-${projectName}` : projectName;
|
|
21
23
|
const projectSrc = `${projectRoot}/src`;
|
|
22
24
|
|
|
23
25
|
const framework = getValid(options.framework) ?? DEFAULT_FRAMEWORK;
|
|
@@ -38,17 +40,20 @@ export const generateFrontend = async (tree: Tree, options: any) => {
|
|
|
38
40
|
packageJson['name'] = projectName;
|
|
39
41
|
if (framework === FRAMEWORK_ANTUI) {
|
|
40
42
|
packageJson['dependencies']["@admin-layout/ant-design-pro"] = "latest";
|
|
41
|
-
packageJson['dependencies']["@admin-layout/ant-ui"] = "latest";
|
|
42
|
-
packageJson['dependencies']["@adminide-stack/user-auth0-browser-ant"] = "latest";
|
|
43
|
-
packageJson['dependencies']["@ant-design/pro-layout"] = "^7.6.1";
|
|
44
43
|
packageJson['dependencies']["@ant-design/static-style-extract"] = "^1.0.2";
|
|
44
|
+
packageJson['dependencies']["@emotion/react"] = "^11.10.0";
|
|
45
|
+
packageJson['dependencies']["@emotion/server"] = "^11.10.0";
|
|
46
|
+
packageJson['dependencies']["@emotion/css"] = "^11.10.0";
|
|
47
|
+
packageJson['dependencies']["@emotion/styled"] = "^11.10.4";
|
|
45
48
|
packageJson['dependencies']["antd"] = "^5.14.0";
|
|
46
49
|
} else if (framework === FRAMEWORK_CHAKRAUI) {
|
|
47
|
-
packageJson['dependencies']["@
|
|
48
|
-
packageJson['dependencies']["
|
|
49
|
-
packageJson['dependencies']["@
|
|
50
|
+
packageJson['dependencies']["@chakra-ui/react"] = "^2.8.2";
|
|
51
|
+
packageJson['dependencies']["framer-motion"] = "^11.5.4";
|
|
52
|
+
packageJson['dependencies']["@emotion/react"] = "^11.10.0";
|
|
53
|
+
packageJson['dependencies']["@emotion/server"] = "^11.10.0";
|
|
50
54
|
packageJson['dependencies']["@emotion/css"] = "^11.10.0";
|
|
51
55
|
packageJson['dependencies']["@emotion/styled"] = "^11.10.4";
|
|
56
|
+
|
|
52
57
|
} else if (framework === FRAMEWORK_TAILWINDUI) {
|
|
53
58
|
packageJson['devDependencies']["tailwindcss"] = "^3.4.10";
|
|
54
59
|
packageJson['devDependencies']["postcss"] = "^8.4.41";
|
|
@@ -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
|
}
|
|
@@ -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'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
The CDEBase Enterprise license (the “Enterprise License”)
|
|
2
|
+
Copyright (c) 2018 cdebase LLC.
|
|
3
|
+
|
|
4
|
+
With regard to the CDEBase Software:
|
|
5
|
+
|
|
6
|
+
This software and associated documentation files (the "Software") may only be
|
|
7
|
+
used in production, if you (and any entity that you represent) have agreed to,
|
|
8
|
+
and are in compliance with, the CDEBase Terms of Service, available
|
|
9
|
+
at https://about.cdebase.com/terms (the “Enterprise Terms”), or other
|
|
10
|
+
agreement governing the use of the Software, as agreed by you and CDEBase,
|
|
11
|
+
and otherwise have a valid CDEBase Enterprise subscription for the
|
|
12
|
+
correct number of user seats. Subject to the foregoing sentence, you are free to
|
|
13
|
+
modify this Software and publish patches to the Software. You agree that CDEBase
|
|
14
|
+
and/or its licensors (as applicable) retain all right, title and interest in and
|
|
15
|
+
to all such modifications and/or patches, and all such modifications and/or
|
|
16
|
+
patches may only be used, copied, modified, displayed, distributed, or otherwise
|
|
17
|
+
exploited with a valid CDEBase Enterprise subscription for the correct
|
|
18
|
+
number of user seats. Notwithstanding the foregoing, you may copy and modify
|
|
19
|
+
the Software for development and testing purposes, without requiring a
|
|
20
|
+
subscription. You agree that CDEBase and/or its licensors (as applicable) retain
|
|
21
|
+
all right, title and interest in and to all such modifications. You are not
|
|
22
|
+
granted any other rights beyond what is expressly stated herein. Subject to the
|
|
23
|
+
foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
|
|
24
|
+
and/or sell the Software.
|
|
25
|
+
|
|
26
|
+
The full text of this Enterprise License shall be included in all copies or
|
|
27
|
+
substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
SOFTWARE.
|
|
36
|
+
|
|
37
|
+
For all third party components incorporated into the CDEBase Software, those
|
|
38
|
+
components are licensed under the original license provided by the owner of the
|
|
39
|
+
applicable component.
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"jest": "./node_modules/.bin/jest",
|
|
62
62
|
"lerna": "lerna bootstrap",
|
|
63
63
|
"prelernapublish": "git checkout publish && git pull origin publish && git merge -s recursive -X theirs master -m 'merge from master' && yarn gitcommit && node tools/update-dependency-version.js && yarn gitcommit",
|
|
64
|
-
"lernapublish": "lerna publish --ignore-scripts
|
|
65
|
-
"postlernapublish": "git checkout master",
|
|
66
|
-
"lint": "eslint --ext js --ext ts --ext md",
|
|
64
|
+
"lernapublish": "lerna publish patch --ignore-scripts",
|
|
65
|
+
"postlernapublish": "yarn update-lerna-on-develop && git checkout master",
|
|
66
|
+
"lint": "eslint --ext js --ext ts --ext tsx --ext md",
|
|
67
67
|
"lint:ci": "yarn lint . --format junit",
|
|
68
68
|
"lint:fix": "yarn lint -- --fix",
|
|
69
69
|
"lint:md": "markdownlint",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"publish:force": "yarn publish:forceManual --yes",
|
|
76
76
|
"publish:forceManual": "yarn lernapublish --force-publish=*",
|
|
77
77
|
"publish:push": "yarn prelernapublish && git push origin publish && yarn postlernapublish",
|
|
78
|
+
"push-develop": "git push origin develop",
|
|
78
79
|
"setBranchEnv": "cross-env REPOSITORY_BRANCH=${1:-$REPOSITORY_BRANCH} PUBLISH_BRANCH=${2:-$PUBLISH_BRANCH}",
|
|
79
80
|
"sort-packages": "node tools/sortPackageJson.mjs && prettier --write package.json **/**/*/package.json **/*/package.json",
|
|
80
81
|
"start": "cross-env NODE_ENV=development ENV_FILE=../../config/development/dev.env yarn startWeb",
|
|
@@ -88,7 +89,7 @@
|
|
|
88
89
|
"pretravis": "yarn compile",
|
|
89
90
|
"travis": "istanbul cover -x \"*.test.js\" _mocha -- --timeout 5000 --full-trace ./test/tests.js",
|
|
90
91
|
"posttravis": "yarn lint",
|
|
91
|
-
"update-lerna-on-develop": "git checkout publish && git pull && cp lerna.json ../lerna-temp.json && git checkout develop && mv ../lerna-temp.json lerna.json && git commit -am 'Update lerna.json' &&
|
|
92
|
+
"update-lerna-on-develop": "git checkout publish && git pull origin publish && cp lerna.json ../lerna-temp.json && git checkout develop && mv ../lerna-temp.json lerna.json && git commit -am 'Update lerna.json' && yarn push-develop",
|
|
92
93
|
"watch": "lerna exec --no-sort --ignore *server --ignore *device --ignore *browser-extension --stream --parallel -- webpack --watch",
|
|
93
94
|
"watch-packages": "lerna exec --no-sort --scope @sample-stack/platform* --scope @sample-stack/react-shared-components --scope @sample-stack/core --stream --parallel 'webpack --watch'",
|
|
94
95
|
"zen:build": "cross-env NODE_ENV=production zen build",
|
|
@@ -145,8 +146,8 @@
|
|
|
145
146
|
"@babel/preset-typescript": "^7.18.6",
|
|
146
147
|
"@babel/register": "^7.18.9",
|
|
147
148
|
"@babel/runtime": "^7.20.1",
|
|
148
|
-
"@common-stack/env-list-loader": "
|
|
149
|
-
"@common-stack/generate-plugin": "6.0.6-alpha.
|
|
149
|
+
"@common-stack/env-list-loader": "6.0.6-alpha.5",
|
|
150
|
+
"@common-stack/generate-plugin": "6.0.6-alpha.20",
|
|
150
151
|
"@emotion/babel-plugin": "^11.11.0",
|
|
151
152
|
"@graphql-codegen/add": "^5.0.2",
|
|
152
153
|
"@graphql-codegen/cli": "^5.0.2",
|
|
@@ -165,15 +166,16 @@
|
|
|
165
166
|
"@redux-devtools/core": "^3.13.1",
|
|
166
167
|
"@redux-devtools/dock-monitor": "^3.0.1",
|
|
167
168
|
"@redux-devtools/log-monitor": "^4.0.1",
|
|
168
|
-
"@
|
|
169
|
-
"@
|
|
169
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
170
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
170
171
|
"@rollup/plugin-graphql": "2.0.2",
|
|
171
172
|
"@rollup/plugin-image": "^3.0.1",
|
|
172
|
-
"@rollup/plugin-json": "^
|
|
173
|
-
"@rollup/plugin-
|
|
173
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
174
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
175
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
174
176
|
"@shelf/jest-mongodb": "^4.1.3",
|
|
175
177
|
"@svgr/webpack": "^6.5.1",
|
|
176
|
-
"@testing-library/react": "^
|
|
178
|
+
"@testing-library/react": "^16.0.1",
|
|
177
179
|
"@testing-library/react-hooks": "^8.0.1",
|
|
178
180
|
"@types/async": "^3.2.15",
|
|
179
181
|
"@types/body-parser": "1.19.2",
|
|
@@ -192,7 +194,6 @@
|
|
|
192
194
|
"@types/react": "^18.2.20",
|
|
193
195
|
"@types/react-dom": "^18.2.7",
|
|
194
196
|
"@types/react-helmet": "^6.1.5",
|
|
195
|
-
"@types/react-redux": "^7.1.24",
|
|
196
197
|
"@types/react-test-renderer": "^18.0.0",
|
|
197
198
|
"@types/redux-logger": "^3.0.9",
|
|
198
199
|
"@types/semver": "^7.3.13",
|
|
@@ -204,6 +205,7 @@
|
|
|
204
205
|
"@typescript-eslint/parser": "^6.7.4",
|
|
205
206
|
"@web/rollup-plugin-copy": "^0.5.1",
|
|
206
207
|
"@webpack-cli/serve": "^1.7.0",
|
|
208
|
+
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
207
209
|
"autoprefixer": "^10.4.13",
|
|
208
210
|
"babel-core": "^7.0.0-bridge.0",
|
|
209
211
|
"babel-eslint": "^10.1.0",
|
|
@@ -265,6 +267,7 @@
|
|
|
265
267
|
"jest-dom": "^4.0.0",
|
|
266
268
|
"jest-junit": "^14.0.1",
|
|
267
269
|
"jest-matcher-utils": "^29.2.2",
|
|
270
|
+
"jest-raw-loader": "^1.0.1",
|
|
268
271
|
"jest-transform-graphql": "^2.1.0",
|
|
269
272
|
"jsdom": "^20.0.2",
|
|
270
273
|
"lerna": "8",
|
|
@@ -325,7 +328,7 @@
|
|
|
325
328
|
"ts-node": "^10.9.1",
|
|
326
329
|
"tslib": "^2.4.1",
|
|
327
330
|
"typedoc": "^0.23.20",
|
|
328
|
-
"typescript": "^5.
|
|
331
|
+
"typescript": "^5.5.4",
|
|
329
332
|
"url-loader": "^4.1.1",
|
|
330
333
|
"wait-on": "^6.0.1",
|
|
331
334
|
"webpack": "^5.74.0",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<base href="/">
|
|
6
|
+
<meta charset="utf-8">
|
|
7
|
+
<title>
|
|
8
|
+
<@= htmlWebpackPlugin.options.title @>
|
|
9
|
+
</title>
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div class="demo">
|
|
15
|
+
<div id="root">
|
|
16
|
+
Try building the demo:
|
|
17
|
+
<pre>
|
|
18
|
+
</pre> ...and refreshing this page!
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
<footer class="dark">
|
|
22
|
+
<section class="container copyright">
|
|
23
|
+
CDMBase LLC
|
|
24
|
+
</section>
|
|
25
|
+
</footer>
|
|
26
|
+
</body>
|
|
27
|
+
|
|
28
|
+
</html>
|
|
@@ -5,31 +5,56 @@ import * as path from 'path';
|
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import { AddFullstackGeneratorSchema } from './schema';
|
|
7
7
|
import { getValid, isValid } from '../../utils';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
updateJenkinsFile,
|
|
10
|
+
updatePackageJson,
|
|
11
|
+
backupLernaJson,
|
|
12
|
+
restoreLernaJson,
|
|
13
|
+
updateHtmlPlugin,
|
|
14
|
+
updateLicense,
|
|
15
|
+
backupFiles,
|
|
16
|
+
restoreFiles,
|
|
17
|
+
updateRepository,
|
|
18
|
+
} from './updates';
|
|
9
19
|
import {
|
|
10
20
|
generateBackend,
|
|
11
21
|
generateFrontend,
|
|
12
22
|
generateMoleculer,
|
|
13
|
-
|
|
14
|
-
generateClientPackage,
|
|
15
|
-
generateCorePackage,
|
|
16
|
-
generateServerPackage,
|
|
23
|
+
generatePackage,
|
|
17
24
|
} from '../../index';
|
|
18
25
|
|
|
19
26
|
export async function addFullstackGenerator(tree: Tree, options: AddFullstackGeneratorSchema) {
|
|
20
27
|
const basePath = options.path || '';
|
|
21
|
-
const
|
|
28
|
+
const projectName = getValid(options.name) ?? 'fullstack-pro';
|
|
29
|
+
const projectRoot = path.join(basePath, projectName);
|
|
22
30
|
|
|
23
31
|
console.log(`basePath: ${basePath}`);
|
|
24
32
|
|
|
33
|
+
// backup existing lerna values
|
|
34
|
+
const lernaBackup = backupLernaJson(tree, projectRoot);
|
|
35
|
+
|
|
36
|
+
// backup files codegen.yaml
|
|
37
|
+
const filesToBackup = ['codegen.yml', 'values-dev.yaml', 'values-prod.yaml', 'values-stage.yaml'];
|
|
38
|
+
const filesBackup = backupFiles(tree, projectRoot, filesToBackup);
|
|
39
|
+
|
|
25
40
|
generateFiles(tree, path.join(__dirname, 'files'), projectRoot, options);
|
|
26
41
|
|
|
27
42
|
// Update Jenkinsfile with dynamic values
|
|
28
|
-
|
|
29
|
-
updateJenkinsFile(jenkinsFilePath, options.name);
|
|
43
|
+
updateJenkinsFile(tree, projectRoot, projectName);
|
|
30
44
|
|
|
31
45
|
// Update package.json with the project name
|
|
32
|
-
updatePackageJson(tree, projectRoot,
|
|
46
|
+
updatePackageJson(tree, projectRoot, { name: projectName });
|
|
47
|
+
|
|
48
|
+
// Update tools/html-plugin-template
|
|
49
|
+
updateHtmlPlugin(tree, projectRoot);
|
|
50
|
+
|
|
51
|
+
if (lernaBackup) {
|
|
52
|
+
// When update the existing lerna.json, it shouldn't overwrite version, allowbranch, packages
|
|
53
|
+
restoreLernaJson(tree, projectRoot, lernaBackup);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Restore files backup to ignore update
|
|
57
|
+
restoreFiles(tree, projectRoot, filesBackup);
|
|
33
58
|
|
|
34
59
|
await formatFiles(tree);
|
|
35
60
|
|
|
@@ -37,9 +62,9 @@ export async function addFullstackGenerator(tree: Tree, options: AddFullstackGen
|
|
|
37
62
|
const configPath = path.resolve(basePath, getValid(options.config));
|
|
38
63
|
if (fs.existsSync(configPath)) {
|
|
39
64
|
try {
|
|
40
|
-
const
|
|
41
|
-
const configs = JSON.parse(content);
|
|
65
|
+
const configs = JSON.parse(fs.readFileSync(configPath).toString());
|
|
42
66
|
configs.parent = projectRoot;
|
|
67
|
+
configs.ns = projectName;
|
|
43
68
|
|
|
44
69
|
await processConfigs(tree, configs);
|
|
45
70
|
} catch (error) {
|
|
@@ -47,14 +72,17 @@ export async function addFullstackGenerator(tree: Tree, options: AddFullstackGen
|
|
|
47
72
|
}
|
|
48
73
|
}
|
|
49
74
|
}
|
|
50
|
-
}
|
|
51
75
|
|
|
76
|
+
// Update license from package.json
|
|
77
|
+
updateLicense(tree, projectRoot);
|
|
78
|
+
}
|
|
52
79
|
|
|
53
|
-
const generateServers = async (tree: Tree,
|
|
54
|
-
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
80
|
+
const generateServers = async (tree: Tree, options: any) => {
|
|
81
|
+
for (const [serverName, serverConfig] of Object.entries(options.servers)) {
|
|
55
82
|
const configs: any = serverConfig;
|
|
56
83
|
configs.name = serverName;
|
|
57
|
-
configs.directory = path.join(parent, 'servers');
|
|
84
|
+
configs.directory = path.join(options.parent, 'servers');
|
|
85
|
+
configs.ns = options.ns;
|
|
58
86
|
|
|
59
87
|
switch (configs?.type) {
|
|
60
88
|
case 'frontend':
|
|
@@ -72,38 +100,36 @@ const generateServers = async (tree: Tree, parent: string, servers: any) => {
|
|
|
72
100
|
}
|
|
73
101
|
};
|
|
74
102
|
|
|
75
|
-
const
|
|
76
|
-
for (const [
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
await generateBrowserPackage(tree, configs);
|
|
87
|
-
break;
|
|
88
|
-
case 'packages-client':
|
|
89
|
-
await generateClientPackage(tree, configs);
|
|
90
|
-
break;
|
|
91
|
-
case 'packages-server':
|
|
92
|
-
await generateServerPackage(tree, configs);
|
|
93
|
-
break;
|
|
94
|
-
default:
|
|
95
|
-
break;
|
|
103
|
+
const generateModules = async (tree: Tree, options: any) => {
|
|
104
|
+
for (const [moduleName, moduleConfig] of Object.entries(options.packages.modules)) {
|
|
105
|
+
for (const [packageName, packageConfig] of Object.entries(moduleConfig)) {
|
|
106
|
+
const configs: any = {
|
|
107
|
+
...(packageConfig as any),
|
|
108
|
+
name: moduleName,
|
|
109
|
+
directory: path.join(options.parent, 'packages'),
|
|
110
|
+
ns: options.ns,
|
|
111
|
+
type: packageName,
|
|
112
|
+
};
|
|
113
|
+
await generatePackage(tree, configs, false);
|
|
96
114
|
}
|
|
97
115
|
}
|
|
98
116
|
};
|
|
99
117
|
|
|
100
118
|
const processConfigs = async (tree: Tree, configs: any) => {
|
|
101
119
|
if (configs.servers) {
|
|
102
|
-
await generateServers(tree, configs
|
|
120
|
+
await generateServers(tree, configs);
|
|
103
121
|
}
|
|
104
122
|
|
|
105
123
|
if (configs.packages && configs.packages.modules) {
|
|
106
|
-
await
|
|
124
|
+
await generateModules(tree, configs);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (configs.license) {
|
|
128
|
+
updatePackageJson(tree, configs.parent, { license: getValid(configs.license) });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (configs.repository) {
|
|
132
|
+
updateRepository(tree, configs.parent, configs.repository);
|
|
107
133
|
}
|
|
108
134
|
};
|
|
109
135
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
export function updateHtmlPlugin(tree: Tree, projectRoot: string) {
|
|
5
|
+
const filePath = path.join(projectRoot, 'tools', 'html-plugin-template.ejs');
|
|
6
|
+
if (tree.exists(filePath)) {
|
|
7
|
+
const contents = tree.read(filePath).toString();
|
|
8
|
+
const newContents = contents.replace('<@', '<%').replace('@>', '%>');
|
|
9
|
+
tree.write(filePath, newContents);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
|
|
4
|
+
export function backupFiles(tree: Tree, projectRoot: string, files: string[]) {
|
|
5
|
+
return files.map(file => {
|
|
6
|
+
const filePath = path.join(projectRoot, file);
|
|
7
|
+
const backup: any = { file };
|
|
8
|
+
if (tree.exists(filePath)) {
|
|
9
|
+
backup.content = tree.read(filePath).toString();
|
|
10
|
+
}
|
|
11
|
+
return backup;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function restoreFiles(tree: Tree, projectRoot: string, files: any[]) {
|
|
16
|
+
files.forEach((backup: any) => {
|
|
17
|
+
const filePath = path.join(projectRoot, backup.file);
|
|
18
|
+
if (backup.content) {
|
|
19
|
+
tree.write(filePath, backup.content);
|
|
20
|
+
console.log('Restored file', filePath);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
1
2
|
import fs from 'fs';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
|
|
4
|
-
export function updateJenkinsFile(
|
|
5
|
+
export function updateJenkinsFile(tree: Tree, projectRoot: string, name: string) {
|
|
6
|
+
const filePath = path.join(projectRoot, 'Jenkinsfile');
|
|
5
7
|
const paramsToUpdate = {
|
|
6
8
|
BASE_NAMESPACE: name,
|
|
7
9
|
CONNECTION_ID: name,
|
|
@@ -10,8 +12,8 @@ export function updateJenkinsFile(filePath: string, name: string) {
|
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
let jenkinsFileContent = '';
|
|
13
|
-
if (
|
|
14
|
-
jenkinsFileContent =
|
|
15
|
+
if (tree.exists(filePath)) {
|
|
16
|
+
jenkinsFileContent = tree.read(filePath).toString();
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
let labelExists = false;
|
|
@@ -42,6 +44,6 @@ export function updateJenkinsFile(filePath: string, name: string) {
|
|
|
42
44
|
|
|
43
45
|
// Only write back to the file if we have made changes
|
|
44
46
|
if (!labelExists || Object.keys(paramsToUpdate).some(param => !updatedContent.includes(`string(name: '${param}'`))) {
|
|
45
|
-
|
|
47
|
+
tree.write(filePath, updatedContent);
|
|
46
48
|
}
|
|
47
49
|
}
|