@common-stack/generate-plugin 6.0.6-alpha.31 → 6.0.6-alpha.33

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.0.6-alpha.33](https://github.com/cdmbase/common-stack/compare/v6.0.6-alpha.32...v6.0.6-alpha.33) (2024-09-23)
7
+
8
+ **Note:** Version bump only for package @common-stack/generate-plugin
9
+
10
+ ## [6.0.6-alpha.32](https://github.com/cdmbase/common-stack/compare/v6.0.6-alpha.31...v6.0.6-alpha.32) (2024-09-22)
11
+
12
+ **Note:** Version bump only for package @common-stack/generate-plugin
13
+
6
14
  ## [6.0.6-alpha.31](https://github.com/cdmbase/common-stack/compare/v6.0.6-alpha.30...v6.0.6-alpha.31) (2024-09-21)
7
15
 
8
16
  **Note:** Version bump only for package @common-stack/generate-plugin
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@apollo/client": "^3.9.0",
64
64
  "@babel/runtime": "^7.20.1",
65
- "@common-stack/server-stack": "6.0.6-alpha.29",
65
+ "@common-stack/server-stack": "6.0.6-alpha.32",
66
66
  "@container-stack/mailing-api-server": "^5.2.1-alpha.2",
67
67
  "@container-stack/territory": "^5.2.1-alpha.2",
68
68
  "@remix-run/node": "~2.10.1",
@@ -14,24 +14,62 @@ import config from './app/cde-webconfig.json' assert { type: 'json' };
14
14
 
15
15
  // This installs globals such as "fetch", "Response", "Request" and "Headers".
16
16
  installGlobals();
17
+
17
18
  const directoryName = dirname(fileURLToPath(import.meta.url));
18
19
 
19
- export default defineConfig(({ isSsrBuild }) => {
20
- console.log('---IS SSR BUILD', isSsrBuild);
20
+ export default defineConfig(async ({ isSsrBuild }) => {
21
+ console.log('--- IS SSR BUILD:', isSsrBuild);
21
22
 
23
+ // Load environment variables from dotenv or other config
22
24
  const dotEnvResult = loadEnvConfig(directoryName);
23
25
 
26
+ // Define environment variables for Vite
27
+ const envVariables = {
28
+ __ENV__: JSON.stringify(dotEnvResult?.parsed),
29
+ __SERVER__: true,
30
+ __CLIENT__: false,
31
+ ...Object.fromEntries(
32
+ Object.entries(config.buildConfig).map(([key, value]) => [
33
+ key,
34
+ typeof value === 'string' ? `"${value.replace(/\\/g, '\\\\')}"` : value,
35
+ ])
36
+ ),
37
+ };
38
+
39
+ // Define routes configuration
40
+ const routesConfig = async (defineRoutes) => {
41
+ // In production, perform required file copy operations
42
+ if (process.env.NODE_ENV === 'production') {
43
+ await performCopyOperations(config);
44
+ }
45
+
46
+ // Load metadata for routes
47
+ let metaJson = null;
48
+ try {
49
+ metaJson = await import('./app/sync-meta.json');
50
+ } catch {
51
+ console.warn('No sync-meta.json found, continuing without metadata.');
52
+ }
53
+
54
+ // Return routes definition
55
+ return defineRoutes((routeFn) =>
56
+ defineRoutesConfig(
57
+ routeFn,
58
+ {
59
+ routesFileName: 'routes.json',
60
+ packages: config.modules,
61
+ paths: config.paths,
62
+ iconsRepository: config?.iconsRepository,
63
+ rootPath: resolve(directoryName, '../..'),
64
+ },
65
+ metaJson
66
+ )
67
+ );
68
+ };
69
+
70
+ // Vite configuration
24
71
  const viteConfig = {
25
- define: {
26
- __ENV__: JSON.stringify(dotEnvResult?.parsed),
27
- ...Object.assign(
28
- ...Object.entries(config.buildConfig).map(([k, v]) => ({
29
- [k]: typeof v !== 'string' ? v : `"${v.replace(/\\/g, '\\\\')}"`,
30
- __SERVER__: true,
31
- __CLIENT__: false,
32
- }))
33
- ),
34
- },
72
+ define: envVariables,
35
73
  plugins: [
36
74
  i18nInternationalizationPlugin({
37
75
  folderName: 'cdm-locales',
@@ -43,31 +81,14 @@ export default defineConfig(({ isSsrBuild }) => {
43
81
  }),
44
82
  remix({
45
83
  appDirectory: 'src',
46
- routes: async (defineRoutes) => {
47
- if (process.env.NODE_ENV === 'production') {
48
- await performCopyOperations(config);
49
- }
50
- const metaJson = await import('./app/sync-meta.json').catch(() => null);
51
- return defineRoutes((routeFn) => {
52
- defineRoutesConfig(
53
- routeFn,
54
- {
55
- routesFileName: 'routes.json',
56
- packages: config.modules,
57
- paths: config.paths,
58
- rootPath: resolve(directoryName, '../..'),
59
- },
60
- metaJson,
61
- );
62
- });
63
- },
84
+ routes: routesConfig,
64
85
  }),
65
86
  tsconfigPaths({ ignoreConfigErrors: true }),
66
87
  ],
67
88
  resolve: {
68
89
  alias: {
69
- '@app': resolve(__dirname, 'app'),
70
- '@src': resolve(__dirname, 'src'),
90
+ '@app': resolve(directoryName, 'app'),
91
+ '@src': resolve(directoryName, 'src'),
71
92
  },
72
93
  },
73
94
  };
@@ -147,7 +147,7 @@
147
147
  "@babel/register": "^7.18.9",
148
148
  "@babel/runtime": "^7.20.1",
149
149
  "@common-stack/env-list-loader": "6.0.6-alpha.5",
150
- "@common-stack/generate-plugin": "6.0.6-alpha.30",
150
+ "@common-stack/generate-plugin": "6.0.6-alpha.32",
151
151
  "@emotion/babel-plugin": "^11.11.0",
152
152
  "@graphql-codegen/add": "^5.0.2",
153
153
  "@graphql-codegen/cli": "^5.0.2",
@@ -28,7 +28,7 @@
28
28
  "@common-stack/client-core": "6.0.6-alpha.5",
29
29
  "@common-stack/core": "6.0.6-alpha.5",
30
30
  "@common-stack/server-core": "6.0.6-alpha.5",
31
- "@common-stack/server-stack": "6.0.6-alpha.29",
31
+ "@common-stack/server-stack": "6.0.6-alpha.32",
32
32
  "@common-stack/store-mongo": "6.0.6-alpha.5",
33
33
  "@container-stack/mailing-api": "5.2.1-alpha.1",
34
34
  "helmet": "^3.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-stack/generate-plugin",
3
- "version": "6.0.6-alpha.31",
3
+ "version": "6.0.6-alpha.33",
4
4
  "type": "module",
5
5
  "main": "./lib/index.mjs",
6
6
  "typings": "./lib/index.d.ts",
@@ -25,5 +25,5 @@
25
25
  },
26
26
  "executors": "./executors.json",
27
27
  "generators": "./generators.json",
28
- "gitHead": "3e8b7cac83f175f732065c880f51f4446b888f11"
28
+ "gitHead": "8d1c6739801354b363d5e9b858527892927ec548"
29
29
  }
@@ -147,7 +147,7 @@
147
147
  "@babel/register": "^7.18.9",
148
148
  "@babel/runtime": "^7.20.1",
149
149
  "@common-stack/env-list-loader": "6.0.6-alpha.5",
150
- "@common-stack/generate-plugin": "6.0.6-alpha.30",
150
+ "@common-stack/generate-plugin": "6.0.6-alpha.32",
151
151
  "@emotion/babel-plugin": "^11.11.0",
152
152
  "@graphql-codegen/add": "^5.0.2",
153
153
  "@graphql-codegen/cli": "^5.0.2",
@@ -28,7 +28,7 @@
28
28
  "@common-stack/client-core": "6.0.6-alpha.5",
29
29
  "@common-stack/core": "6.0.6-alpha.5",
30
30
  "@common-stack/server-core": "6.0.6-alpha.5",
31
- "@common-stack/server-stack": "6.0.6-alpha.29",
31
+ "@common-stack/server-stack": "6.0.6-alpha.32",
32
32
  "@common-stack/store-mongo": "6.0.6-alpha.5",
33
33
  "@container-stack/mailing-api": "5.2.1-alpha.1",
34
34
  "helmet": "^3.21.2",