@common-stack/generate-plugin 6.0.8-alpha.4 → 6.0.8-alpha.40
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 +148 -4
- package/docker-releases/backend/package.json +6 -7
- package/docker-releases/frontend/antd/package.json +7 -7
- package/lib/generators/add-backend/files/Dockerfile +2 -0
- package/lib/generators/add-backend/files/package.json +2 -1
- package/lib/generators/add-backend/files/webpack.config.js +3 -1
- package/lib/generators/add-frontend/frameworks/antui/context.tsx.template +8 -0
- package/lib/generators/add-frontend/frameworks/antui/entry.client.tsx.template +9 -2
- package/lib/generators/add-frontend/frameworks/antui/entry.server.tsx.template +60 -51
- package/lib/generators/add-frontend/frameworks/antui/root.tsx.template +7 -11
- package/lib/generators/add-frontend/frameworks/chakraui/context.tsx.template +6 -0
- package/lib/generators/add-frontend/frameworks/chakraui/entry.client.tsx.template +23 -15
- package/lib/generators/add-frontend/frameworks/chakraui/entry.server.tsx.template +33 -30
- package/lib/generators/add-frontend/frameworks/chakraui/root.tsx.template +8 -4
- package/lib/generators/add-frontend/templates/Dockerfile +4 -0
- package/lib/generators/add-frontend/templates/package.json +5 -2
- package/lib/generators/add-frontend/templates/vite.config.ts.template +3 -0
- package/lib/generators/add-fullstack/files/cdecode-config.json +109 -0
- package/lib/generators/add-fullstack/files/package.json +17 -7
- 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-moleculer/files/Dockerfile +2 -0
- package/lib/generators/add-moleculer/files/config.json +5 -0
- package/lib/generators/add-moleculer/files/package.json +8 -5
- package/lib/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/package.json +3 -3
- package/src/generators/add-frontend/frameworks/antui/context.tsx.template +8 -0
- package/src/generators/add-frontend/frameworks/antui/entry.client.tsx.template +9 -2
- package/src/generators/add-frontend/frameworks/antui/entry.server.tsx.template +60 -51
- package/src/generators/add-frontend/frameworks/antui/root.tsx.template +7 -11
- package/src/generators/add-frontend/frameworks/chakraui/context.tsx.template +6 -0
- package/src/generators/add-frontend/frameworks/chakraui/entry.client.tsx.template +23 -15
- package/src/generators/add-frontend/frameworks/chakraui/entry.server.tsx.template +33 -30
- package/src/generators/add-frontend/frameworks/chakraui/root.tsx.template +8 -4
- package/src/generators/add-fullstack/files/cdecode-config.json +109 -0
- package/src/generators/add-fullstack/files/package.json +17 -7
- 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-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 +8 -5
- package/src/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/lib/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
- package/src/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
|
@@ -52,7 +52,9 @@
|
|
|
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)",
|
|
@@ -105,9 +107,11 @@
|
|
|
105
107
|
},
|
|
106
108
|
"resolutions": {
|
|
107
109
|
"@apollo/client": "^3.9.0",
|
|
108
|
-
"@types/react": "^18.
|
|
109
|
-
"@types/react-dom": "^18.
|
|
110
|
+
"@types/react": "^18.2.25",
|
|
111
|
+
"@types/react-dom": "^18.2.7",
|
|
112
|
+
"common": "link:packages/common",
|
|
110
113
|
"html-to-text": "^8.0.0",
|
|
114
|
+
"lerna": "8.1.8",
|
|
111
115
|
"react": "18.3.0-canary-c3048aab4-20240326",
|
|
112
116
|
"react-dom": "18.3.0-canary-c3048aab4-20240326",
|
|
113
117
|
"react-native": "0.72.10",
|
|
@@ -146,9 +150,9 @@
|
|
|
146
150
|
"@babel/preset-typescript": "^7.18.6",
|
|
147
151
|
"@babel/register": "^7.18.9",
|
|
148
152
|
"@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.
|
|
153
|
+
"@common-stack/env-list-loader": "6.0.8-alpha.31",
|
|
154
|
+
"@common-stack/generate-plugin": "6.0.8-alpha.39",
|
|
155
|
+
"@common-stack/rollup-vite-utils": "6.0.8-alpha.38",
|
|
152
156
|
"@emotion/babel-plugin": "^11.11.0",
|
|
153
157
|
"@graphql-codegen/add": "^5.0.2",
|
|
154
158
|
"@graphql-codegen/cli": "^5.0.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",
|
|
@@ -311,7 +315,9 @@
|
|
|
311
315
|
"rimraf": "^3.0.2",
|
|
312
316
|
"rollup": "^4.13.0",
|
|
313
317
|
"rollup-plugin-esbuild": "^6.1.1",
|
|
318
|
+
"rollup-plugin-multi-input": "^1.5.0",
|
|
314
319
|
"rollup-plugin-string": "^3.0.0",
|
|
320
|
+
"rollup-plugin-svg": "^2.0.0",
|
|
315
321
|
"sass-loader": "^13.1.0",
|
|
316
322
|
"shelljs": "^0.8.5",
|
|
317
323
|
"simple-git": "^3.14.1",
|
|
@@ -332,6 +338,10 @@
|
|
|
332
338
|
"typedoc": "^0.23.20",
|
|
333
339
|
"typescript": "^5.5.4",
|
|
334
340
|
"url-loader": "^4.1.1",
|
|
341
|
+
"vite": "^5.1.1",
|
|
342
|
+
"vite-plugin-babel-macros": "^1.0.6",
|
|
343
|
+
"vite-plugin-cjs-interop": "^2.0.6",
|
|
344
|
+
"vite-plugin-compression": "^0.5.1",
|
|
335
345
|
"wait-on": "^6.0.1",
|
|
336
346
|
"webpack": "^5.74.0",
|
|
337
347
|
"webpack-bundle-analyzer": "^4.7.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
|
+
})();
|
|
@@ -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
|
|
@@ -24,12 +24,15 @@
|
|
|
24
24
|
"test:watch": "npm test -- --watch",
|
|
25
25
|
"watch": "npm run start:dev"
|
|
26
26
|
},
|
|
27
|
+
"resolutions": {
|
|
28
|
+
"common": "link:./common"
|
|
29
|
+
},
|
|
27
30
|
"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.
|
|
31
|
+
"@common-stack/client-core": "6.0.8-alpha.31",
|
|
32
|
+
"@common-stack/core": "6.0.8-alpha.31",
|
|
33
|
+
"@common-stack/server-core": "6.0.8-alpha.31",
|
|
34
|
+
"@common-stack/server-stack": "6.0.8-alpha.32",
|
|
35
|
+
"@common-stack/store-mongo": "6.0.8-alpha.31",
|
|
33
36
|
"@container-stack/mailing-api": "5.2.1-alpha.1",
|
|
34
37
|
"helmet": "^3.21.2",
|
|
35
38
|
"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
|
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ContainerModule, interfaces } from 'inversify';
|
|
2
|
-
import { Feature } from '@common-stack/server-core';
|
|
3
|
-
import { TaggedType } from '@common-stack/core';
|
|
4
|
-
import { config } from '../config';
|
|
5
|
-
|
|
6
|
-
const subTopic = config.CONNECTION_ID;
|
|
7
|
-
export const settings: any = {
|
|
8
|
-
connectionId: config.CONNECTION_ID,
|
|
9
|
-
namespace: config.NAMESPACE,
|
|
10
|
-
subTopic,
|
|
11
|
-
logger: config.LOG_LEVEL,
|
|
12
|
-
workspaceId: config.CONNECTION_ID || 'DEFAULT',
|
|
13
|
-
configPath: process.env.CONFIG_PATH,
|
|
14
|
-
adminApiNamespace: 'api-admin',
|
|
15
|
-
apiNamespace: 'api-admin',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const defaultModule = () =>
|
|
19
|
-
new ContainerModule((bind: interfaces.Bind) => {
|
|
20
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('default', true);
|
|
21
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('microservice', true);
|
|
22
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged(TaggedType.MICROSERVICE, true);
|
|
23
|
-
bind('MongoOptions').toConstantValue({});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const DefaultFeature = new Feature({
|
|
27
|
-
createContainerFunc: [defaultModule],
|
|
28
|
-
createHemeraContainerFunc: [defaultModule],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default new Feature<any>(DefaultFeature);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ContainerModule, interfaces } from 'inversify';
|
|
2
|
-
import { Feature } from '@common-stack/server-core';
|
|
3
|
-
import { TaggedType } from '@common-stack/core';
|
|
4
|
-
import { config } from '../config';
|
|
5
|
-
|
|
6
|
-
const subTopic = config.CONNECTION_ID;
|
|
7
|
-
export const settings: any = {
|
|
8
|
-
connectionId: config.CONNECTION_ID,
|
|
9
|
-
namespace: config.NAMESPACE,
|
|
10
|
-
subTopic,
|
|
11
|
-
logger: config.LOG_LEVEL,
|
|
12
|
-
workspaceId: config.CONNECTION_ID || 'DEFAULT',
|
|
13
|
-
configPath: process.env.CONFIG_PATH,
|
|
14
|
-
adminApiNamespace: 'api-admin',
|
|
15
|
-
apiNamespace: 'api-admin',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const defaultModule = () =>
|
|
19
|
-
new ContainerModule((bind: interfaces.Bind) => {
|
|
20
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('default', true);
|
|
21
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('microservice', true);
|
|
22
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged(TaggedType.MICROSERVICE, true);
|
|
23
|
-
bind('MongoOptions').toConstantValue({});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const DefaultFeature = new Feature({
|
|
27
|
-
createContainerFunc: [defaultModule],
|
|
28
|
-
createHemeraContainerFunc: [defaultModule],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default new Feature<any>(DefaultFeature);
|