@common-stack/generate-plugin 5.0.4-alpha.5 → 5.0.4-alpha.9

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/generators.json +4 -4
  3. package/lib/generators/add-frontend/generator.cjs +38 -0
  4. package/lib/generators/add-frontend/generator.cjs.map +1 -0
  5. package/lib/generators/add-frontend/generator.d.ts +4 -0
  6. package/lib/generators/add-frontend/generator.mjs +38 -0
  7. package/lib/generators/add-frontend/generator.mjs.map +1 -0
  8. package/lib/generators/add-frontend/schema.json +21 -0
  9. package/lib/generators/add-frontend/templates/Dockerfile +30 -0
  10. package/lib/generators/add-frontend/templates/codecept.json +28 -0
  11. package/lib/generators/add-frontend/templates/config.json +58 -0
  12. package/lib/generators/add-frontend/templates/env.d.ts.template +9 -0
  13. package/lib/generators/add-frontend/templates/env.js +5 -0
  14. package/lib/generators/add-frontend/templates/favicon.ico +0 -0
  15. package/lib/generators/add-frontend/templates/jest.config.js +33 -0
  16. package/lib/generators/add-frontend/templates/package.json +183 -0
  17. package/lib/generators/add-frontend/templates/public/css/dashboard.css +491 -0
  18. package/lib/generators/add-frontend/templates/public/favicon.ico +0 -0
  19. package/lib/generators/add-frontend/templates/server.js +78 -0
  20. package/lib/generators/add-frontend/templates/src/config/public-config.ts.template +82 -0
  21. package/lib/generators/add-frontend/templates/tools/mergeConfig.js +34 -0
  22. package/lib/generators/add-frontend/templates/tsconfig.base.json +38 -0
  23. package/lib/generators/add-frontend/templates/tsconfig.json +32 -0
  24. package/lib/generators/add-frontend/templates/tsconfig.node.json +10 -0
  25. package/lib/generators/add-frontend/templates/vite.config.ts.template +70 -0
  26. package/lib/index.cjs +1 -1
  27. package/lib/index.d.ts +1 -1
  28. package/lib/index.mjs +1 -1
  29. package/package.json +2 -2
  30. package/rollup.config.mjs +12 -5
  31. package/src/generators/{add-entries → add-frontend}/generator.spec.ts +5 -5
  32. package/src/generators/add-frontend/generator.ts +50 -0
  33. package/src/generators/add-frontend/schema.d.ts +5 -0
  34. package/src/generators/add-frontend/schema.json +21 -0
  35. package/src/index.ts +2 -2
  36. package/lib/generators/add-entries/generator.cjs +0 -55
  37. package/lib/generators/add-entries/generator.cjs.map +0 -1
  38. package/lib/generators/add-entries/generator.d.ts +0 -4
  39. package/lib/generators/add-entries/generator.mjs +0 -55
  40. package/lib/generators/add-entries/generator.mjs.map +0 -1
  41. package/lib/generators/add-entries/schema.json +0 -13
  42. package/src/generators/add-entries/files/common/AntStyles.tsx.template +0 -8
  43. package/src/generators/add-entries/files/common/createEmotionCache.ts.template +0 -7
  44. package/src/generators/add-entries/files/common/index.ts.template +0 -3
  45. package/src/generators/add-entries/files/common/utils.ts.template +0 -16
  46. package/src/generators/add-entries/generator.ts +0 -66
  47. package/src/generators/add-entries/schema.d.ts +0 -3
  48. package/src/generators/add-entries/schema.json +0 -13
  49. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/antui/entry.client.tsx.template +0 -0
  50. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/antui/entry.server.tsx.template +0 -0
  51. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/antui/root.tsx.template +0 -0
  52. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/context.tsx.template +0 -0
  53. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/entry.client.tsx.template +0 -0
  54. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/entry.server.tsx.template +0 -0
  55. /package/lib/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/root.tsx.template +0 -0
  56. /package/lib/generators/{add-entries → add-frontend}/generator.spec.d.ts +0 -0
  57. /package/lib/generators/{add-entries/files → add-frontend/templates/src}/common/AntStyles.tsx.template +0 -0
  58. /package/lib/generators/{add-entries/files → add-frontend/templates/src}/common/createEmotionCache.ts.template +0 -0
  59. /package/lib/generators/{add-entries/files → add-frontend/templates/src}/common/index.ts.template +0 -0
  60. /package/lib/generators/{add-entries/files → add-frontend/templates/src}/common/utils.ts.template +0 -0
  61. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/antui/entry.client.tsx.template +0 -0
  62. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/antui/entry.server.tsx.template +0 -0
  63. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/antui/root.tsx.template +0 -0
  64. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/context.tsx.template +0 -0
  65. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/entry.client.tsx.template +0 -0
  66. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/entry.server.tsx.template +0 -0
  67. /package/src/generators/{add-entries/entries → add-frontend/frameworks}/chakraui/root.tsx.template +0 -0
