@kosdev-code/kos-nx-plugin 2.1.26 → 2.1.28
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/migrations.json +5 -0
- package/package.json +2 -2
- package/src/migrations/dev-server-support/coordinators/migration-analyzer.d.ts +13 -0
- package/src/migrations/dev-server-support/coordinators/migration-analyzer.d.ts.map +1 -0
- package/src/migrations/dev-server-support/coordinators/migration-analyzer.js +53 -0
- package/src/migrations/dev-server-support/coordinators/migration-analyzer.js.map +1 -0
- package/src/migrations/dev-server-support/coordinators/migration-executor.d.ts +13 -0
- package/src/migrations/dev-server-support/coordinators/migration-executor.d.ts.map +1 -0
- package/src/migrations/dev-server-support/coordinators/migration-executor.js +239 -0
- package/src/migrations/dev-server-support/coordinators/migration-executor.js.map +1 -0
- package/src/migrations/dev-server-support/coordinators/migration-reporter.d.ts +16 -0
- package/src/migrations/dev-server-support/coordinators/migration-reporter.d.ts.map +1 -0
- package/src/migrations/dev-server-support/coordinators/migration-reporter.js +49 -0
- package/src/migrations/dev-server-support/coordinators/migration-reporter.js.map +1 -0
- package/src/migrations/dev-server-support/helpers/config-updater.d.ts +24 -0
- package/src/migrations/dev-server-support/helpers/config-updater.d.ts.map +1 -0
- package/src/migrations/dev-server-support/helpers/config-updater.js +54 -0
- package/src/migrations/dev-server-support/helpers/config-updater.js.map +1 -0
- package/src/migrations/dev-server-support/helpers/port-allocator.d.ts +37 -0
- package/src/migrations/dev-server-support/helpers/port-allocator.d.ts.map +1 -0
- package/src/migrations/dev-server-support/helpers/port-allocator.js +49 -0
- package/src/migrations/dev-server-support/helpers/port-allocator.js.map +1 -0
- package/src/migrations/dev-server-support/helpers/project-analyzer.d.ts +74 -0
- package/src/migrations/dev-server-support/helpers/project-analyzer.d.ts.map +1 -0
- package/src/migrations/dev-server-support/helpers/project-analyzer.js +109 -0
- package/src/migrations/dev-server-support/helpers/project-analyzer.js.map +1 -0
- package/src/migrations/dev-server-support/helpers/webpack-updater.d.ts +48 -0
- package/src/migrations/dev-server-support/helpers/webpack-updater.d.ts.map +1 -0
- package/src/migrations/dev-server-support/helpers/webpack-updater.js +144 -0
- package/src/migrations/dev-server-support/helpers/webpack-updater.js.map +1 -0
- package/src/migrations/dev-server-support/migrate.d.ts +57 -0
- package/src/migrations/dev-server-support/migrate.d.ts.map +1 -0
- package/src/migrations/dev-server-support/migrate.js +68 -0
- package/src/migrations/dev-server-support/migrate.js.map +1 -0
- package/src/migrations/dev-server-support/types.d.ts +39 -0
- package/src/migrations/dev-server-support/types.d.ts.map +1 -0
- package/src/migrations/dev-server-support/types.js +6 -0
- package/src/migrations/dev-server-support/types.js.map +1 -0
- package/src/generators/preset/tools/tools/scripts/generate-api-types-split.mjs.template +0 -403
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { ProjectConfiguration, Tree } from "@nx/devkit";
|
|
5
|
+
/**
|
|
6
|
+
* Zone 3: Project analysis utilities
|
|
7
|
+
*/
|
|
8
|
+
export interface KosJson {
|
|
9
|
+
name?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
generator?: {
|
|
13
|
+
projectType?: string;
|
|
14
|
+
defaults?: any;
|
|
15
|
+
};
|
|
16
|
+
test?: {
|
|
17
|
+
plugin?: {
|
|
18
|
+
context?: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
development?: any;
|
|
22
|
+
kosdev?: any;
|
|
23
|
+
kos?: any;
|
|
24
|
+
models?: any;
|
|
25
|
+
}
|
|
26
|
+
export interface ProjectInfo {
|
|
27
|
+
name: string;
|
|
28
|
+
root: string;
|
|
29
|
+
kosJson: KosJson | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a project is a UI project.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isUiProject(kosJson: KosJson | null): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if a project is a plugin project.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isPluginProject(kosJson: KosJson | null): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a project is a model project.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isModelProject(kosJson: KosJson | null): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Reads project's .kos.json file.
|
|
45
|
+
*/
|
|
46
|
+
export declare function readProjectKosJson(tree: Tree, projectRoot: string): KosJson | null;
|
|
47
|
+
/**
|
|
48
|
+
* Categorizes projects by type.
|
|
49
|
+
*/
|
|
50
|
+
export declare function categorizeProjects(tree: Tree, projects: Map<string, ProjectConfiguration>): {
|
|
51
|
+
uiProjects: ProjectInfo[];
|
|
52
|
+
pluginProjects: ProjectInfo[];
|
|
53
|
+
modelProjects: ProjectInfo[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Determines the plugin context for a UI project.
|
|
57
|
+
*/
|
|
58
|
+
export declare function derivePluginContext(projectInfo: ProjectInfo): string;
|
|
59
|
+
/**
|
|
60
|
+
* Determines the UI type for a host configuration.
|
|
61
|
+
*/
|
|
62
|
+
export declare function deriveUiType(kosJson: KosJson | null): string;
|
|
63
|
+
/**
|
|
64
|
+
* Finds the first available default project of each type.
|
|
65
|
+
*/
|
|
66
|
+
export declare function findDefaultProjects(categorized: {
|
|
67
|
+
uiProjects: ProjectInfo[];
|
|
68
|
+
modelProjects: ProjectInfo[];
|
|
69
|
+
}): {
|
|
70
|
+
defaultModel: string;
|
|
71
|
+
defaultModelComponent: string;
|
|
72
|
+
defaultUi: string;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=project-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-analyzer.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/helpers/project-analyzer.ts"],"names":[],"mappings":"AAAA;;G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B,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,aAAa,EAAE,WAAW,EAAE,CAAC;CAC9B,CAwBA;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAKpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAU5D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE;IAC/C,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,aAAa,EAAE,WAAW,EAAE,CAAC;CAC9B,GAAG;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB,CAeA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findDefaultProjects = exports.deriveUiType = exports.derivePluginContext = exports.categorizeProjects = exports.readProjectKosJson = exports.isModelProject = exports.isPluginProject = exports.isUiProject = void 0;
|
|
7
|
+
const config_updater_1 = require("./config-updater");
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a project is a UI project.
|
|
10
|
+
*/
|
|
11
|
+
function isUiProject(kosJson) {
|
|
12
|
+
if (!kosJson)
|
|
13
|
+
return false;
|
|
14
|
+
return (kosJson.type === "kos.ui" ||
|
|
15
|
+
kosJson.type?.includes("ui") ||
|
|
16
|
+
kosJson.generator?.projectType === "ui");
|
|
17
|
+
}
|
|
18
|
+
exports.isUiProject = isUiProject;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if a project is a plugin project.
|
|
21
|
+
*/
|
|
22
|
+
function isPluginProject(kosJson) {
|
|
23
|
+
if (!kosJson)
|
|
24
|
+
return false;
|
|
25
|
+
return (kosJson.type === "ddk.ncui.plugin" ||
|
|
26
|
+
kosJson.generator?.projectType === "plugin");
|
|
27
|
+
}
|
|
28
|
+
exports.isPluginProject = isPluginProject;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a project is a model project.
|
|
31
|
+
*/
|
|
32
|
+
function isModelProject(kosJson) {
|
|
33
|
+
if (!kosJson)
|
|
34
|
+
return false;
|
|
35
|
+
return (kosJson.type === "kos.model" || kosJson.generator?.projectType === "model");
|
|
36
|
+
}
|
|
37
|
+
exports.isModelProject = isModelProject;
|
|
38
|
+
/**
|
|
39
|
+
* Reads project's .kos.json file.
|
|
40
|
+
*/
|
|
41
|
+
function readProjectKosJson(tree, projectRoot) {
|
|
42
|
+
return (0, config_updater_1.readJsonConfigSafe)(tree, `${projectRoot}/.kos.json`);
|
|
43
|
+
}
|
|
44
|
+
exports.readProjectKosJson = readProjectKosJson;
|
|
45
|
+
/**
|
|
46
|
+
* Categorizes projects by type.
|
|
47
|
+
*/
|
|
48
|
+
function categorizeProjects(tree, projects) {
|
|
49
|
+
const uiProjects = [];
|
|
50
|
+
const pluginProjects = [];
|
|
51
|
+
const modelProjects = [];
|
|
52
|
+
projects.forEach((project, projectName) => {
|
|
53
|
+
const kosJson = readProjectKosJson(tree, project.root);
|
|
54
|
+
const projectInfo = {
|
|
55
|
+
name: projectName,
|
|
56
|
+
root: project.root,
|
|
57
|
+
kosJson,
|
|
58
|
+
};
|
|
59
|
+
if (isUiProject(kosJson)) {
|
|
60
|
+
uiProjects.push(projectInfo);
|
|
61
|
+
}
|
|
62
|
+
else if (isPluginProject(kosJson)) {
|
|
63
|
+
pluginProjects.push(projectInfo);
|
|
64
|
+
}
|
|
65
|
+
else if (isModelProject(kosJson)) {
|
|
66
|
+
modelProjects.push(projectInfo);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
return { uiProjects, pluginProjects, modelProjects };
|
|
70
|
+
}
|
|
71
|
+
exports.categorizeProjects = categorizeProjects;
|
|
72
|
+
/**
|
|
73
|
+
* Determines the plugin context for a UI project.
|
|
74
|
+
*/
|
|
75
|
+
function derivePluginContext(projectInfo) {
|
|
76
|
+
if (projectInfo.kosJson?.test?.plugin?.context) {
|
|
77
|
+
return projectInfo.kosJson.test.plugin.context;
|
|
78
|
+
}
|
|
79
|
+
return projectInfo.name;
|
|
80
|
+
}
|
|
81
|
+
exports.derivePluginContext = derivePluginContext;
|
|
82
|
+
/**
|
|
83
|
+
* Determines the UI type for a host configuration.
|
|
84
|
+
*/
|
|
85
|
+
function deriveUiType(kosJson) {
|
|
86
|
+
if (!kosJson)
|
|
87
|
+
return "cui";
|
|
88
|
+
if (kosJson.type?.includes("ncui")) {
|
|
89
|
+
return "ncui";
|
|
90
|
+
}
|
|
91
|
+
else if (kosJson.type?.includes("admin")) {
|
|
92
|
+
return "admin";
|
|
93
|
+
}
|
|
94
|
+
return "cui";
|
|
95
|
+
}
|
|
96
|
+
exports.deriveUiType = deriveUiType;
|
|
97
|
+
/**
|
|
98
|
+
* Finds the first available default project of each type.
|
|
99
|
+
*/
|
|
100
|
+
function findDefaultProjects(categorized) {
|
|
101
|
+
const defaultModel = categorized.modelProjects.find((p) => p.kosJson?.type === "kos.model")
|
|
102
|
+
?.name || "";
|
|
103
|
+
const defaultModelComponent = categorized.modelProjects.find((p) => p.kosJson?.type === "kos.model-component")?.name || "";
|
|
104
|
+
const defaultUi = categorized.uiProjects.find((p) => p.kosJson?.type === "kos.ui")?.name ||
|
|
105
|
+
"";
|
|
106
|
+
return { defaultModel, defaultModelComponent, defaultUi };
|
|
107
|
+
}
|
|
108
|
+
exports.findDefaultProjects = findDefaultProjects;
|
|
109
|
+
//# sourceMappingURL=project-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-analyzer.js","sourceRoot":"","sources":["../../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/helpers/project-analyzer.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAGH,qDAAsD;AA+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CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,KAAK,WAAW,CAAC;QACpE,EAAE,IAAI,IAAI,EAAE,CAAC;IAEjB,MAAM,qBAAqB,GACzB,WAAW,CAAC,aAAa,CAAC,IAAI,CAC5B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,KAAK,qBAAqB,CACjD,EAAE,IAAI,IAAI,EAAE,CAAC;IAEhB,MAAM,SAAS,GACb,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,IAAI,KAAK,QAAQ,CAAC,EAAE,IAAI;QACtE,EAAE,CAAC;IAEL,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,SAAS,EAAE,CAAC;AAC5D,CAAC;AAtBD,kDAsBC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Tree } from "@nx/devkit";
|
|
5
|
+
/**
|
|
6
|
+
* Zone 3: Webpack configuration update utilities
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Checks if webpack config already has plugin dev server support.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasPluginDevServer(webpackContent: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if webpack config already has plugin dev aggregator support.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasPluginDevAggregator(webpackContent: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Adds plugin dev server imports to webpack config.
|
|
18
|
+
*/
|
|
19
|
+
export declare function addPluginDevServerImports(webpackContent: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Adds plugin dev server to webpack composition.
|
|
22
|
+
*/
|
|
23
|
+
export declare function addPluginDevServerComposition(webpackContent: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Adds plugin dev aggregator import to UI webpack config.
|
|
26
|
+
*/
|
|
27
|
+
export declare function addPluginAggregatorImport(webpackContent: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Adds plugin dev configuration section to UI webpack config.
|
|
30
|
+
*/
|
|
31
|
+
export declare function addPluginDevConfiguration(webpackContent: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Adds plugin dev aggregator to webpack composition.
|
|
34
|
+
*/
|
|
35
|
+
export declare function addPluginAggregatorComposition(webpackContent: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Adds USE_LOCAL_PLUGINS to environment plugin.
|
|
38
|
+
*/
|
|
39
|
+
export declare function addUseLocalPluginsEnv(webpackContent: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Updates plugin webpack configuration file.
|
|
42
|
+
*/
|
|
43
|
+
export declare function updatePluginWebpackConfig(tree: Tree, webpackPath: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Updates UI webpack configuration file for plugin support.
|
|
46
|
+
*/
|
|
47
|
+
export declare function updateUiWebpackConfig(tree: Tree, webpackPath: string): boolean;
|
|
48
|
+
//# sourceMappingURL=webpack-updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack-updater.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/helpers/webpack-updater.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC;;GAEG;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAElE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAa5E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CA2BxE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAe7E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAMpE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,OAAO,CAeT;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,OAAO,CAiBT"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateUiWebpackConfig = exports.updatePluginWebpackConfig = exports.addUseLocalPluginsEnv = exports.addPluginAggregatorComposition = exports.addPluginDevConfiguration = exports.addPluginAggregatorImport = exports.addPluginDevServerComposition = exports.addPluginDevServerImports = exports.hasPluginDevAggregator = exports.hasPluginDevServer = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Zone 3: Webpack configuration update utilities
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Checks if webpack config already has plugin dev server support.
|
|
12
|
+
*/
|
|
13
|
+
function hasPluginDevServer(webpackContent) {
|
|
14
|
+
return webpackContent.includes("withPluginDevServer");
|
|
15
|
+
}
|
|
16
|
+
exports.hasPluginDevServer = hasPluginDevServer;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if webpack config already has plugin dev aggregator support.
|
|
19
|
+
*/
|
|
20
|
+
function hasPluginDevAggregator(webpackContent) {
|
|
21
|
+
return webpackContent.includes("withPluginDevAggregator");
|
|
22
|
+
}
|
|
23
|
+
exports.hasPluginDevAggregator = hasPluginDevAggregator;
|
|
24
|
+
/**
|
|
25
|
+
* Adds plugin dev server imports to webpack config.
|
|
26
|
+
*/
|
|
27
|
+
function addPluginDevServerImports(webpackContent) {
|
|
28
|
+
return webpackContent.replace(/import { generatePluginConfiguration } from "@kosdev-code\/kos-ui-plugin\/utilities";/, `import { generatePluginConfiguration } from "@kosdev-code/kos-ui-plugin/utilities";
|
|
29
|
+
import { withKosConfig, withPluginDevServer } from "@kosdev-code/kos-ui-plugin/webpack";`);
|
|
30
|
+
}
|
|
31
|
+
exports.addPluginDevServerImports = addPluginDevServerImports;
|
|
32
|
+
/**
|
|
33
|
+
* Adds plugin dev server to webpack composition.
|
|
34
|
+
*/
|
|
35
|
+
function addPluginDevServerComposition(webpackContent) {
|
|
36
|
+
return webpackContent.replace(/export default composePlugins\(\s*withNx\(\),\s*withReact\(\{\}\),\s*withModuleFederation\(config\)\s*\);/, `export default composePlugins(
|
|
37
|
+
withNx(),
|
|
38
|
+
withReact({}),
|
|
39
|
+
withModuleFederation(config),
|
|
40
|
+
withKosConfig(webpack),
|
|
41
|
+
withPluginDevServer({
|
|
42
|
+
verbose: process.env.VERBOSE_PLUGIN_DEV === 'true'
|
|
43
|
+
})
|
|
44
|
+
);`);
|
|
45
|
+
}
|
|
46
|
+
exports.addPluginDevServerComposition = addPluginDevServerComposition;
|
|
47
|
+
/**
|
|
48
|
+
* Adds plugin dev aggregator import to UI webpack config.
|
|
49
|
+
*/
|
|
50
|
+
function addPluginAggregatorImport(webpackContent) {
|
|
51
|
+
return webpackContent.replace(/import { merge } from 'webpack-merge';/, `import { merge } from 'webpack-merge';
|
|
52
|
+
import { withPluginDevAggregator } from '@kosdev-code/kos-ui-plugin/webpack';`);
|
|
53
|
+
}
|
|
54
|
+
exports.addPluginAggregatorImport = addPluginAggregatorImport;
|
|
55
|
+
/**
|
|
56
|
+
* Adds plugin dev configuration section to UI webpack config.
|
|
57
|
+
*/
|
|
58
|
+
function addPluginDevConfiguration(webpackContent) {
|
|
59
|
+
const pluginDevConfig = `
|
|
60
|
+
// Configure plugin dev servers based on environment variables
|
|
61
|
+
// These are set automatically by \`kosui dev\` command
|
|
62
|
+
const useLocalPlugins = process.env.USE_LOCAL_PLUGINS === 'true';
|
|
63
|
+
const mergeWithBackend = process.env.MERGE_WITH_BACKEND === 'true';
|
|
64
|
+
|
|
65
|
+
// Plugin dev servers are configured via environment variables
|
|
66
|
+
// Format: <PLUGIN_ALIAS>_DEV=true where alias is from .kos.json
|
|
67
|
+
// Example: BEVERAGE_POUR_DEV=true
|
|
68
|
+
const pluginServers = Object.keys(process.env)
|
|
69
|
+
.filter(key => key.endsWith('_DEV') && process.env[key] === 'true')
|
|
70
|
+
.map(key => {
|
|
71
|
+
// Extract plugin alias from env var (e.g., BEVERAGE_POUR_DEV -> beverage-pour)
|
|
72
|
+
const alias = key.replace(/_DEV$/, '').toLowerCase().replace(/_/g, '-');
|
|
73
|
+
// Port is set via <PLUGIN_ALIAS>_PORT env var
|
|
74
|
+
const portKey = key.replace(/_DEV$/, '_PORT');
|
|
75
|
+
const port = process.env[portKey] || '4201';
|
|
76
|
+
return \`http://localhost:\${port}\`;
|
|
77
|
+
});
|
|
78
|
+
`;
|
|
79
|
+
return webpackContent.replace(/\/\/ Nx plugins for webpack to build config object from Nx options and context\./, `${pluginDevConfig}
|
|
80
|
+
// Nx plugins for webpack to build config object from Nx options and context.`);
|
|
81
|
+
}
|
|
82
|
+
exports.addPluginDevConfiguration = addPluginDevConfiguration;
|
|
83
|
+
/**
|
|
84
|
+
* Adds plugin dev aggregator to webpack composition.
|
|
85
|
+
*/
|
|
86
|
+
function addPluginAggregatorComposition(webpackContent) {
|
|
87
|
+
return webpackContent.replace(/withModuleFederation\(config\),/, `withModuleFederation(config),
|
|
88
|
+
// Add plugin dev aggregator for multi-plugin development
|
|
89
|
+
useLocalPlugins
|
|
90
|
+
? withPluginDevAggregator({
|
|
91
|
+
pluginServers,
|
|
92
|
+
mergeWithBackend,
|
|
93
|
+
fallbackToBackend: pluginServers.length === 0,
|
|
94
|
+
backendUrl: 'http://localhost:8081',
|
|
95
|
+
verbose: process.env.VERBOSE_PLUGIN_DEV === 'true',
|
|
96
|
+
})
|
|
97
|
+
: (config) => config,`);
|
|
98
|
+
}
|
|
99
|
+
exports.addPluginAggregatorComposition = addPluginAggregatorComposition;
|
|
100
|
+
/**
|
|
101
|
+
* Adds USE_LOCAL_PLUGINS to environment plugin.
|
|
102
|
+
*/
|
|
103
|
+
function addUseLocalPluginsEnv(webpackContent) {
|
|
104
|
+
return webpackContent.replace(/new webpack\.EnvironmentPlugin\(\{/, `new webpack.EnvironmentPlugin({
|
|
105
|
+
USE_LOCAL_PLUGINS: 'false', // Default to false, set to 'true' in dev mode`);
|
|
106
|
+
}
|
|
107
|
+
exports.addUseLocalPluginsEnv = addUseLocalPluginsEnv;
|
|
108
|
+
/**
|
|
109
|
+
* Updates plugin webpack configuration file.
|
|
110
|
+
*/
|
|
111
|
+
function updatePluginWebpackConfig(tree, webpackPath) {
|
|
112
|
+
let content = tree.read(webpackPath, "utf-8");
|
|
113
|
+
if (!content) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (hasPluginDevServer(content)) {
|
|
117
|
+
return false; // Already migrated
|
|
118
|
+
}
|
|
119
|
+
content = addPluginDevServerImports(content);
|
|
120
|
+
content = addPluginDevServerComposition(content);
|
|
121
|
+
tree.write(webpackPath, content);
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
exports.updatePluginWebpackConfig = updatePluginWebpackConfig;
|
|
125
|
+
/**
|
|
126
|
+
* Updates UI webpack configuration file for plugin support.
|
|
127
|
+
*/
|
|
128
|
+
function updateUiWebpackConfig(tree, webpackPath) {
|
|
129
|
+
let content = tree.read(webpackPath, "utf-8");
|
|
130
|
+
if (!content) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
if (hasPluginDevAggregator(content)) {
|
|
134
|
+
return false; // Already migrated
|
|
135
|
+
}
|
|
136
|
+
content = addPluginAggregatorImport(content);
|
|
137
|
+
content = addPluginDevConfiguration(content);
|
|
138
|
+
content = addPluginAggregatorComposition(content);
|
|
139
|
+
content = addUseLocalPluginsEnv(content);
|
|
140
|
+
tree.write(webpackPath, content);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
exports.updateUiWebpackConfig = updateUiWebpackConfig;
|
|
144
|
+
//# sourceMappingURL=webpack-updater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack-updater.js","sourceRoot":"","sources":["../../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/helpers/webpack-updater.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH;;GAEG;AAEH;;GAEG;AACH,SAAgB,kBAAkB,CAAC,cAAsB;IACvD,OAAO,cAAc,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AACxD,CAAC;AAFD,gDAEC;AAED;;GAEG;AACH,SAAgB,sBAAsB,CAAC,cAAsB;IAC3D,OAAO,cAAc,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC;AAC5D,CAAC;AAFD,wDAEC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,cAAsB;IAC9D,OAAO,cAAc,CAAC,OAAO,CAC3B,uFAAuF,EACvF;yFACqF,CACtF,CAAC;AACJ,CAAC;AAND,8DAMC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAAC,cAAsB;IAClE,OAAO,cAAc,CAAC,OAAO,CAC3B,2GAA2G,EAC3G;;;;;;;;GAQD,CACA,CAAC;AACJ,CAAC;AAbD,sEAaC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,cAAsB;IAC9D,OAAO,cAAc,CAAC,OAAO,CAC3B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IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC,CAAC,mBAAmB;IACnC,CAAC;IAED,OAAO,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,GAAG,8BAA8B,CAAC,OAAO,CAAC,CAAC;IAClD,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAEzC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC;AACd,CAAC;AApBD,sDAoBC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { Tree } from "@nx/devkit";
|
|
5
|
+
/**
|
|
6
|
+
* Automatic migration to add dev server support to existing KOS workspaces.
|
|
7
|
+
*
|
|
8
|
+
* This migration runs automatically when users upgrade to
|
|
9
|
+
* @kosdev-code/kos-nx-plugin@2.1.28+ via `nx migrate`.
|
|
10
|
+
*
|
|
11
|
+
* ## What This Migration Does
|
|
12
|
+
*
|
|
13
|
+
* 1. **Root .kos.json** - Adds development configuration with auto-detected hosts/plugins
|
|
14
|
+
* 2. **Plugin .kos.json** - Adds test.plugin.context for plugin testing
|
|
15
|
+
* 3. **Plugin webpack** - Adds withKosConfig and withPluginDevServer
|
|
16
|
+
* 4. **UI webpack** - Adds withPluginDevAggregator for plugin-enabled UIs
|
|
17
|
+
* 5. **Model project.json** - Adds api target for kosui api:generate
|
|
18
|
+
*
|
|
19
|
+
* ## Migration Safety
|
|
20
|
+
*
|
|
21
|
+
* - Idempotent: Can run multiple times safely
|
|
22
|
+
* - Non-destructive: Preserves existing configurations
|
|
23
|
+
* - Checks before modifying files
|
|
24
|
+
* - Reports all changes via logger
|
|
25
|
+
*
|
|
26
|
+
* ## Post-Migration Verification
|
|
27
|
+
*
|
|
28
|
+
* After migration completes, users should:
|
|
29
|
+
* 1. Review `.kos.json` development configuration
|
|
30
|
+
* 2. Verify port assignments match existing setup
|
|
31
|
+
* 3. Test `npm run dev` or `kosui dev` command
|
|
32
|
+
* 4. Check that all expected plugins are registered
|
|
33
|
+
*
|
|
34
|
+
* ## Troubleshooting
|
|
35
|
+
*
|
|
36
|
+
* If migration causes issues:
|
|
37
|
+
* - Check migration output for any errors or warnings
|
|
38
|
+
* - Verify Nx workspace structure is valid
|
|
39
|
+
* - Confirm all projects have .kos.json files
|
|
40
|
+
* - Review generated .kos.json against workspace structure
|
|
41
|
+
*
|
|
42
|
+
* @param tree - Nx virtual file system tree
|
|
43
|
+
* @returns Promise that resolves when migration completes
|
|
44
|
+
*
|
|
45
|
+
* @category Migrations
|
|
46
|
+
* @version 2.1.28
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* // Migration runs automatically via nx migrate
|
|
51
|
+
* // Users execute:
|
|
52
|
+
* // $ nx migrate @kosdev-code/kos-nx-plugin@latest
|
|
53
|
+
* // $ nx migrate --run-migrations
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export default function migrate(tree: Tree): Promise<void>;
|
|
57
|
+
//# sourceMappingURL=migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/migrate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAQlC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAA8B,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const migration_analyzer_1 = require("./coordinators/migration-analyzer");
|
|
7
|
+
const migration_executor_1 = require("./coordinators/migration-executor");
|
|
8
|
+
const migration_reporter_1 = require("./coordinators/migration-reporter");
|
|
9
|
+
/**
|
|
10
|
+
* Automatic migration to add dev server support to existing KOS workspaces.
|
|
11
|
+
*
|
|
12
|
+
* This migration runs automatically when users upgrade to
|
|
13
|
+
* @kosdev-code/kos-nx-plugin@2.1.28+ via `nx migrate`.
|
|
14
|
+
*
|
|
15
|
+
* ## What This Migration Does
|
|
16
|
+
*
|
|
17
|
+
* 1. **Root .kos.json** - Adds development configuration with auto-detected hosts/plugins
|
|
18
|
+
* 2. **Plugin .kos.json** - Adds test.plugin.context for plugin testing
|
|
19
|
+
* 3. **Plugin webpack** - Adds withKosConfig and withPluginDevServer
|
|
20
|
+
* 4. **UI webpack** - Adds withPluginDevAggregator for plugin-enabled UIs
|
|
21
|
+
* 5. **Model project.json** - Adds api target for kosui api:generate
|
|
22
|
+
*
|
|
23
|
+
* ## Migration Safety
|
|
24
|
+
*
|
|
25
|
+
* - Idempotent: Can run multiple times safely
|
|
26
|
+
* - Non-destructive: Preserves existing configurations
|
|
27
|
+
* - Checks before modifying files
|
|
28
|
+
* - Reports all changes via logger
|
|
29
|
+
*
|
|
30
|
+
* ## Post-Migration Verification
|
|
31
|
+
*
|
|
32
|
+
* After migration completes, users should:
|
|
33
|
+
* 1. Review `.kos.json` development configuration
|
|
34
|
+
* 2. Verify port assignments match existing setup
|
|
35
|
+
* 3. Test `npm run dev` or `kosui dev` command
|
|
36
|
+
* 4. Check that all expected plugins are registered
|
|
37
|
+
*
|
|
38
|
+
* ## Troubleshooting
|
|
39
|
+
*
|
|
40
|
+
* If migration causes issues:
|
|
41
|
+
* - Check migration output for any errors or warnings
|
|
42
|
+
* - Verify Nx workspace structure is valid
|
|
43
|
+
* - Confirm all projects have .kos.json files
|
|
44
|
+
* - Review generated .kos.json against workspace structure
|
|
45
|
+
*
|
|
46
|
+
* @param tree - Nx virtual file system tree
|
|
47
|
+
* @returns Promise that resolves when migration completes
|
|
48
|
+
*
|
|
49
|
+
* @category Migrations
|
|
50
|
+
* @version 2.1.28
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* // Migration runs automatically via nx migrate
|
|
55
|
+
* // Users execute:
|
|
56
|
+
* // $ nx migrate @kosdev-code/kos-nx-plugin@latest
|
|
57
|
+
* // $ nx migrate --run-migrations
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
async function migrate(tree) {
|
|
61
|
+
// Zone 1: High-level orchestration
|
|
62
|
+
(0, migration_reporter_1.announceMigrationStart)();
|
|
63
|
+
const requirements = (0, migration_analyzer_1.analyzeMigrationRequirements)(tree);
|
|
64
|
+
const results = (0, migration_executor_1.executeMigrationPlan)(tree, requirements);
|
|
65
|
+
(0, migration_reporter_1.reportMigrationCompletion)(requirements, results);
|
|
66
|
+
}
|
|
67
|
+
exports.default = migrate;
|
|
68
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/migrate.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,0EAAiF;AACjF,0EAAyE;AACzE,0EAG2C;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACY,KAAK,UAAU,OAAO,CAAC,IAAU;IAC9C,mCAAmC;IACnC,IAAA,2CAAsB,GAAE,CAAC;IAEzB,MAAM,YAAY,GAAG,IAAA,iDAA4B,EAAC,IAAI,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,IAAA,yCAAoB,EAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAEzD,IAAA,8CAAyB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AARD,0BAQC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { KosDevConfig } from "../../types/kos-config";
|
|
5
|
+
import type { ProjectInfo } from "./helpers/project-analyzer";
|
|
6
|
+
/**
|
|
7
|
+
* Migration type definitions
|
|
8
|
+
*/
|
|
9
|
+
export interface MigrationRequirements {
|
|
10
|
+
needsRootConfig: boolean;
|
|
11
|
+
uiProjects: ProjectInfo[];
|
|
12
|
+
pluginProjects: ProjectInfo[];
|
|
13
|
+
modelProjects: ProjectInfo[];
|
|
14
|
+
workspaceName: string;
|
|
15
|
+
}
|
|
16
|
+
export interface HostConfiguration {
|
|
17
|
+
name: string;
|
|
18
|
+
project: string;
|
|
19
|
+
port: number;
|
|
20
|
+
type: string;
|
|
21
|
+
pluginContext: string;
|
|
22
|
+
plugins: Array<{
|
|
23
|
+
project: string;
|
|
24
|
+
port: number;
|
|
25
|
+
alias: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface MigrationResults {
|
|
30
|
+
rootConfigUpdated: boolean;
|
|
31
|
+
pluginConfigsUpdated: number;
|
|
32
|
+
uiConfigsUpdated: number;
|
|
33
|
+
pluginWebpackUpdated: number;
|
|
34
|
+
uiWebpackUpdated: number;
|
|
35
|
+
modelProjectsUpdated: number;
|
|
36
|
+
totalChanges: number;
|
|
37
|
+
}
|
|
38
|
+
export { KosDevConfig, ProjectInfo };
|
|
39
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AAEH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,aAAa,EAAE,WAAW,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/kos-nx-plugin/src/migrations/dev-server-support/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|