@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
|
@@ -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,10 +1,14 @@
|
|
|
1
1
|
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var tslib=require('tslib'),devkit=require('@nx/devkit'),path=require('path'),fs=require('fs'),index=require('../../utils/index.cjs'),jenkinsfileUpdate=require('./updates/jenkinsfileUpdate.cjs'),packageJsonUpdate=require('./updates/packageJsonUpdate.cjs'),lernaJsonUpdate=require('./updates/lernaJsonUpdate.cjs'),htmlPluginUpdate=require('./updates/htmlPluginUpdate.cjs'),licenseUpdate=require('./updates/licenseUpdate.cjs'),ignoreUpdate=require('./updates/ignoreUpdate.cjs'),generator$2=require('../add-frontend/generator.cjs'),generator$1=require('../add-backend/generator.cjs'),generator=require('../add-moleculer/generator.cjs'),generator$3=require('../add-package/generator.cjs');require('../../executors/update-deploy-version/executor.cjs');function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var path__namespace=/*#__PURE__*/_interopNamespaceDefault(path);var fs__namespace=/*#__PURE__*/_interopNamespaceDefault(fs);function addFullstackGenerator(tree, options) {
|
|
2
2
|
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
3
3
|
var _a;
|
|
4
|
-
|
|
4
|
+
let projectPath = options.path || '';
|
|
5
|
+
if (projectPath !== '') {
|
|
6
|
+
const basePath = process.cwd();
|
|
7
|
+
projectPath = path__namespace.relative(basePath, projectPath);
|
|
8
|
+
}
|
|
5
9
|
const projectName = (_a = index.getValid(options.name)) !== null && _a !== void 0 ? _a : 'fullstack-pro';
|
|
6
|
-
const projectRoot = path__namespace.join(
|
|
7
|
-
console.log(`
|
|
10
|
+
const projectRoot = path__namespace.join(projectPath, projectName);
|
|
11
|
+
// console.log(`Project Path: ${projectPath}`);
|
|
8
12
|
// backup existing lerna values
|
|
9
13
|
const lernaBackup = lernaJsonUpdate.backupLernaJson(tree, projectRoot);
|
|
10
14
|
// backup files codegen.yaml
|
|
@@ -25,7 +29,7 @@
|
|
|
25
29
|
ignoreUpdate.restoreFiles(tree, projectRoot, filesBackup);
|
|
26
30
|
yield devkit.formatFiles(tree);
|
|
27
31
|
if (index.isValid(options.config)) {
|
|
28
|
-
const configPath = path__namespace.resolve(
|
|
32
|
+
const configPath = path__namespace.resolve(projectPath, index.getValid(options.config));
|
|
29
33
|
if (fs__namespace.existsSync(configPath)) {
|
|
30
34
|
try {
|
|
31
35
|
const configs = JSON.parse(fs__namespace.readFileSync(configPath).toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.cjs","sources":["../../../src/generators/add-fullstack/generator.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"generator.cjs","sources":["../../../src/generators/add-fullstack/generator.ts"],"sourcesContent":[null],"names":["path","getValid","backupLernaJson","backupFiles","generateFiles","updateJenkinsFile","updatePackageJson","updateHtmlPlugin","restoreLernaJson","restoreFiles","formatFiles","isValid","fs","updateLicense","__awaiter","generateFrontend","generateBackend","generateMoleculer","generatePackage","updateRepository"],"mappings":"0sCAyBsB,SAAA,qBAAqB,CAAC,IAAU,EAAE,OAAoC,EAAA;;;AACxF,QAAA,IAAI,WAAW,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;AACrC,QAAA,IAAI,WAAW,KAAK,EAAE,EAAE;AACpB,YAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;YAC/B,WAAW,GAAGA,eAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;SACtD;QACD,MAAM,WAAW,GAAG,CAAA,EAAA,GAAAC,cAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,eAAe,CAAC;QAC9D,MAAM,WAAW,GAAGD,eAAI,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;;;QAKxD,MAAM,WAAW,GAAGE,+BAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;;QAGvD,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;QAClG,MAAM,WAAW,GAAGC,wBAAW,CAAC,IAAI,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AAElE,QAAAC,oBAAa,CAAC,IAAI,EAAEJ,eAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;;AAGzE,QAAAK,mCAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;;QAGlDC,mCAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,IA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AAI,EAAE,UAAU,EAChB,SAAS,EAAEd,eAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EAChD,EAAE,EAAE,OAAO,CAAC,EAAE,EACd,IAAI,EAAE,WAAW,GACpB,CAAC;YACF,MAAMkB,2BAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;KACJ;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,cAAc,GAAG,CAAO,IAAU,EAAE,OAAY,KAAIJ,eAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACtD,IAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACjB,QAAA,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACxC;IAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC9C,QAAA,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACxC;AAED,IAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACjB,QAAAR,mCAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,OAAO,EAAEL,cAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;KACnF;AAED,IAAA,IAAI,OAAO,CAAC,UAAU,EAAE;QACpBkB,kCAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;KAC9D;AACL,CAAC,CAAA"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {__awaiter}from'tslib';import {generateFiles,formatFiles}from'@nx/devkit';import*as path from'path';import*as fs from'fs';import {getValid,isValid}from'../../utils/index.mjs';import {updateJenkinsFile}from'./updates/jenkinsfileUpdate.mjs';import {updatePackageJson,updateRepository}from'./updates/packageJsonUpdate.mjs';import {backupLernaJson,restoreLernaJson}from'./updates/lernaJsonUpdate.mjs';import {updateHtmlPlugin}from'./updates/htmlPluginUpdate.mjs';import {updateLicense}from'./updates/licenseUpdate.mjs';import {backupFiles,restoreFiles}from'./updates/ignoreUpdate.mjs';import {generateFrontend}from'../add-frontend/generator.mjs';import {generateBackend}from'../add-backend/generator.mjs';import {generateMoleculer}from'../add-moleculer/generator.mjs';import {generatePackage}from'../add-package/generator.mjs';import'../../executors/update-deploy-version/executor.mjs';function addFullstackGenerator(tree, options) {
|
|
2
2
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3
3
|
var _a;
|
|
4
|
-
|
|
4
|
+
let projectPath = options.path || '';
|
|
5
|
+
if (projectPath !== '') {
|
|
6
|
+
const basePath = process.cwd();
|
|
7
|
+
projectPath = path.relative(basePath, projectPath);
|
|
8
|
+
}
|
|
5
9
|
const projectName = (_a = getValid(options.name)) !== null && _a !== void 0 ? _a : 'fullstack-pro';
|
|
6
|
-
const projectRoot = path.join(
|
|
7
|
-
console.log(`
|
|
10
|
+
const projectRoot = path.join(projectPath, projectName);
|
|
11
|
+
// console.log(`Project Path: ${projectPath}`);
|
|
8
12
|
// backup existing lerna values
|
|
9
13
|
const lernaBackup = backupLernaJson(tree, projectRoot);
|
|
10
14
|
// backup files codegen.yaml
|
|
@@ -25,7 +29,7 @@ import {__awaiter}from'tslib';import {generateFiles,formatFiles}from'@nx/devkit'
|
|
|
25
29
|
restoreFiles(tree, projectRoot, filesBackup);
|
|
26
30
|
yield formatFiles(tree);
|
|
27
31
|
if (isValid(options.config)) {
|
|
28
|
-
const configPath = path.resolve(
|
|
32
|
+
const configPath = path.resolve(projectPath, getValid(options.config));
|
|
29
33
|
if (fs.existsSync(configPath)) {
|
|
30
34
|
try {
|
|
31
35
|
const configs = JSON.parse(fs.readFileSync(configPath).toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.mjs","sources":["../../../src/generators/add-fullstack/generator.ts"],"sourcesContent":[null],"names":[],"mappings":"y3BAy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I,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,EAChD,EAAE,EAAE,OAAO,CAAC,EAAE,EACd,IAAI,EAAE,WAAW,GACpB,CAAC;YACF,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;SAC/C;KACJ;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,cAAc,GAAG,CAAO,IAAU,EAAE,OAAY,KAAI,SAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,KAAA,CAAA,EAAA,aAAA;AACtD,IAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACjB,QAAA,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACxC;IAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC9C,QAAA,MAAM,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KACxC;AAED,IAAA,IAAI,OAAO,CAAC,OAAO,EAAE;AACjB,QAAA,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;KACnF;AAED,IAAA,IAAI,OAAO,CAAC,UAAU,EAAE;QACpB,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;KAC9D;AACL,CAAC,CAAA"}
|
|
@@ -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": "
|
|
29
|
-
"@common-stack/core": "
|
|
30
|
-
"@common-stack/server-core": "
|
|
31
|
-
"@common-stack/server-stack": "
|
|
32
|
-
"@common-stack/store-mongo": "
|
|
32
|
+
"@common-stack/client-core": "7.0.2-alpha.0",
|
|
33
|
+
"@common-stack/core": "7.0.2-alpha.0",
|
|
34
|
+
"@common-stack/server-core": "7.0.2-alpha.0",
|
|
35
|
+
"@common-stack/server-stack": "7.0.2-alpha.0",
|
|
36
|
+
"@common-stack/store-mongo": "7.0.2-alpha.0",
|
|
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/generate-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.2-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.mjs",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"test": "cross-env ENV_FILE=../../config/test/test.env jest",
|
|
15
15
|
"test:debug": "npm test -- --runInBand",
|
|
16
16
|
"test:watch": "npm test -- --watch",
|
|
17
|
+
"vitest": "cross-env ENV_FILE=../../config/test/test.env vitest",
|
|
17
18
|
"watch": "yarn build:lib:watch"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@common-stack/rollup-vite-utils": "
|
|
21
|
+
"@common-stack/rollup-vite-utils": "7.0.2-alpha.1",
|
|
21
22
|
"tslib": "^2.3.0"
|
|
22
23
|
},
|
|
23
24
|
"publishConfig": {
|
|
@@ -25,5 +26,5 @@
|
|
|
25
26
|
},
|
|
26
27
|
"executors": "./executors.json",
|
|
27
28
|
"generators": "./generators.json",
|
|
28
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "8597886e7760f5f59ad82340674f15319fffed15"
|
|
29
30
|
}
|
package/rollup.config.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import image from '@rollup/plugin-image';
|
|
|
3
3
|
import typescript from '@rollup/plugin-typescript';
|
|
4
4
|
import { string } from 'rollup-plugin-string';
|
|
5
5
|
import copy from 'rollup-plugin-copy';
|
|
6
|
+
import json from '@rollup/plugin-json';
|
|
6
7
|
|
|
7
8
|
// Define a base configuration for reuse
|
|
8
9
|
const baseConfig = {
|
|
@@ -18,6 +19,7 @@ const baseConfig = {
|
|
|
18
19
|
include: '**/*.graphql',
|
|
19
20
|
exclude: ['src/generators'],
|
|
20
21
|
}),
|
|
22
|
+
json(),
|
|
21
23
|
typescript({
|
|
22
24
|
noEmitOnError: true,
|
|
23
25
|
exclude: ['src/generators'],
|
|
@@ -37,6 +39,7 @@ const baseConfig = {
|
|
|
37
39
|
{ src: 'src/generators/add-package/files/*', dest: 'lib/generators/add-package/files' },
|
|
38
40
|
{ src: 'src/executors/update-deploy-version/schema.json', dest: 'lib/executors/update-deploy-version' },
|
|
39
41
|
{ src: 'src/executors/sort-package-json/schema.json', dest: 'lib/executors/sort-package-json' },
|
|
42
|
+
{ src: 'src/common/package-releases/package.json', dest: 'lib/common/package-releases' },
|
|
40
43
|
],
|
|
41
44
|
verbose: false,
|
|
42
45
|
}),
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sample-stack-frontend-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"resolutions": {
|
|
6
|
+
"common": "link:./common"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@admin-layout/ant-design-pro": "10.0.2-alpha.4",
|
|
10
|
+
"@ant-design/static-style-extract": "^1.0.3",
|
|
11
|
+
"@chakra-ui/react": "^2.8.0",
|
|
12
|
+
"@emotion/css": "^11.13.5",
|
|
13
|
+
"@emotion/react": "^11.14.0",
|
|
14
|
+
"@emotion/server": "^11.11.0",
|
|
15
|
+
"@emotion/styled": "^11.14.0",
|
|
16
|
+
"antd": "^5.23.4",
|
|
17
|
+
"autoprefixer": "^10.4.20",
|
|
18
|
+
"framer-motion": "^12.4.1",
|
|
19
|
+
"postcss": "^8.5.1",
|
|
20
|
+
"tailwindcss": "^4.0.4"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"body-parser": "*"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`addFrontendGenerator should add missing dependencies and update config.json for antui 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@admin-layout/ant-design-pro": "10.0.2-alpha.4",
|
|
7
|
+
"@ant-design/static-style-extract": "^1.0.3",
|
|
8
|
+
"@emotion/css": "^11.13.5",
|
|
9
|
+
"@emotion/react": "^11.14.0",
|
|
10
|
+
"@emotion/server": "^11.11.0",
|
|
11
|
+
"@emotion/styled": "^11.14.0",
|
|
12
|
+
"antd": "^5.23.4",
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {},
|
|
15
|
+
"name": "frontend-demo-server",
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`addFrontendGenerator should not override an already existing dependency version 1`] = `
|
|
20
|
+
{
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@admin-layout/ant-design-pro": "10.0.2-alpha.4",
|
|
23
|
+
"@ant-design/static-style-extract": "^1.0.3",
|
|
24
|
+
"@emotion/css": "^11.13.5",
|
|
25
|
+
"@emotion/react": "^11.14.0",
|
|
26
|
+
"@emotion/server": "^11.11.0",
|
|
27
|
+
"@emotion/styled": "^11.14.0",
|
|
28
|
+
"antd": "1.0.0",
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {},
|
|
31
|
+
"name": "frontend-demo-server",
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
@@ -13,8 +13,6 @@ import { ApolloProvider } from '@apollo/client/index.js';
|
|
|
13
13
|
import { SlotFillProvider, removeUniversalPortals } from '@common-stack/components-pro';
|
|
14
14
|
import { InversifyProvider } from '@common-stack/client-react';
|
|
15
15
|
import { Provider as ReduxProvider } from 'react-redux';
|
|
16
|
-
import { PersistGate } from 'redux-persist/integration/react';
|
|
17
|
-
import { persistStore } from 'redux-persist';
|
|
18
16
|
import { CacheProvider } from '@emotion/react';
|
|
19
17
|
import i18next from 'i18next';
|
|
20
18
|
import { I18nextProvider, initReactI18next } from 'react-i18next';
|
|
@@ -32,16 +30,22 @@ import clientModules from '@app/frontend-stack-react/modules.js';
|
|
|
32
30
|
import createEmotionCache from '@app/frontend-stack-react/entries/common/createEmotionCache.js';
|
|
33
31
|
// @ts-ignore
|
|
34
32
|
import config from '@app/cde-webconfig.json';
|
|
33
|
+
import { LocaleContext } from './context';
|
|
35
34
|
|
|
36
35
|
const { apolloClient: client, container, serviceFunc } = createClientContainer();
|
|
37
36
|
const { store } = createReduxStore(client, serviceFunc(), container);
|
|
38
|
-
const persistor = persistStore(store);
|
|
39
37
|
const antCache = createCache();
|
|
40
38
|
const cache = createEmotionCache();
|
|
41
39
|
|
|
42
40
|
(window as any).__remixStore = store;
|
|
43
41
|
removeUniversalPortals((window as any).__SLOT_FILLS__ || []);
|
|
44
42
|
|
|
43
|
+
function LocaleProvider({ children }: any) {
|
|
44
|
+
const locale = (window as any).__LOCALE__ || '';
|
|
45
|
+
|
|
46
|
+
return <LocaleContext.Provider value={locale}>{children}</LocaleContext.Provider>;
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
async function hydrate() {
|
|
46
50
|
if (!i18next.isInitialized && config.i18n.enabled) {
|
|
47
51
|
await i18next
|
|
@@ -66,25 +70,21 @@ async function hydrate() {
|
|
|
66
70
|
document,
|
|
67
71
|
(
|
|
68
72
|
<I18nextProvider i18n={i18next}>
|
|
69
|
-
<
|
|
73
|
+
<LocaleProvider>
|
|
70
74
|
<CacheProvider value={cache}>
|
|
71
75
|
<StyleProvider cache={antCache}>
|
|
72
76
|
<ReduxProvider store={store}>
|
|
73
77
|
<SlotFillProvider>
|
|
74
78
|
<InversifyProvider container={container} modules={clientModules}>
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<RemixBrowser />
|
|
79
|
-
</ApolloProvider>
|
|
80
|
-
)}
|
|
81
|
-
</PersistGate>
|
|
79
|
+
<ApolloProvider client={client}>
|
|
80
|
+
<RemixBrowser />
|
|
81
|
+
</ApolloProvider>
|
|
82
82
|
</InversifyProvider>
|
|
83
83
|
</SlotFillProvider>
|
|
84
84
|
</ReduxProvider>
|
|
85
85
|
</StyleProvider>
|
|
86
86
|
</CacheProvider>
|
|
87
|
-
</
|
|
87
|
+
</LocaleProvider>
|
|
88
88
|
</I18nextProvider>
|
|
89
89
|
) as any,
|
|
90
90
|
);
|