@kosdev-code/kos-ui-cli 2.1.13 → 2.1.14
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ui-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
4
4
|
"bin": {
|
|
5
5
|
"kosui": "./src/lib/cli.mjs"
|
|
6
6
|
},
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"main": "./src/index.js",
|
|
22
22
|
"kos": {
|
|
23
23
|
"build": {
|
|
24
|
-
"gitHash": "
|
|
24
|
+
"gitHash": "56100d85ce92867188ff952f1697e0347e78e080"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
@@ -8,6 +8,7 @@ import { findStudioHome } from "../../utils/studio-home.mjs";
|
|
|
8
8
|
export const metadata = {
|
|
9
9
|
key: "env",
|
|
10
10
|
name: "Discover and Set Studio Environment Variables",
|
|
11
|
+
namedArguments: { interactive: "interactive" },
|
|
11
12
|
};
|
|
12
13
|
export default async function (plop) {
|
|
13
14
|
plop.setPrompt("directory", directoryPrompt);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// generators/version/index.mjs
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { detectWorkspace } from "../../utils/nx-context.mjs";
|
|
6
|
+
|
|
7
|
+
export const metadata = {
|
|
8
|
+
key: "version",
|
|
9
|
+
name: "Display CLI and SDK Version Information",
|
|
10
|
+
namedArguments: { interactive: "interactive" },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function getPackageVersion(packagePath) {
|
|
14
|
+
try {
|
|
15
|
+
const packageJsonPath = path.join(packagePath, "package.json");
|
|
16
|
+
if (existsSync(packageJsonPath)) {
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
18
|
+
return packageJson.version || "unknown";
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
// Package not found
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function findWorkspaceRoot(startDir = process.cwd()) {
|
|
27
|
+
let dir = startDir;
|
|
28
|
+
while (dir !== path.dirname(dir)) {
|
|
29
|
+
if (existsSync(path.join(dir, "nx.json"))) {
|
|
30
|
+
return dir;
|
|
31
|
+
}
|
|
32
|
+
dir = path.dirname(dir);
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getCliVersion() {
|
|
38
|
+
let version = null;
|
|
39
|
+
|
|
40
|
+
// Option 1: Check workspace root package.json for installed CLI
|
|
41
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
42
|
+
if (workspaceRoot) {
|
|
43
|
+
try {
|
|
44
|
+
const output = execSync(
|
|
45
|
+
"npm list @kosdev-code/kos-ui-cli --depth=0 --json",
|
|
46
|
+
{
|
|
47
|
+
cwd: workspaceRoot,
|
|
48
|
+
encoding: "utf-8",
|
|
49
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
const data = JSON.parse(output);
|
|
53
|
+
version = data?.dependencies?.["@kosdev-code/kos-ui-cli"]?.version;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
// Not in workspace dependencies
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Option 2: Check global installation
|
|
60
|
+
if (!version) {
|
|
61
|
+
try {
|
|
62
|
+
const output = execSync(
|
|
63
|
+
"npm list -g @kosdev-code/kos-ui-cli --depth=0 --json",
|
|
64
|
+
{
|
|
65
|
+
encoding: "utf-8",
|
|
66
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
const data = JSON.parse(output);
|
|
70
|
+
version = data?.dependencies?.["@kosdev-code/kos-ui-cli"]?.version;
|
|
71
|
+
} catch (error) {
|
|
72
|
+
// Not installed globally
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return version || "unknown";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default async function (plop) {
|
|
80
|
+
plop.setActionType("showVersions", async function () {
|
|
81
|
+
console.log("[kos-cli] Discovering version information...\n");
|
|
82
|
+
|
|
83
|
+
const isWorkspace = await detectWorkspace();
|
|
84
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
85
|
+
|
|
86
|
+
const versions = {};
|
|
87
|
+
|
|
88
|
+
// Get CLI version
|
|
89
|
+
versions.cli = getCliVersion();
|
|
90
|
+
|
|
91
|
+
if (isWorkspace && workspaceRoot) {
|
|
92
|
+
// Get SDK versions from workspace dependencies
|
|
93
|
+
const sdkPackages = {
|
|
94
|
+
sdk: ["@kosdev-code/kos-ui-sdk", "@kosdev-code/kos-dispense-sdk"],
|
|
95
|
+
ddk: [
|
|
96
|
+
"@kosdev-code/kos-ddk-components",
|
|
97
|
+
"@kosdev-code/kos-ddk-model-components",
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
for (const [type, packages] of Object.entries(sdkPackages)) {
|
|
102
|
+
for (const pkgName of packages) {
|
|
103
|
+
try {
|
|
104
|
+
const output = execSync(`npm list ${pkgName} --depth=0 --json`, {
|
|
105
|
+
cwd: workspaceRoot,
|
|
106
|
+
encoding: "utf-8",
|
|
107
|
+
stdio: ["pipe", "pipe", "ignore"],
|
|
108
|
+
});
|
|
109
|
+
const data = JSON.parse(output);
|
|
110
|
+
const version = data?.dependencies?.[pkgName]?.version;
|
|
111
|
+
if (version) {
|
|
112
|
+
// Store with short name (without @kosdev-code/ prefix)
|
|
113
|
+
const shortName = pkgName.replace("@kosdev-code/", "");
|
|
114
|
+
versions[shortName] = version;
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
// Package not installed in workspace
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Display results
|
|
124
|
+
console.log("Version Information:");
|
|
125
|
+
console.log("===================\n");
|
|
126
|
+
|
|
127
|
+
if (versions.cli) {
|
|
128
|
+
console.log(`kos-ui-cli: ${versions.cli}`);
|
|
129
|
+
} else {
|
|
130
|
+
console.log("kos-ui-cli: unknown");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (isWorkspace) {
|
|
134
|
+
console.log("");
|
|
135
|
+
console.log("SDK Packages:");
|
|
136
|
+
console.log("-------------");
|
|
137
|
+
|
|
138
|
+
if (versions["kos-ui-sdk"]) {
|
|
139
|
+
console.log(`kos-ui-sdk: ${versions["kos-ui-sdk"]}`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (versions["kos-dispense-sdk"]) {
|
|
143
|
+
console.log(`kos-dispense-sdk: ${versions["kos-dispense-sdk"]}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
console.log("");
|
|
147
|
+
console.log("DDK Packages:");
|
|
148
|
+
console.log("-------------");
|
|
149
|
+
|
|
150
|
+
if (versions["kos-ddk-components"]) {
|
|
151
|
+
console.log(`kos-ddk-components: ${versions["kos-ddk-components"]}`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (versions["kos-ddk-model-components"]) {
|
|
155
|
+
console.log(
|
|
156
|
+
`kos-ddk-model-components: ${versions["kos-ddk-model-components"]}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!versions["kos-ui-sdk"] && !versions["kos-dispense-sdk"]) {
|
|
161
|
+
console.log("(No SDK packages found in workspace)");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
!versions["kos-ddk-components"] &&
|
|
166
|
+
!versions["kos-ddk-model-components"]
|
|
167
|
+
) {
|
|
168
|
+
console.log("(No DDK packages found in workspace)");
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
console.log("\n(Not in workspace - SDK versions unavailable)");
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return "\n";
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
plop.setGenerator("version", {
|
|
178
|
+
description: "Display CLI and SDK version information",
|
|
179
|
+
prompts: [],
|
|
180
|
+
actions: () => [{ type: "showVersions" }],
|
|
181
|
+
});
|
|
182
|
+
}
|
package/src/lib/plopfile.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import registerPluginComponent from "./generators/plugin/index.mjs";
|
|
|
14
14
|
|
|
15
15
|
import registerCacheGenerators from "./generators/cache/index.mjs";
|
|
16
16
|
import registerEnv from "./generators/env/index.mjs";
|
|
17
|
+
import registerVersion from "./generators/version/index.mjs";
|
|
17
18
|
import registerI18nNamespace from "./generators/i18n/namespace.mjs";
|
|
18
19
|
import registerUiProject from "./generators/project/app.mjs";
|
|
19
20
|
import registerContentProject from "./generators/project/content.mjs";
|
|
@@ -57,5 +58,6 @@ export default async function (plop) {
|
|
|
57
58
|
await registerI18n(plop);
|
|
58
59
|
await registerI18nNamespace(plop);
|
|
59
60
|
await registerEnv(plop);
|
|
61
|
+
await registerVersion(plop);
|
|
60
62
|
await registerCacheGenerators(plop);
|
|
61
63
|
}
|