@common-stack/generate-plugin 6.0.8-alpha.5 → 6.0.8-alpha.50
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 +184 -4
- 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 +3 -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 +31 -18
- 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/Dockerfile +2 -0
- package/src/generators/add-moleculer/files/config.json +5 -0
- package/src/generators/add-moleculer/files/package.json +10 -6
- 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
|
@@ -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
|
+
}
|
|
@@ -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": "6.0.8-alpha.
|
|
150
|
-
"@common-stack/generate-plugin": "6.0.8-alpha.
|
|
151
|
-
"@common-stack/rollup-vite-utils": "6.0.8-alpha.
|
|
152
|
+
"@common-stack/env-list-loader": "6.0.8-alpha.31",
|
|
153
|
+
"@common-stack/generate-plugin": "6.0.8-alpha.49",
|
|
154
|
+
"@common-stack/rollup-vite-utils": "6.0.8-alpha.48",
|
|
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
|
+
})();
|
|
@@ -24,11 +24,15 @@ import {
|
|
|
24
24
|
} from '../../index';
|
|
25
25
|
|
|
26
26
|
export async function addFullstackGenerator(tree: Tree, options: AddFullstackGeneratorSchema) {
|
|
27
|
-
|
|
27
|
+
let projectPath = options.path || '';
|
|
28
|
+
if (projectPath !== '') {
|
|
29
|
+
const basePath = process.cwd();
|
|
30
|
+
projectPath = path.relative(basePath, projectPath);
|
|
31
|
+
}
|
|
28
32
|
const projectName = getValid(options.name) ?? 'fullstack-pro';
|
|
29
|
-
const projectRoot = path.join(
|
|
33
|
+
const projectRoot = path.join(projectPath, projectName);
|
|
30
34
|
|
|
31
|
-
console.log(`
|
|
35
|
+
// console.log(`Project Path: ${projectPath}`);
|
|
32
36
|
|
|
33
37
|
// backup existing lerna values
|
|
34
38
|
const lernaBackup = backupLernaJson(tree, projectRoot);
|
|
@@ -59,7 +63,7 @@ export async function addFullstackGenerator(tree: Tree, options: AddFullstackGen
|
|
|
59
63
|
await formatFiles(tree);
|
|
60
64
|
|
|
61
65
|
if (isValid(options.config)) {
|
|
62
|
-
const configPath = path.resolve(
|
|
66
|
+
const configPath = path.resolve(projectPath, getValid(options.config));
|
|
63
67
|
if (fs.existsSync(configPath)) {
|
|
64
68
|
try {
|
|
65
69
|
const configs = JSON.parse(fs.readFileSync(configPath).toString());
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"path": {
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "The base path where the project will be created or updated",
|
|
19
|
-
"x-prompt": "Where do you want to create or update the project? (
|
|
19
|
+
"x-prompt": "Where do you want to create or update the project? (Please provide in absolute path, or leave empty for the current directory)"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"required": ["name"]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
FROM node:20.16-alpine
|
|
2
2
|
|
|
3
3
|
COPY .npmrc package.json /tmp/
|
|
4
|
+
COPY common /tmp/common
|
|
4
5
|
|
|
5
6
|
RUN set -ex \
|
|
6
7
|
&& apk add --no-cache \
|
|
@@ -13,6 +14,7 @@ RUN set -ex \
|
|
|
13
14
|
&& rm -f /tmp/.npmrc \
|
|
14
15
|
&& mkdir -p /home/app \
|
|
15
16
|
&& cp -a /tmp/node_modules /home/app/ \
|
|
17
|
+
&& cp -a /tmp/common /home/app/common \
|
|
16
18
|
&& rm -Rf /tmp/*
|
|
17
19
|
|
|
18
20
|
WORKDIR /home/app
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"build:clean": "rimraf dist",
|
|
13
13
|
"build:dist": "rollup -c rollup.config.mjs",
|
|
14
14
|
"build:watch": "npm run build:dist -- --watch",
|
|
15
|
-
"
|
|
15
|
+
"copycommon": "cp -r ../../packages/common .",
|
|
16
|
+
"docker:build": "yarn copycommon && npm run build && docker build . -t $npm_package_name:$npm_package_version",
|
|
16
17
|
"docker:run": "docker run -it --env-file ../../config/staging/docker-staging.env $npm_package_name:$npm_package_version",
|
|
17
18
|
"jest": "./node_modules/.bin/jest",
|
|
18
19
|
"start": "cross-env NODE_ENV=production tsx dist/index.js",
|
|
@@ -24,12 +25,15 @@
|
|
|
24
25
|
"test:watch": "npm test -- --watch",
|
|
25
26
|
"watch": "npm run start:dev"
|
|
26
27
|
},
|
|
28
|
+
"resolutions": {
|
|
29
|
+
"common": "link:./common"
|
|
30
|
+
},
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"@common-stack/client-core": "6.0.8-alpha.
|
|
29
|
-
"@common-stack/core": "6.0.8-alpha.
|
|
30
|
-
"@common-stack/server-core": "6.0.8-alpha.
|
|
31
|
-
"@common-stack/server-stack": "6.0.8-alpha.
|
|
32
|
-
"@common-stack/store-mongo": "6.0.8-alpha.
|
|
32
|
+
"@common-stack/client-core": "6.0.8-alpha.31",
|
|
33
|
+
"@common-stack/core": "6.0.8-alpha.31",
|
|
34
|
+
"@common-stack/server-core": "6.0.8-alpha.31",
|
|
35
|
+
"@common-stack/server-stack": "6.0.8-alpha.32",
|
|
36
|
+
"@common-stack/store-mongo": "6.0.8-alpha.31",
|
|
33
37
|
"@container-stack/mailing-api": "5.2.1-alpha.1",
|
|
34
38
|
"helmet": "^3.21.2",
|
|
35
39
|
"react": "18.2.0",
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import graphql from '@rollup/plugin-graphql';
|
|
2
2
|
import typescript from '@rollup/plugin-typescript';
|
|
3
3
|
import { string } from 'rollup-plugin-string';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { writeBackendModuleFile } from '@common-stack/rollup-vite-utils';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
// Write backend module file before bundling
|
|
12
|
+
try {
|
|
13
|
+
const packageConfig = await import('./config.json', { assert: { type: 'json' } });
|
|
14
|
+
await writeBackendModuleFile(path.join(__dirname, 'src/modules'), packageConfig.default);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.error('Error writing backend module file:', e);
|
|
17
|
+
}
|
|
4
18
|
|
|
5
19
|
const bundle = (config) => ({
|
|
6
20
|
...config,
|
|
7
21
|
input: 'src/index.ts',
|
|
8
|
-
// marking all node modules as external
|
|
9
22
|
external: (id) => !/^[./]/.test(id),
|
|
10
23
|
});
|
|
11
24
|
|