@common-stack/generate-plugin 6.0.8-alpha.9 → 7.0.2-alpha.1
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 +6 -268
- package/lib/common/package-releases/package.json +26 -0
- package/lib/common/package-releases/package.json.cjs +33 -0
- package/lib/common/package-releases/package.json.cjs.map +1 -0
- package/lib/common/package-releases/package.json.mjs +33 -0
- package/lib/common/package-releases/package.json.mjs.map +1 -0
- package/lib/generators/add-backend/files/Dockerfile +2 -0
- package/lib/generators/add-backend/files/package.json +4 -2
- package/lib/generators/add-backend/files/webpack.config.js +3 -1
- package/lib/generators/add-frontend/frameworks/antui/src/context.tsx.template +8 -0
- package/lib/generators/add-frontend/frameworks/antui/{entry.client.tsx.template → src/entry.client.tsx.template} +12 -12
- package/{src/generators/add-frontend/frameworks/antui → lib/generators/add-frontend/frameworks/antui/src}/entry.server.tsx.template +61 -51
- package/{src/generators/add-frontend/frameworks/antui → lib/generators/add-frontend/frameworks/antui/src}/root.tsx.template +6 -15
- package/lib/generators/add-frontend/frameworks/chakraui/{context.tsx.template → src/context.tsx.template} +6 -0
- package/lib/generators/add-frontend/frameworks/chakraui/{entry.client.tsx.template → src/entry.client.tsx.template} +21 -18
- package/{src/generators/add-frontend/frameworks/chakraui → lib/generators/add-frontend/frameworks/chakraui/src}/entry.server.tsx.template +33 -30
- package/lib/generators/add-frontend/frameworks/chakraui/{root.tsx.template → src/root.tsx.template} +8 -4
- package/{src/generators/add-frontend/frameworks/tailwindui → lib/generators/add-frontend/frameworks/tailwindui/src}/entry.client.tsx.template +3 -10
- package/lib/generators/add-frontend/generator.cjs +83 -36
- package/lib/generators/add-frontend/generator.cjs.map +1 -1
- package/lib/generators/add-frontend/generator.mjs +83 -36
- package/lib/generators/add-frontend/generator.mjs.map +1 -1
- package/lib/generators/add-frontend/templates/Dockerfile +4 -0
- package/lib/generators/add-frontend/templates/package.json +7 -3
- package/lib/generators/add-frontend/templates/vite.config.ts.template +18 -1
- package/lib/generators/add-fullstack/files/Jenkinsfile +2 -2
- package/lib/generators/add-fullstack/files/cdecode-config.json +126 -0
- package/lib/generators/add-fullstack/files/package.json +31 -18
- package/lib/generators/add-fullstack/files/rollup.config.base.mjs +17 -95
- package/lib/generators/add-fullstack/files/tools/codegenGenerator.mjs +36 -0
- package/lib/generators/add-fullstack/generator.cjs +8 -4
- package/lib/generators/add-fullstack/generator.cjs.map +1 -1
- package/lib/generators/add-fullstack/generator.mjs +8 -4
- package/lib/generators/add-fullstack/generator.mjs.map +1 -1
- package/lib/generators/add-fullstack/schema.json +1 -1
- package/lib/generators/add-moleculer/files/Dockerfile +2 -0
- package/lib/generators/add-moleculer/files/config.json +5 -0
- package/lib/generators/add-moleculer/files/package.json +10 -6
- package/lib/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/package.json +4 -3
- package/rollup.config.mjs +3 -0
- package/src/common/package-releases/package.json +26 -0
- package/src/generators/add-frontend/__snapshots__/generator.test.ts.snap +33 -0
- package/src/generators/add-frontend/frameworks/antui/src/context.tsx.template +8 -0
- package/src/generators/add-frontend/frameworks/antui/{entry.client.tsx.template → src/entry.client.tsx.template} +12 -12
- package/{lib/generators/add-frontend/frameworks/antui → src/generators/add-frontend/frameworks/antui/src}/entry.server.tsx.template +61 -51
- package/{lib/generators/add-frontend/frameworks/antui → src/generators/add-frontend/frameworks/antui/src}/root.tsx.template +6 -15
- package/src/generators/add-frontend/frameworks/chakraui/{context.tsx.template → src/context.tsx.template} +6 -0
- package/src/generators/add-frontend/frameworks/chakraui/{entry.client.tsx.template → src/entry.client.tsx.template} +21 -18
- package/{lib/generators/add-frontend/frameworks/chakraui → src/generators/add-frontend/frameworks/chakraui/src}/entry.server.tsx.template +33 -30
- package/src/generators/add-frontend/frameworks/chakraui/{root.tsx.template → src/root.tsx.template} +8 -4
- package/src/generators/add-frontend/frameworks/tailwindui/postcss.config.js +6 -0
- package/{lib/generators/add-frontend/frameworks/tailwindui → src/generators/add-frontend/frameworks/tailwindui/src}/entry.client.tsx.template +3 -10
- package/src/generators/add-frontend/frameworks/tailwindui/tailwind.config.ts.template +12 -0
- package/src/generators/add-frontend/generator.test.ts +79 -0
- package/src/generators/add-frontend/generator.ts +109 -44
- package/src/generators/add-fullstack/files/Jenkinsfile +2 -2
- package/src/generators/add-fullstack/files/cdecode-config.json +126 -0
- package/src/generators/add-fullstack/files/package.json +32 -19
- package/src/generators/add-fullstack/files/rollup.config.base.mjs +17 -95
- package/src/generators/add-fullstack/files/tools/codegenGenerator.mjs +36 -0
- package/src/generators/add-fullstack/generator.ts +8 -4
- package/src/generators/add-fullstack/schema.json +1 -1
- package/src/generators/add-moleculer/files/.dockerignore +2 -1
- package/src/generators/add-moleculer/files/CHANGELOG.md +0 -4
- package/src/generators/add-moleculer/files/Dockerfile +2 -0
- package/src/generators/add-moleculer/files/config.json +5 -0
- package/src/generators/add-moleculer/files/package.json +11 -7
- package/src/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/tsconfig.spec.json +9 -0
- package/docker-releases/backend/package.json +0 -134
- package/docker-releases/frontend/antd/package.json +0 -121
- package/lib/generators/add-fullstack/files/codegen.yml +0 -47
- package/lib/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
- package/src/generators/add-frontend/generator.spec.ts +0 -20
- package/src/generators/add-fullstack/files/codegen.yml +0 -47
- package/src/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
- /package/lib/generators/add-frontend/{templates → frameworks/tailwindui}/postcss.config.js +0 -0
- /package/lib/generators/add-frontend/frameworks/tailwindui/{entry.server.tsx.template → src/entry.server.tsx.template} +0 -0
- /package/lib/generators/add-frontend/frameworks/tailwindui/{root.tsx.template → src/root.tsx.template} +0 -0
- /package/lib/generators/add-frontend/frameworks/tailwindui/{tailwind.css → src/tailwind.css} +0 -0
- /package/lib/generators/add-frontend/{templates → frameworks/tailwindui}/tailwind.config.ts.template +0 -0
- /package/lib/generators/add-frontend/{generator.spec.d.ts → generator.test.d.ts} +0 -0
- /package/src/generators/add-frontend/frameworks/tailwindui/{entry.server.tsx.template → src/entry.server.tsx.template} +0 -0
- /package/src/generators/add-frontend/frameworks/tailwindui/{root.tsx.template → src/root.tsx.template} +0 -0
- /package/src/generators/add-frontend/frameworks/tailwindui/{tailwind.css → src/tailwind.css} +0 -0
|
@@ -1,18 +1,88 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable no-param-reassign */
|
|
3
|
+
/* eslint-disable no-use-before-define */
|
|
4
|
+
import { formatFiles, generateFiles, Tree, updateJson } from '@nx/devkit';
|
|
2
5
|
import * as path from 'path';
|
|
3
6
|
import * as fs from 'node:fs';
|
|
4
7
|
import { deepMerge } from '@common-stack/rollup-vite-utils/lib/utils/setupConfig.cjs';
|
|
5
8
|
import { AddFrontendGeneratorSchema } from './schema';
|
|
6
9
|
import { isValid, getValid } from '../../utils';
|
|
7
10
|
import { FRAMEWORK_ANTUI, FRAMEWORK_CHAKRAUI, FRAMEWORK_TAILWINDUI } from '../../common/constants';
|
|
11
|
+
import pluginPkg from '../../common/package-releases/package.json' assert { type: 'json' };
|
|
8
12
|
|
|
9
13
|
const DEFAULT_FRAMEWORK = FRAMEWORK_ANTUI;
|
|
10
14
|
const DEFAULT_SERVER_NAME = 'frontend-server';
|
|
11
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Helper to retrieve a package version from pluginPkg.
|
|
18
|
+
* Throws an error if a version for packageName is not defined.
|
|
19
|
+
*/
|
|
20
|
+
function getPackageVersion(packageName: string): string {
|
|
21
|
+
// Read the generator's package.json. This file is updated using ncu,
|
|
22
|
+
// so the generator always picks up the latest dependency versions.
|
|
23
|
+
// const pluginPkgPath = path.resolve(__dirname, '../../common/package-releases/package.json');
|
|
24
|
+
// const pluginPkg = JSON.parse(fs.readFileSync(pluginPkgPath, 'utf-8'));
|
|
25
|
+
|
|
26
|
+
const version =
|
|
27
|
+
(pluginPkg.dependencies && pluginPkg.dependencies[packageName]) ||
|
|
28
|
+
(pluginPkg.devDependencies && pluginPkg.devDependencies[packageName]);
|
|
29
|
+
|
|
30
|
+
if (!version) {
|
|
31
|
+
throw new Error(`Version for package "${packageName}" not found in plugin package.json.`);
|
|
32
|
+
}
|
|
33
|
+
return version;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Helper to map an array of dependency names to an object where each key is a dependency
|
|
38
|
+
* and its value is obtained via getPackageVersion().
|
|
39
|
+
*/
|
|
40
|
+
function mapDependencies(depNames: string[]): Record<string, string> {
|
|
41
|
+
return depNames.reduce(
|
|
42
|
+
(acc, name) => {
|
|
43
|
+
acc[name] = getPackageVersion(name);
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{} as Record<string, string>,
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A mapping of frameworks to dependency definitions.
|
|
52
|
+
* Each dependency's version is obtained dynamically from pluginPkg using a helper.
|
|
53
|
+
*/
|
|
54
|
+
const frameworkDependencyMap: {
|
|
55
|
+
[key: string]: { dependencies?: Record<string, string>; devDependencies?: Record<string, string> };
|
|
56
|
+
} = {
|
|
57
|
+
[FRAMEWORK_ANTUI]: {
|
|
58
|
+
dependencies: mapDependencies([
|
|
59
|
+
'@admin-layout/ant-design-pro',
|
|
60
|
+
'@ant-design/static-style-extract',
|
|
61
|
+
'@emotion/react',
|
|
62
|
+
'@emotion/server',
|
|
63
|
+
'@emotion/css',
|
|
64
|
+
'@emotion/styled',
|
|
65
|
+
'antd',
|
|
66
|
+
]),
|
|
67
|
+
},
|
|
68
|
+
[FRAMEWORK_CHAKRAUI]: {
|
|
69
|
+
dependencies: mapDependencies([
|
|
70
|
+
'@chakra-ui/react',
|
|
71
|
+
'framer-motion',
|
|
72
|
+
'@emotion/react',
|
|
73
|
+
'@emotion/server',
|
|
74
|
+
'@emotion/css',
|
|
75
|
+
'@emotion/styled',
|
|
76
|
+
]),
|
|
77
|
+
},
|
|
78
|
+
[FRAMEWORK_TAILWINDUI]: {
|
|
79
|
+
devDependencies: mapDependencies(['tailwindcss', 'postcss', 'autoprefixer']),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
12
83
|
export async function addFrontendGenerator(tree: Tree, options: AddFrontendGeneratorSchema) {
|
|
13
84
|
const projectName = isValid(options.name) ? `frontend-${getValid(options.name)}-server` : DEFAULT_SERVER_NAME;
|
|
14
|
-
const configs: any = {...options, name: projectName};
|
|
15
|
-
|
|
85
|
+
const configs: any = { ...options, name: projectName };
|
|
16
86
|
return await generateFrontend(tree, configs);
|
|
17
87
|
}
|
|
18
88
|
|
|
@@ -20,65 +90,60 @@ export const generateFrontend = async (tree: Tree, options: any) => {
|
|
|
20
90
|
let projectName = getValid(options.name) ?? DEFAULT_SERVER_NAME;
|
|
21
91
|
const projectRoot = isValid(options.directory) ? `${getValid(options.directory)}/${projectName}` : projectName;
|
|
22
92
|
projectName = isValid(options.ns) ? `${getValid(options.ns)}-${projectName}` : projectName;
|
|
23
|
-
|
|
24
|
-
|
|
93
|
+
|
|
25
94
|
const framework = getValid(options.framework) ?? DEFAULT_FRAMEWORK;
|
|
26
95
|
console.log('UI framework specified: ', framework);
|
|
27
|
-
|
|
28
|
-
// resetProject(`${basePath}/${projectRoot}`);
|
|
29
|
-
|
|
30
|
-
// addProjectConfiguration(tree, framework, {
|
|
31
|
-
// root: projectRoot,
|
|
32
|
-
// projectType: 'library',
|
|
33
|
-
// sourceRoot: projectSrc,
|
|
34
|
-
// targets: {},
|
|
35
|
-
// });
|
|
36
|
-
|
|
96
|
+
|
|
37
97
|
generateFiles(tree, path.join(__dirname, 'templates'), projectRoot, {});
|
|
38
|
-
generateFiles(tree, path.join(__dirname, 'frameworks', framework),
|
|
98
|
+
generateFiles(tree, path.join(__dirname, 'frameworks', framework), projectRoot, options);
|
|
99
|
+
|
|
39
100
|
updateJson(tree, `${projectRoot}/package.json`, (packageJson) => {
|
|
40
|
-
packageJson
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
packageJson['dependencies']["@emotion/react"] = "^11.10.0";
|
|
53
|
-
packageJson['dependencies']["@emotion/server"] = "^11.10.0";
|
|
54
|
-
packageJson['dependencies']["@emotion/css"] = "^11.10.0";
|
|
55
|
-
packageJson['dependencies']["@emotion/styled"] = "^11.10.4";
|
|
56
|
-
|
|
57
|
-
} else if (framework === FRAMEWORK_TAILWINDUI) {
|
|
58
|
-
packageJson['devDependencies']["tailwindcss"] = "^3.4.10";
|
|
59
|
-
packageJson['devDependencies']["postcss"] = "^8.4.41";
|
|
60
|
-
packageJson['devDependencies']["autoprefixer"] = "^10.4.20";
|
|
101
|
+
packageJson.name = projectName;
|
|
102
|
+
packageJson.dependencies = packageJson.dependencies || {};
|
|
103
|
+
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
104
|
+
|
|
105
|
+
const dependencyOverrides = frameworkDependencyMap[framework] || {};
|
|
106
|
+
|
|
107
|
+
if (dependencyOverrides.dependencies) {
|
|
108
|
+
Object.entries(dependencyOverrides.dependencies).forEach(([pkg, version]) => {
|
|
109
|
+
if (!packageJson.dependencies[pkg]) {
|
|
110
|
+
packageJson.dependencies[pkg] = version;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
61
113
|
}
|
|
62
|
-
|
|
114
|
+
|
|
115
|
+
if (dependencyOverrides.devDependencies) {
|
|
116
|
+
Object.entries(dependencyOverrides.devDependencies).forEach(([pkg, version]) => {
|
|
117
|
+
if (!packageJson.devDependencies[pkg]) {
|
|
118
|
+
packageJson.devDependencies[pkg] = version;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
63
123
|
return packageJson;
|
|
64
124
|
});
|
|
125
|
+
|
|
65
126
|
updateJson(tree, `${projectRoot}/config.json`, (configJson) => {
|
|
66
|
-
configJson
|
|
127
|
+
configJson.uiFramework = framework;
|
|
67
128
|
if (framework === FRAMEWORK_ANTUI) {
|
|
68
|
-
configJson
|
|
129
|
+
if (!configJson.modules.includes('@admin-layout/ant-design-pro')) {
|
|
130
|
+
configJson.modules.push('@admin-layout/ant-design-pro');
|
|
131
|
+
}
|
|
69
132
|
} else if (framework === FRAMEWORK_CHAKRAUI) {
|
|
70
|
-
configJson
|
|
133
|
+
if (!configJson.modules.includes('@admin-layout/chakra-design-pro')) {
|
|
134
|
+
configJson.modules.push('@admin-layout/chakra-design-pro');
|
|
135
|
+
}
|
|
71
136
|
}
|
|
72
137
|
|
|
73
138
|
if (options['config.json']) {
|
|
74
|
-
const
|
|
75
|
-
configJson = deepMerge(configJson,
|
|
139
|
+
const additionalConfigs = options['config.json'];
|
|
140
|
+
configJson = deepMerge(configJson, additionalConfigs);
|
|
76
141
|
}
|
|
77
142
|
|
|
78
143
|
return configJson;
|
|
79
144
|
});
|
|
80
145
|
|
|
81
146
|
await formatFiles(tree);
|
|
82
|
-
}
|
|
147
|
+
};
|
|
83
148
|
|
|
84
149
|
export default addFrontendGenerator;
|
|
@@ -29,7 +29,7 @@ pipeline {
|
|
|
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.12','0.7.11', '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'
|
|
@@ -646,7 +646,7 @@ def buildAndPushDockerImage(server, name, version) {
|
|
|
646
646
|
} else {
|
|
647
647
|
sh """
|
|
648
648
|
npx lerna exec --scope=*${server} ${params.BUILD_STRATEGY} run ${env.BUILD_COMMAND};
|
|
649
|
-
|
|
649
|
+
npx lerna exec --scope=*${server} ${params.BUILD_STRATEGY} copycommon
|
|
650
650
|
docker buildx create --name ${server} --driver docker-container --use
|
|
651
651
|
docker buildx inspect ${server} --bootstrap
|
|
652
652
|
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"servers": ["servers/frontend-server/config.json", "servers/backend-server/config.json"],
|
|
3
|
+
"codegen": {
|
|
4
|
+
"outputFile": "codegen.ts",
|
|
5
|
+
"rootSchema": "servers/backend-server/src/api/root-schema.graphqls",
|
|
6
|
+
"fullConfig": {
|
|
7
|
+
"overwrite": true,
|
|
8
|
+
"schema": ["$PRIMARY_SCHEMA_PLACEHOLDER$"],
|
|
9
|
+
"generates": {
|
|
10
|
+
"packages/common/src/generated/generated-models.ts": {
|
|
11
|
+
"schema": "%discoveredSchemas%",
|
|
12
|
+
"documents": "%discoveredDocuments%",
|
|
13
|
+
"config": {
|
|
14
|
+
"scalars": {
|
|
15
|
+
"URI": "URI",
|
|
16
|
+
"URIInput": "URI | UriComponents"
|
|
17
|
+
},
|
|
18
|
+
"enumPrefix": false,
|
|
19
|
+
"enumValues": {
|
|
20
|
+
"ConfigurationScope": "@workbench-stack/core/lib/interfaces/configuration/configuration.js#ConfigurationScope",
|
|
21
|
+
"ConfigurationTarget": "../configuration#ConfigurationTarget"
|
|
22
|
+
},
|
|
23
|
+
"constEnums": false,
|
|
24
|
+
"contextType": "../apollo-context#MyContext",
|
|
25
|
+
"withHooks": true,
|
|
26
|
+
"typesPrefix": "I",
|
|
27
|
+
"noNamespaces": true,
|
|
28
|
+
"noGraphQLTag": true
|
|
29
|
+
},
|
|
30
|
+
"plugins": [
|
|
31
|
+
{
|
|
32
|
+
"add": {
|
|
33
|
+
"content": [
|
|
34
|
+
"import { URI, UriComponents } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"typescript",
|
|
39
|
+
"typescript-operations",
|
|
40
|
+
"typescript-resolvers"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"packages/common/src/generated/generated.tsx": {
|
|
44
|
+
"schema": "%discoveredSchemas%",
|
|
45
|
+
"documents": "%discoveredDocuments%",
|
|
46
|
+
"config": {
|
|
47
|
+
"scalars": {
|
|
48
|
+
"URI": "URI",
|
|
49
|
+
"URIInput": "URI | UriComponents"
|
|
50
|
+
},
|
|
51
|
+
"enumPrefix": false,
|
|
52
|
+
"withHooks": true,
|
|
53
|
+
"typesPrefix": "I",
|
|
54
|
+
"noNamespaces": true,
|
|
55
|
+
"noGraphQLTag": true
|
|
56
|
+
},
|
|
57
|
+
"preset": "import-types-preset",
|
|
58
|
+
"presetConfig": {
|
|
59
|
+
"typesPath": "./generated-models",
|
|
60
|
+
"importTypesNamespace": "SchemaTypes"
|
|
61
|
+
},
|
|
62
|
+
"plugins": [
|
|
63
|
+
{
|
|
64
|
+
"add": {
|
|
65
|
+
"content": [
|
|
66
|
+
"import { URI, UriComponents } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"typescript-react-apollo"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"packages/common/src/generated/introspection-result.ts": {
|
|
74
|
+
"schema": "%discoveredSchemas%",
|
|
75
|
+
"documents": "%discoveredDocuments%",
|
|
76
|
+
"config": {
|
|
77
|
+
"typesPrefix": "I"
|
|
78
|
+
},
|
|
79
|
+
"plugins": [
|
|
80
|
+
{
|
|
81
|
+
"add": {
|
|
82
|
+
"content": ["/* tslint:disable */"]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"fragment-matcher"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"updateDependencies": {
|
|
92
|
+
"packagesToCheck": [
|
|
93
|
+
"@common-stack/server-stack",
|
|
94
|
+
"@common-stack/frontend-stack-react",
|
|
95
|
+
"@common-stack/mobile-stack-react"
|
|
96
|
+
],
|
|
97
|
+
"packagePaths": {
|
|
98
|
+
"backend": ["servers/backend-server/package.json"],
|
|
99
|
+
"frontend": ["servers/frontend-server/package.json"],
|
|
100
|
+
"mobile": ["portable-devices/mobile/package.json"]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"updateDependencyVersion": {
|
|
104
|
+
"roots": ["servers", "portable-devices", "packages", "packages-modules"],
|
|
105
|
+
"ignorePattern": "**/node_modules/**",
|
|
106
|
+
"jsonSpacing": 4,
|
|
107
|
+
"addEndNewLine": true,
|
|
108
|
+
"commitMessage": "Updated packages to use correct versions"
|
|
109
|
+
},
|
|
110
|
+
"sortPackageJson": {
|
|
111
|
+
"directories": [".", "packages", "packages-modules", "servers", "portable-devices"],
|
|
112
|
+
"skipNodeModules": true
|
|
113
|
+
},
|
|
114
|
+
"deployVersionUpdate": {
|
|
115
|
+
"lernaJsonPath": "lerna.json",
|
|
116
|
+
"jenkinsfilePath": "Jenkinsfile",
|
|
117
|
+
"valuesDevYamlPath": "values-dev.yaml",
|
|
118
|
+
"valuesProdYamlPath": "values-prod.yaml"
|
|
119
|
+
},
|
|
120
|
+
"projectPaths": {
|
|
121
|
+
"packages": "packages",
|
|
122
|
+
"packagesModules": "packages-modules",
|
|
123
|
+
"servers": "servers",
|
|
124
|
+
"portableDevices": "portable-devices"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sample-stack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"prebootstrap": "lerna run prepare",
|
|
28
|
-
"bootstrap": "yarn
|
|
28
|
+
"bootstrap": "yarn",
|
|
29
29
|
"postbootstrap": "yarn build",
|
|
30
30
|
"build": "yarn build:packages",
|
|
31
31
|
"build:clean": "lerna exec yarn build:clean",
|
|
@@ -52,14 +52,15 @@
|
|
|
52
52
|
"devpublish:push": "yarn predevpublish && git push origin $PUBLISH_BRANCH && yarn postdevpublish",
|
|
53
53
|
"format": "yarn lint --fix",
|
|
54
54
|
"format:md": "yarn lint:md --fix",
|
|
55
|
-
"
|
|
55
|
+
"pregenerateGraphql": " node --experimental-modules tools/codegenGenerator.mjs",
|
|
56
|
+
"generateGraphql": "graphql-codegen-esm",
|
|
57
|
+
"postgenerateGraphql": "lerna run watch --scope=common",
|
|
56
58
|
"generateGraphql:watch": "yarn generateGraphql -- --watch",
|
|
57
59
|
"git:pull": "git pull origin $(git rev-parse --abbrev-ref HEAD)",
|
|
58
60
|
"git:push": "git push origin $(git rev-parse --abbrev-ref HEAD)",
|
|
59
61
|
"gitcommit": "git add -A && git diff --staged --quiet || git commit -am 'auto publish [skip ci] \r\n'",
|
|
60
62
|
"husky-skip": "cross-env HUSKY_SKIP_HOOKS=1",
|
|
61
63
|
"jest": "./node_modules/.bin/jest",
|
|
62
|
-
"lerna": "lerna bootstrap",
|
|
63
64
|
"prelernapublish": "git checkout $PUBLISH_BRANCH && git pull origin $PUBLISH_BRANCH && git merge -s recursive -X theirs $MASTER_BRANCH -m 'merge from master' && yarn gitcommit && node tools/update-dependency-version.mjs && yarn gitcommit",
|
|
64
65
|
"lernapublish": "lerna publish patch --ignore-scripts",
|
|
65
66
|
"postlernapublish": "yarn update-lerna-on-develop && git checkout $MASTER_BRANCH",
|
|
@@ -105,9 +106,11 @@
|
|
|
105
106
|
},
|
|
106
107
|
"resolutions": {
|
|
107
108
|
"@apollo/client": "^3.9.0",
|
|
108
|
-
"@types/react": "^18.
|
|
109
|
-
"@types/react-dom": "^18.
|
|
109
|
+
"@types/react": "^18.2.25",
|
|
110
|
+
"@types/react-dom": "^18.2.7",
|
|
111
|
+
"common": "link:packages/common",
|
|
110
112
|
"html-to-text": "^8.0.0",
|
|
113
|
+
"lerna": "8.1.8",
|
|
111
114
|
"react": "18.3.0-canary-c3048aab4-20240326",
|
|
112
115
|
"react-dom": "18.3.0-canary-c3048aab4-20240326",
|
|
113
116
|
"react-native": "0.72.10",
|
|
@@ -146,20 +149,20 @@
|
|
|
146
149
|
"@babel/preset-typescript": "^7.18.6",
|
|
147
150
|
"@babel/register": "^7.18.9",
|
|
148
151
|
"@babel/runtime": "^7.20.1",
|
|
149
|
-
"@common-stack/env-list-loader": "
|
|
150
|
-
"@common-stack/generate-plugin": "
|
|
151
|
-
"@common-stack/rollup-vite-utils": "
|
|
152
|
+
"@common-stack/env-list-loader": "7.0.2-alpha.0",
|
|
153
|
+
"@common-stack/generate-plugin": "7.0.2-alpha.0",
|
|
154
|
+
"@common-stack/rollup-vite-utils": "7.0.2-alpha.0",
|
|
152
155
|
"@emotion/babel-plugin": "^11.11.0",
|
|
153
|
-
"@graphql-codegen/add": "^5.0.
|
|
154
|
-
"@graphql-codegen/cli": "^5.0.
|
|
155
|
-
"@graphql-codegen/fragment-matcher": "^5.0
|
|
156
|
+
"@graphql-codegen/add": "^5.0.3",
|
|
157
|
+
"@graphql-codegen/cli": "^5.0.4",
|
|
158
|
+
"@graphql-codegen/fragment-matcher": "^5.1.0",
|
|
156
159
|
"@graphql-codegen/import-types-preset": "^3.0.0",
|
|
157
160
|
"@graphql-codegen/near-operation-file-preset": "^3.0.0",
|
|
158
|
-
"@graphql-codegen/typescript": "^4.
|
|
161
|
+
"@graphql-codegen/typescript": "^4.1.3",
|
|
159
162
|
"@graphql-codegen/typescript-graphql-files-modules": "^3.0.0",
|
|
160
|
-
"@graphql-codegen/typescript-operations": "^4.
|
|
161
|
-
"@graphql-codegen/typescript-react-apollo": "^4.3.
|
|
162
|
-
"@graphql-codegen/typescript-resolvers": "^4.
|
|
163
|
+
"@graphql-codegen/typescript-operations": "^4.4.1",
|
|
164
|
+
"@graphql-codegen/typescript-react-apollo": "^4.3.2",
|
|
165
|
+
"@graphql-codegen/typescript-resolvers": "^4.4.2",
|
|
163
166
|
"@loadable/babel-plugin": "^5.13.2",
|
|
164
167
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
165
168
|
"@nx-aws-plugin/nx-aws-cache": "^3.2.2",
|
|
@@ -176,7 +179,8 @@
|
|
|
176
179
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
177
180
|
"@shelf/jest-mongodb": "^4.1.3",
|
|
178
181
|
"@svgr/webpack": "^6.5.1",
|
|
179
|
-
"@testing-library/
|
|
182
|
+
"@testing-library/dom": "^10.4.0",
|
|
183
|
+
"@testing-library/react": "^16.1.0",
|
|
180
184
|
"@testing-library/react-hooks": "^8.0.1",
|
|
181
185
|
"@types/async": "^3.2.15",
|
|
182
186
|
"@types/body-parser": "1.19.2",
|
|
@@ -272,7 +276,7 @@
|
|
|
272
276
|
"jest-raw-loader": "^1.0.1",
|
|
273
277
|
"jest-transform-graphql": "^2.1.0",
|
|
274
278
|
"jsdom": "^20.0.2",
|
|
275
|
-
"lerna": "8",
|
|
279
|
+
"lerna": "8.1.8",
|
|
276
280
|
"less": "^4.1.3",
|
|
277
281
|
"less-loader": "^11.0.0",
|
|
278
282
|
"lint-staged": "^15.2.7",
|
|
@@ -307,11 +311,15 @@
|
|
|
307
311
|
"redux-devtools-extension": "^2.13.9",
|
|
308
312
|
"redux-mock-store": "^1.5.4",
|
|
309
313
|
"remap-istanbul": "^0.13.0",
|
|
314
|
+
"remix-development-tools": "^4.4.1",
|
|
310
315
|
"resolve-url-loader": "^5.0.0",
|
|
311
316
|
"rimraf": "^3.0.2",
|
|
312
317
|
"rollup": "^4.13.0",
|
|
313
318
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
319
|
+
"rollup-plugin-multi-input": "^1.5.0",
|
|
314
320
|
"rollup-plugin-string": "^3.0.0",
|
|
321
|
+
"rollup-plugin-svg": "^2.0.0",
|
|
322
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
315
323
|
"sass-loader": "^13.1.0",
|
|
316
324
|
"shelljs": "^0.8.5",
|
|
317
325
|
"simple-git": "^3.14.1",
|
|
@@ -332,10 +340,15 @@
|
|
|
332
340
|
"typedoc": "^0.23.20",
|
|
333
341
|
"typescript": "^5.5.4",
|
|
334
342
|
"url-loader": "^4.1.1",
|
|
343
|
+
"vite": "^5.1.1",
|
|
344
|
+
"vite-plugin-babel-macros": "^1.0.6",
|
|
345
|
+
"vite-plugin-cjs-interop": "^2.0.6",
|
|
346
|
+
"vite-plugin-compression": "^0.5.1",
|
|
347
|
+
"vitest": "^3.0.4",
|
|
335
348
|
"wait-on": "^6.0.1",
|
|
336
349
|
"webpack": "^5.74.0",
|
|
337
350
|
"webpack-bundle-analyzer": "^4.7.0",
|
|
338
|
-
"webpack-cli": "^
|
|
351
|
+
"webpack-cli": "^5.1.4",
|
|
339
352
|
"webpack-dev-server": "^4.11.1",
|
|
340
353
|
"webpack-manifest-plugin": "^5.0.0",
|
|
341
354
|
"webpack-merge": "^5.8.0",
|
|
@@ -3,15 +3,15 @@ import graphql from '@rollup/plugin-graphql';
|
|
|
3
3
|
import image from '@rollup/plugin-image';
|
|
4
4
|
import typescript from '@rollup/plugin-typescript';
|
|
5
5
|
import { string } from 'rollup-plugin-string';
|
|
6
|
+
import svg from 'rollup-plugin-svg';
|
|
6
7
|
import { copy } from '@web/rollup-plugin-copy';
|
|
7
8
|
import modifyLibFilesPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginModifyLibFiles.js';
|
|
8
9
|
import generateJsonFromObject from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginGenerateJson.js';
|
|
9
10
|
import addJsExtensionToImportsPlugin from '@common-stack/rollup-vite-utils/lib/rollup/rollupPluginAddJsExtension.js';
|
|
10
11
|
import { ignoreCssUrlPlugin } from '@common-stack/rollup-vite-utils/lib/rollup/pluginIgnore.js';
|
|
11
|
-
|
|
12
|
-
// Define any additional plugins specific to this bundle
|
|
12
|
+
// Define any additional plugins specific to this bundle
|
|
13
13
|
const additionalPlugins = [
|
|
14
|
-
copy({ patterns: ['**/cdm-locales/**/*', '**/styles/**/*'], rootDir: './src' }),
|
|
14
|
+
copy({ patterns: ['**/cdm-locales/**/*', '**/*.gql', '**/**/*.graphql', '**/styles/**/*', '**/css/**/*'], rootDir: './src' }),
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
function deepMergeConfigs(baseConfig, specificConfig) {
|
|
@@ -28,7 +28,8 @@ function deepMergeConfigs(baseConfig, specificConfig) {
|
|
|
28
28
|
// Base configuration
|
|
29
29
|
const baseConfig = {
|
|
30
30
|
plugins: [
|
|
31
|
-
image(),
|
|
31
|
+
image({ exclude: '**/*.svg' }),
|
|
32
|
+
svg({ include: '**/*.svg' }),
|
|
32
33
|
graphql({ include: '**/*.gql' }),
|
|
33
34
|
string({
|
|
34
35
|
include: ['**/*.ejs', '**/*.graphql'],
|
|
@@ -45,6 +46,7 @@ const baseConfig = {
|
|
|
45
46
|
outputDir: 'lib', // Ensure this matches your actual output directory
|
|
46
47
|
}),
|
|
47
48
|
generateJsonFromObject({}),
|
|
49
|
+
|
|
48
50
|
...additionalPlugins,
|
|
49
51
|
],
|
|
50
52
|
external: (id) => !/^[./]/.test(id),
|
|
@@ -52,101 +54,21 @@ const baseConfig = {
|
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
// Function to create a configuration by extending the base
|
|
55
|
-
function createRollupConfig(overrides) {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function watch(watchOptions, buildMode = '') {
|
|
59
|
-
const filename = path.basename(watchOptions.input);
|
|
60
|
-
message(
|
|
61
|
-
'note',
|
|
62
|
-
`${dt()} Rollup: Watcher Starting - watching for changes starting with: "${filename}" buildMode="${buildMode}"...`,
|
|
63
|
-
'WATCH ',
|
|
64
|
-
true,
|
|
65
|
-
);
|
|
66
|
-
const watcher = rollup.watch(watchOptions);
|
|
67
|
-
|
|
68
|
-
watcher.on('event', (event) => {
|
|
69
|
-
// event.code can be one of:
|
|
70
|
-
// START — the watcher is (re)starting
|
|
71
|
-
// BUNDLE_START — building an individual bundle
|
|
72
|
-
// * event.input will be the input options object if present
|
|
73
|
-
// * event.output contains an array of the "file" or
|
|
74
|
-
// "dir" option values of the generated outputs
|
|
75
|
-
// BUNDLE_END — finished building a bundle
|
|
76
|
-
// * event.input will be the input options object if present
|
|
77
|
-
// * event.output contains an array of the "file" or
|
|
78
|
-
// "dir" option values of the generated outputs
|
|
79
|
-
// * event.duration is the build duration in milliseconds
|
|
80
|
-
// * event.result contains the bundle object that can be
|
|
81
|
-
// used to generate additional outputs by calling
|
|
82
|
-
// bundle.generate or bundle.write. This is especially
|
|
83
|
-
// important when the watch.skipWrite option is used.
|
|
84
|
-
// You should call "event.result.close()" once you are done
|
|
85
|
-
// generating outputs, or if you do not generate outputs.
|
|
86
|
-
// This will allow plugins to clean up resources via the
|
|
87
|
-
// "closeBundle" hook.
|
|
88
|
-
// END — finished building all bundles
|
|
89
|
-
// ERROR — encountered an error while bundling
|
|
90
|
-
// * event.error contains the error that was thrown
|
|
91
|
-
// * event.result is null for build errors and contains the
|
|
92
|
-
// bundle object for output generation errors. As with
|
|
93
|
-
// "BUNDLE_END", you should call "event.result.close()" if
|
|
94
|
-
// present once you are done.
|
|
95
|
-
// If you return a Promise from your event handler, Rollup will wait until the
|
|
96
|
-
// Promise is resolved before continuing.
|
|
97
|
-
// console.log(`rollup: ${event.code}`)
|
|
98
|
-
if (event.code === 'BUNDLE_END') {
|
|
99
|
-
const outputFiles = event.output.map((o) => path.basename(o)).join(', .../');
|
|
100
|
-
const msg = `${dt()} Rollup: wrote bundle${event.output.length > 1 ? 's' : ''}: ".../${outputFiles}"`;
|
|
101
|
-
if (NOTIFY) {
|
|
102
|
-
notifier.notify({
|
|
103
|
-
title: 'React Component Build',
|
|
104
|
-
message: msg,
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
// messenger: success, warn, critical, note, log
|
|
108
|
-
message('success', msg, 'SUCCESS', true);
|
|
109
|
-
} else if (event.code === 'ERROR') {
|
|
110
|
-
message('critical', `!!!!!!!!!!!!!!!\nRollup ${event.error}\n!!!!!!!!!!!!!!!\n`, 'ERROR', true);
|
|
111
|
-
if (NOTIFY) {
|
|
112
|
-
notifier.notify({
|
|
113
|
-
title: 'NotePlan Plugins Build',
|
|
114
|
-
message: `An error occurred during build process.\nSee console for more information`,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
57
|
+
function createRollupConfig(overrides, isWatchMode = false) {
|
|
58
|
+
const config = deepMergeConfigs(baseConfig, overrides);
|
|
119
59
|
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
60
|
+
// Adjust TypeScript plugin based on watch mode
|
|
61
|
+
config.plugins = config.plugins.map((plugin) => {
|
|
62
|
+
if (plugin.name === 'typescript') {
|
|
63
|
+
return typescript({
|
|
64
|
+
...plugin.options,
|
|
65
|
+
noEmitOnError: !isWatchMode, // Set to false only in watch mode
|
|
66
|
+
});
|
|
124
67
|
}
|
|
68
|
+
return plugin;
|
|
125
69
|
});
|
|
126
70
|
|
|
127
|
-
|
|
128
|
-
// make Rollup wait at that stage:
|
|
129
|
-
watcher.on('change', (id /* , { event } */) => {
|
|
130
|
-
const filename = path.basename(id);
|
|
131
|
-
message('info', `${dt()} Rollup: file: "${filename}" changed`, 'CHANGE', true);
|
|
132
|
-
/* a file was modified */
|
|
133
|
-
});
|
|
134
|
-
watcher.on('restart', () => {
|
|
135
|
-
// console.log(`rollup: restarting`)
|
|
136
|
-
/* a new run was triggered (usually a watched file change) */
|
|
137
|
-
});
|
|
138
|
-
watcher.on('close', () => {
|
|
139
|
-
console.log(`rollup: closing`);
|
|
140
|
-
/* the watcher was closed, see below */
|
|
141
|
-
});
|
|
142
|
-
process.on('SIGINT', async function () {
|
|
143
|
-
console.log('\n\n');
|
|
144
|
-
console.log(colors.yellow('Quitting...\n'));
|
|
145
|
-
if (watcher) {
|
|
146
|
-
await watcher.close();
|
|
147
|
-
}
|
|
148
|
-
process.exit();
|
|
149
|
-
});
|
|
71
|
+
return config;
|
|
150
72
|
}
|
|
151
73
|
|
|
152
74
|
export { createRollupConfig, baseConfig };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
import { runCodegenTasks } from '@common-stack/rollup-vite-utils/lib/tools/codegen/index.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This main script orchestrates your codegen steps, using cdecode-config.json.
|
|
9
|
+
* Usage:
|
|
10
|
+
* node tools/mainScript.mjs
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// ESM housekeeping
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = path.dirname(__filename);
|
|
16
|
+
|
|
17
|
+
(async function main() {
|
|
18
|
+
try {
|
|
19
|
+
// 1) Locate and parse cdecode-config.json
|
|
20
|
+
const configPath = path.join(__dirname, '../cdecode-config.json');
|
|
21
|
+
if (!fs.existsSync(configPath)) {
|
|
22
|
+
console.error(`cdecode-config.json not found at: ${configPath}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
const rawConfig = fs.readFileSync(configPath, 'utf-8');
|
|
26
|
+
const cdecodeConfig = JSON.parse(rawConfig);
|
|
27
|
+
|
|
28
|
+
// 2) Run the orchestrated tasks
|
|
29
|
+
await runCodegenTasks(cdecodeConfig);
|
|
30
|
+
|
|
31
|
+
console.log('mainScript completed successfully!');
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error('Error running mainScript:', err);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
})();
|