@@ -0,0 +1,491 @@
1
+ table {
2
+ background-color: transparent;
3
+ }
4
+ caption {
5
+ padding-top: 8px;
6
+ padding-bottom: 8px;
7
+ color: #777777;
8
+ text-align: left;
9
+ }
10
+ th {
11
+ text-align: left;
12
+ }
13
+ .table {
14
+ width: 100%;
15
+ max-width: 100%;
16
+ margin-bottom: 20px;
17
+ }
18
+ .table > thead > tr > th,
19
+ .table > tbody > tr > th,
20
+ .table > tfoot > tr > th,
21
+ .table > thead > tr > td,
22
+ .table > tbody > tr > td,
23
+ .table > tfoot > tr > td {
24
+ padding: 8px;
25
+ line-height: 1.42857143;
26
+ vertical-align: top;
27
+ border-top: 1px solid #dddddd;
28
+ }
29
+ .table > thead > tr > th {
30
+ vertical-align: bottom;
31
+ border-bottom: 2px solid #dddddd;
32
+ }
33
+ .table > caption + thead > tr:first-child > th,
34
+ .table > colgroup + thead > tr:first-child > th,
35
+ .table > thead:first-child > tr:first-child > th,
36
+ .table > caption + thead > tr:first-child > td,
37
+ .table > colgroup + thead > tr:first-child > td,
38
+ .table > thead:first-child > tr:first-child > td {
39
+ border-top: 0;
40
+ }
41
+ .table > tbody + tbody {
42
+ border-top: 2px solid #dddddd;
43
+ }
44
+ .table .table {
45
+ background-color: #ffffff;
46
+ }
47
+ .table-condensed > thead > tr > th,
48
+ .table-condensed > tbody > tr > th,
49
+ .table-condensed > tfoot > tr > th,
50
+ .table-condensed > thead > tr > td,
51
+ .table-condensed > tbody > tr > td,
52
+ .table-condensed > tfoot > tr > td {
53
+ padding: 5px;
54
+ }
55
+ .table-bordered {
56
+ border: 1px solid #dddddd;
57
+ }
58
+ .table-bordered > thead > tr > th,
59
+ .table-bordered > tbody > tr > th,
60
+ .table-bordered > tfoot > tr > th,
61
+ .table-bordered > thead > tr > td,
62
+ .table-bordered > tbody > tr > td,
63
+ .table-bordered > tfoot > tr > td {
64
+ border: 1px solid #dddddd;
65
+ }
66
+ .table-bordered > thead > tr > th,
67
+ .table-bordered > thead > tr > td {
68
+ border-bottom-width: 2px;
69
+ }
70
+ .table-striped > tbody > tr:nth-of-type(odd) {
71
+ background-color: #f9f9f9;
72
+ }
73
+ .table-hover > tbody > tr:hover {
74
+ background-color: #f5f5f5;
75
+ }
76
+ table col[class*="col-"] {
77
+ position: static;
78
+ float: none;
79
+ display: table-column;
80
+ }
81
+ table td[class*="col-"],
82
+ table th[class*="col-"] {
83
+ position: static;
84
+ float: none;
85
+ display: table-cell;
86
+ }
87
+ .table > thead > tr > td.active,
88
+ .table > tbody > tr > td.active,
89
+ .table > tfoot > tr > td.active,
90
+ .table > thead > tr > th.active,
91
+ .table > tbody > tr > th.active,
92
+ .table > tfoot > tr > th.active,
93
+ .table > thead > tr.active > td,
94
+ .table > tbody > tr.active > td,
95
+ .table > tfoot > tr.active > td,
96
+ .table > thead > tr.active > th,
97
+ .table > tbody > tr.active > th,
98
+ .table > tfoot > tr.active > th {
99
+ background-color: #f5f5f5;
100
+ }
101
+ .table-hover > tbody > tr > td.active:hover,
102
+ .table-hover > tbody > tr > th.active:hover,
103
+ .table-hover > tbody > tr.active:hover > td,
104
+ .table-hover > tbody > tr:hover > .active,
105
+ .table-hover > tbody > tr.active:hover > th {
106
+ background-color: #e8e8e8;
107
+ }
108
+ .table > thead > tr > td.success,
109
+ .table > tbody > tr > td.success,
110
+ .table > tfoot > tr > td.success,
111
+ .table > thead > tr > th.success,
112
+ .table > tbody > tr > th.success,
113
+ .table > tfoot > tr > th.success,
114
+ .table > thead > tr.success > td,
115
+ .table > tbody > tr.success > td,
116
+ .table > tfoot > tr.success > td,
117
+ .table > thead > tr.success > th,
118
+ .table > tbody > tr.success > th,
119
+ .table > tfoot > tr.success > th {
120
+ background-color: #dff0d8;
121
+ }
122
+ .table-hover > tbody > tr > td.success:hover,
123
+ .table-hover > tbody > tr > th.success:hover,
124
+ .table-hover > tbody > tr.success:hover > td,
125
+ .table-hover > tbody > tr:hover > .success,
126
+ .table-hover > tbody > tr.success:hover > th {
127
+ background-color: #d0e9c6;
128
+ }
129
+ .table > thead > tr > td.info,
130
+ .table > tbody > tr > td.info,
131
+ .table > tfoot > tr > td.info,
132
+ .table > thead > tr > th.info,
133
+ .table > tbody > tr > th.info,
134
+ .table > tfoot > tr > th.info,
135
+ .table > thead > tr.info > td,
136
+ .table > tbody > tr.info > td,
137
+ .table > tfoot > tr.info > td,
138
+ .table > thead > tr.info > th,
139
+ .table > tbody > tr.info > th,
140
+ .table > tfoot > tr.info > th {
141
+ background-color: #d9edf7;
142
+ }
143
+ .table-hover > tbody > tr > td.info:hover,
144
+ .table-hover > tbody > tr > th.info:hover,
145
+ .table-hover > tbody > tr.info:hover > td,
146
+ .table-hover > tbody > tr:hover > .info,
147
+ .table-hover > tbody > tr.info:hover > th {
148
+ background-color: #c4e3f3;
149
+ }
150
+ .table > thead > tr > td.warning,
151
+ .table > tbody > tr > td.warning,
152
+ .table > tfoot > tr > td.warning,
153
+ .table > thead > tr > th.warning,
154
+ .table > tbody > tr > th.warning,
155
+ .table > tfoot > tr > th.warning,
156
+ .table > thead > tr.warning > td,
157
+ .table > tbody > tr.warning > td,
158
+ .table > tfoot > tr.warning > td,
159
+ .table > thead > tr.warning > th,
160
+ .table > tbody > tr.warning > th,
161
+ .table > tfoot > tr.warning > th {
162
+ background-color: #fcf8e3;
163
+ }
164
+ .table-hover > tbody > tr > td.warning:hover,
165
+ .table-hover > tbody > tr > th.warning:hover,
166
+ .table-hover > tbody > tr.warning:hover > td,
167
+ .table-hover > tbody > tr:hover > .warning,
168
+ .table-hover > tbody > tr.warning:hover > th {
169
+ background-color: #faf2cc;
170
+ }
171
+ .table > thead > tr > td.danger,
172
+ .table > tbody > tr > td.danger,
173
+ .table > tfoot > tr > td.danger,
174
+ .table > thead > tr > th.danger,
175
+ .table > tbody > tr > th.danger,
176
+ .table > tfoot > tr > th.danger,
177
+ .table > thead > tr.danger > td,
178
+ .table > tbody > tr.danger > td,
179
+ .table > tfoot > tr.danger > td,
180
+ .table > thead > tr.danger > th,
181
+ .table > tbody > tr.danger > th,
182
+ .table > tfoot > tr.danger > th {
183
+ background-color: #f2dede;
184
+ }
185
+ .table-hover > tbody > tr > td.danger:hover,
186
+ .table-hover > tbody > tr > th.danger:hover,
187
+ .table-hover > tbody > tr.danger:hover > td,
188
+ .table-hover > tbody > tr:hover > .danger,
189
+ .table-hover > tbody > tr.danger:hover > th {
190
+ background-color: #ebcccc;
191
+ }
192
+ .table-responsive {
193
+ overflow-x: auto;
194
+ min-height: 0.01%;
195
+ }
196
+ @media screen and (max-width: 767px) {
197
+ .table-responsive {
198
+ width: 100%;
199
+ margin-bottom: 15px;
200
+ overflow-y: hidden;
201
+ -ms-overflow-style: -ms-autohiding-scrollbar;
202
+ border: 1px solid #dddddd;
203
+ }
204
+ .table-responsive > .table {
205
+ margin-bottom: 0;
206
+ }
207
+ .table-responsive > .table > thead > tr > th,
208
+ .table-responsive > .table > tbody > tr > th,
209
+ .table-responsive > .table > tfoot > tr > th,
210
+ .table-responsive > .table > thead > tr > td,
211
+ .table-responsive > .table > tbody > tr > td,
212
+ .table-responsive > .table > tfoot > tr > td {
213
+ white-space: nowrap;
214
+ }
215
+ .table-responsive > .table-bordered {
216
+ border: 0;
217
+ }
218
+ .table-responsive > .table-bordered > thead > tr > th:first-child,
219
+ .table-responsive > .table-bordered > tbody > tr > th:first-child,
220
+ .table-responsive > .table-bordered > tfoot > tr > th:first-child,
221
+ .table-responsive > .table-bordered > thead > tr > td:first-child,
222
+ .table-responsive > .table-bordered > tbody > tr > td:first-child,
223
+ .table-responsive > .table-bordered > tfoot > tr > td:first-child {
224
+ border-left: 0;
225
+ }
226
+ .table-responsive > .table-bordered > thead > tr > th:last-child,
227
+ .table-responsive > .table-bordered > tbody > tr > th:last-child,
228
+ .table-responsive > .table-bordered > tfoot > tr > th:last-child,
229
+ .table-responsive > .table-bordered > thead > tr > td:last-child,
230
+ .table-responsive > .table-bordered > tbody > tr > td:last-child,
231
+ .table-responsive > .table-bordered > tfoot > tr > td:last-child {
232
+ border-right: 0;
233
+ }
234
+ .table-responsive > .table-bordered > tbody > tr:last-child > th,
235
+ .table-responsive > .table-bordered > tfoot > tr:last-child > th,
236
+ .table-responsive > .table-bordered > tbody > tr:last-child > td,
237
+ .table-responsive > .table-bordered > tfoot > tr:last-child > td {
238
+ border-bottom: 0;
239
+ }
240
+ }
241
+ .clearfix:before,
242
+ .clearfix:after {
243
+ content: " ";
244
+ display: table;
245
+ }
246
+ .clearfix:after {
247
+ clear: both;
248
+ }
249
+ .center-block {
250
+ display: block;
251
+ margin-left: auto;
252
+ margin-right: auto;
253
+ }
254
+ .pull-right {
255
+ float: right !important;
256
+ }
257
+ .pull-left {
258
+ float: left !important;
259
+ }
260
+ .hide {
261
+ display: none !important;
262
+ }
263
+ .show {
264
+ display: block !important;
265
+ }
266
+ .invisible {
267
+ visibility: hidden;
268
+ }
269
+ .text-hide {
270
+ font: 0/0 a;
271
+ color: transparent;
272
+ text-shadow: none;
273
+ background-color: transparent;
274
+ border: 0;
275
+ }
276
+ .hidden {
277
+ display: none !important;
278
+ }
279
+ .affix {
280
+ position: fixed;
281
+ }
282
+ @-ms-viewport {
283
+ width: device-width;
284
+ }
285
+ .visible-xs,
286
+ .visible-sm,
287
+ .visible-md,
288
+ .visible-lg {
289
+ display: none !important;
290
+ }
291
+ .visible-xs-block,
292
+ .visible-xs-inline,
293
+ .visible-xs-inline-block,
294
+ .visible-sm-block,
295
+ .visible-sm-inline,
296
+ .visible-sm-inline-block,
297
+ .visible-md-block,
298
+ .visible-md-inline,
299
+ .visible-md-inline-block,
300
+ .visible-lg-block,
301
+ .visible-lg-inline,
302
+ .visible-lg-inline-block {
303
+ display: none !important;
304
+ }
305
+ @media (max-width: 767px) {
306
+ .visible-xs {
307
+ display: block !important;
308
+ }
309
+ table.visible-xs {
310
+ display: table !important;
311
+ }
312
+ tr.visible-xs {
313
+ display: table-row !important;
314
+ }
315
+ th.visible-xs,
316
+ td.visible-xs {
317
+ display: table-cell !important;
318
+ }
319
+ }
320
+ @media (max-width: 767px) {
321
+ .visible-xs-block {
322
+ display: block !important;
323
+ }
324
+ }
325
+ @media (max-width: 767px) {
326
+ .visible-xs-inline {
327
+ display: inline !important;
328
+ }
329
+ }
330
+ @media (max-width: 767px) {
331
+ .visible-xs-inline-block {
332
+ display: inline-block !important;
333
+ }
334
+ }
335
+ @media (min-width: 768px) and (max-width: 991px) {
336
+ .visible-sm {
337
+ display: block !important;
338
+ }
339
+ table.visible-sm {
340
+ display: table !important;
341
+ }
342
+ tr.visible-sm {
343
+ display: table-row !important;
344
+ }
345
+ th.visible-sm,
346
+ td.visible-sm {
347
+ display: table-cell !important;
348
+ }
349
+ }
350
+ @media (min-width: 768px) and (max-width: 991px) {
351
+ .visible-sm-block {
352
+ display: block !important;
353
+ }
354
+ }
355
+ @media (min-width: 768px) and (max-width: 991px) {
356
+ .visible-sm-inline {
357
+ display: inline !important;
358
+ }
359
+ }
360
+ @media (min-width: 768px) and (max-width: 991px) {
361
+ .visible-sm-inline-block {
362
+ display: inline-block !important;
363
+ }
364
+ }
365
+ @media (min-width: 992px) and (max-width: 1199px) {
366
+ .visible-md {
367
+ display: block !important;
368
+ }
369
+ table.visible-md {
370
+ display: table !important;
371
+ }
372
+ tr.visible-md {
373
+ display: table-row !important;
374
+ }
375
+ th.visible-md,
376
+ td.visible-md {
377
+ display: table-cell !important;
378
+ }
379
+ }
380
+ @media (min-width: 992px) and (max-width: 1199px) {
381
+ .visible-md-block {
382
+ display: block !important;
383
+ }
384
+ }
385
+ @media (min-width: 992px) and (max-width: 1199px) {
386
+ .visible-md-inline {
387
+ display: inline !important;
388
+ }
389
+ }
390
+ @media (min-width: 992px) and (max-width: 1199px) {
391
+ .visible-md-inline-block {
392
+ display: inline-block !important;
393
+ }
394
+ }
395
+ @media (min-width: 1200px) {
396
+ .visible-lg {
397
+ display: block !important;
398
+ }
399
+ table.visible-lg {
400
+ display: table !important;
401
+ }
402
+ tr.visible-lg {
403
+ display: table-row !important;
404
+ }
405
+ th.visible-lg,
406
+ td.visible-lg {
407
+ display: table-cell !important;
408
+ }
409
+ }
410
+ @media (min-width: 1200px) {
411
+ .visible-lg-block {
412
+ display: block !important;
413
+ }
414
+ }
415
+ @media (min-width: 1200px) {
416
+ .visible-lg-inline {
417
+ display: inline !important;
418
+ }
419
+ }
420
+ @media (min-width: 1200px) {
421
+ .visible-lg-inline-block {
422
+ display: inline-block !important;
423
+ }
424
+ }
425
+ @media (max-width: 767px) {
426
+ .hidden-xs {
427
+ display: none !important;
428
+ }
429
+ }
430
+ @media (min-width: 768px) and (max-width: 991px) {
431
+ .hidden-sm {
432
+ display: none !important;
433
+ }
434
+ }
435
+ @media (min-width: 992px) and (max-width: 1199px) {
436
+ .hidden-md {
437
+ display: none !important;
438
+ }
439
+ }
440
+ @media (min-width: 1200px) {
441
+ .hidden-lg {
442
+ display: none !important;
443
+ }
444
+ }
445
+ .visible-print {
446
+ display: none !important;
447
+ }
448
+ @media print {
449
+ .visible-print {
450
+ display: block !important;
451
+ }
452
+ table.visible-print {
453
+ display: table !important;
454
+ }
455
+ tr.visible-print {
456
+ display: table-row !important;
457
+ }
458
+ th.visible-print,
459
+ td.visible-print {
460
+ display: table-cell !important;
461
+ }
462
+ }
463
+ .visible-print-block {
464
+ display: none !important;
465
+ }
466
+ @media print {
467
+ .visible-print-block {
468
+ display: block !important;
469
+ }
470
+ }
471
+ .visible-print-inline {
472
+ display: none !important;
473
+ }
474
+ @media print {
475
+ .visible-print-inline {
476
+ display: inline !important;
477
+ }
478
+ }
479
+ .visible-print-inline-block {
480
+ display: none !important;
481
+ }
482
+ @media print {
483
+ .visible-print-inline-block {
484
+ display: inline-block !important;
485
+ }
486
+ }
487
+ @media print {
488
+ .hidden-print {
489
+ display: none !important;
490
+ }
491
+ }
@@ -0,0 +1,78 @@
1
+ import express from 'express';
2
+ import compression from 'compression';
3
+ import { createRequestHandler } from '@remix-run/express';
4
+ import { installGlobals } from '@remix-run/node';
5
+ import './env.js';
6
+ import {
7
+ performCopyOperations,
8
+ } from '@common-stack/rollup-vite-utils/lib/preStartup/configLoader/configLoader.js';
9
+ import config from './app/cde-webconfig.json' assert { type: 'json' };
10
+
11
+ installGlobals();
12
+
13
+ Object.keys(config.buildConfig).forEach((key) => {
14
+ global[key] = config.buildConfig[key];
15
+ });
16
+
17
+ const startServer = async () => {
18
+ await performCopyOperations(config);
19
+
20
+ const { corsMiddleware } = await import(`./${config.commonPaths.appPath}/${config.commonPaths.frontendStackPath}/backend/middlewares/cors.js`);
21
+ const { containerMiddleware } = await import(`./${config.commonPaths.appPath}/${config.commonPaths.frontendStackPath}/backend/middlewares/container.js`);
22
+ const { loadContext } = await import(`./${config.commonPaths.appPath}/${config.commonPaths.frontendStackPath}/load-context.server.js`);
23
+
24
+ const viteDevServer =
25
+ process.env.NODE_ENV === 'production'
26
+ ? undefined
27
+ : await import('vite').then((vite) => {
28
+ return vite.createServer({
29
+ server: { middlewareMode: true },
30
+ });
31
+ });
32
+
33
+ const remixHandler = createRequestHandler({
34
+ getLoadContext: loadContext,
35
+ build: viteDevServer
36
+ ? () => viteDevServer.ssrLoadModule('virtual:remix/server-build')
37
+ : await import('./build/server/index.js'),
38
+ });
39
+
40
+ const app = express();
41
+
42
+ app.use(compression());
43
+ app.disable('x-powered-by');
44
+
45
+ if (viteDevServer) {
46
+ app.use(viteDevServer.middlewares);
47
+ } else {
48
+ app.use('/assets', express.static('build/client/assets', { immutable: true, maxAge: '1y' }));
49
+ }
50
+
51
+ app.use(express.static('build/client', { maxAge: '1h' }));
52
+
53
+ app.use(corsMiddleware);
54
+ app.options('*', corsMiddleware);
55
+
56
+ app.use(async (req, res, next) => {
57
+ let isAssetRequest = (url) =>
58
+ /\.[jt]sx?$/.test(url) ||
59
+ /@id\/__x00__virtual:/.test(url) ||
60
+ /@vite\/client/.test(url) ||
61
+ /node_modules\/vite\/dist\/client\/env/.test(url);
62
+
63
+ if (isAssetRequest(req.url)) {
64
+ next();
65
+ } else {
66
+ return await containerMiddleware(req, res, async () => {
67
+ return remixHandler(req, res, next);
68
+ });
69
+ }
70
+ });
71
+
72
+ const port = process.env.PORT || 3000;
73
+ app.listen(port, () => console.log(`Express server listening at http://localhost:${port}`));
74
+ };
75
+
76
+ startServer().catch((err) => {
77
+ console.error('Failed to start server:', err);
78
+ });
@@ -0,0 +1,82 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
2
+ /* eslint-disable no-underscore-dangle */
3
+ /* eslint-disable no-restricted-syntax */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
5
+ /* eslint-disable @typescript-eslint/triple-slash-reference */
6
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
7
+ /// <reference path='../../../../typings/index.d.ts' />
8
+ import { logger } from '@cdm-logger/client';
9
+ import { lowerCase } from 'lodash-es';
10
+ /**
11
+ * This file opens up in public site, so make sure it is
12
+ * not dependent on any other file that compromises the security.
13
+ * hello
14
+ */
15
+ const publicEnv = [
16
+ 'NODE_ENV',
17
+ 'APP_URL',
18
+ 'GA_ID',
19
+ 'GRAPHQL_URL',
20
+ 'LOG_LEVEL',
21
+ 'AUTH0_CLIENT_ID',
22
+ 'AUTH0_DOMAIN',
23
+ 'AUTH0_CUSTOM_DOMAIN',
24
+ 'CLIENT_URL',
25
+ 'APP_NAME',
26
+ 'AUTH0_API_AUDIENCE',
27
+ 'AUTH0_REALM',
28
+ 'PAYPAL_ENVIRONMENT',
29
+ 'STRIPE_PUBLISHABLE_KEY',
30
+ 'AUTH0_TOKEN_GRANTED_TIME',
31
+ 'AUTH0_CUSTOM_CLAIMS_NAMESPACE',
32
+ 'INITIAL_ACCOUNT_PAGE',
33
+ 'SOCIAL_LOGIN_PROVIDERS',
34
+ 'CALLBACK_REDIRECT_URL',
35
+ 'POPUP_REDIRECT_URL',
36
+ 'LAYOUT_SETTINGS',
37
+ 'DEFAULT_EXTENDED_RENEWAL_TIME',
38
+ 'DISABLE_EMAIL_VERIFICATION',
39
+ 'WEB_APP_URL',
40
+ 'LOGOUT_REDIRECT_PATH',
41
+ 'LOGIN_REDIRECT_PATH',
42
+ 'REDIRECT_ON_LOGIN_VISIT',
43
+ 'ENABLE_COOKIE_BASED_AUTH',
44
+ 'APP_DOMAIN',
45
+ 'AUTH_ID_TOKEN_COOKIE_MAX_AGE'
46
+ ];
47
+
48
+ const isBrowser = typeof window !== 'undefined';
49
+
50
+ const base = (isBrowser ? window.__ENV__ || (typeof __ENV__ !== 'undefined' && __ENV__) : process.env) || {};
51
+ const env: any = {};
52
+ for (const v of publicEnv) {
53
+ env[v] = base[v];
54
+ }
55
+
56
+ // add subscription url for temporary
57
+ export default env;
58
+
59
+ if (isBrowser) {
60
+ // process[lowerCase('env')] = env; // to avoid webpack to replace `process` with actual value.
61
+ // process.APP_ENV = env;
62
+ const process: any = {};
63
+ process[lowerCase('env')] = env; // to avoid webpack to replace `process` with actual value.
64
+ process.APP_ENV = env;
65
+ window.process = process;
66
+ window.__CLIENT__ = true;
67
+ window.__SERVER__ = false;
68
+ } else {
69
+ global.__CLIENT__ = false;
70
+ global.__SERVER__ = true;
71
+ __CLIENT__ = false;
72
+ __SERVER__ = true;
73
+ }
74
+ try {
75
+ // global.process = process;
76
+ logger.info('Process Update Success!');
77
+ } catch (e) {
78
+ logger.warn(e);
79
+ logger.info(
80
+ 'Encountered above issue while running "global.process = process", will automatically try again in next render',
81
+ );
82
+ }
@@ -0,0 +1,34 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { setupConfig } from '@common-stack/rollup-vite-utils/lib/utils/setupConfig.js';
4
+ import projectConfig from '../config.json' assert { type: 'json' };
5
+
6
+ // Function to merge configurations
7
+ const mergeConfigs = setupConfig(projectConfig);
8
+
9
+ // Ensure the 'app' directory exists
10
+ const appDir = path.resolve('app');
11
+ if (!fs.existsSync(appDir)) {
12
+ fs.mkdirSync(appDir);
13
+ console.log(`Created directory: ${appDir}`);
14
+ }
15
+
16
+ // Write the merged configuration to 'app/finalConfig.json'
17
+ const finalConfigPath = path.resolve(appDir, 'cde-webconfig.json');
18
+ fs.writeFileSync(finalConfigPath, JSON.stringify(mergeConfigs, null, 2));
19
+ console.log(`Merged configuration written to ${finalConfigPath}`);
20
+
21
+ // Add 'app' to .gitignore if not already present
22
+ const gitignorePath = path.resolve('.gitignore');
23
+ let gitignoreContent = '';
24
+ if (fs.existsSync(gitignorePath)) {
25
+ gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
26
+ } else {
27
+ fs.writeFileSync(gitignorePath, '');
28
+ console.log('Created .gitignore file');
29
+ }
30
+
31
+ if (!gitignoreContent.includes('app')) {
32
+ fs.appendFileSync(gitignorePath, '\napp\n');
33
+ console.log('Added "app" to .gitignore');
34
+ }