@uns-kit/cli 0.0.6 → 0.0.8
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/dist/index.js +30 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -223,24 +223,40 @@ function normalizePackageName(input) {
|
|
|
223
223
|
|| "uns-app";
|
|
224
224
|
}
|
|
225
225
|
function resolveCoreVersion() {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return corePkg.version;
|
|
226
|
+
const attempt = (factory) => {
|
|
227
|
+
try {
|
|
228
|
+
return factory();
|
|
230
229
|
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const directVersion = attempt(() => {
|
|
235
|
+
const pkg = require("@uns-kit/core/package.json");
|
|
236
|
+
return pkg?.version;
|
|
237
|
+
});
|
|
238
|
+
if (directVersion) {
|
|
239
|
+
return directVersion;
|
|
231
240
|
}
|
|
232
|
-
|
|
233
|
-
// Ignore and try local path
|
|
234
|
-
}
|
|
235
|
-
try {
|
|
241
|
+
const workspaceVersion = attempt(() => {
|
|
236
242
|
const localPath = path.resolve(__dirname, "../../uns-core/package.json");
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
const pkg = require(localPath);
|
|
244
|
+
return pkg?.version;
|
|
245
|
+
});
|
|
246
|
+
if (workspaceVersion) {
|
|
247
|
+
return workspaceVersion;
|
|
241
248
|
}
|
|
242
|
-
|
|
243
|
-
|
|
249
|
+
const dependencyVersion = attempt(() => {
|
|
250
|
+
const cliPkg = require("../package.json");
|
|
251
|
+
const range = cliPkg.dependencies?.["@uns-kit/core"];
|
|
252
|
+
if (typeof range === "string") {
|
|
253
|
+
const match = range.match(/\d+\.\d+\.\d+/);
|
|
254
|
+
return match?.[0];
|
|
255
|
+
}
|
|
256
|
+
return undefined;
|
|
257
|
+
});
|
|
258
|
+
if (dependencyVersion) {
|
|
259
|
+
return dependencyVersion;
|
|
244
260
|
}
|
|
245
261
|
return "0.0.1";
|
|
246
262
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uns-kit/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Command line scaffolding tool for UNS applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"templates"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@uns-kit/core": "
|
|
28
|
+
"@uns-kit/core": "0.0.6"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc -p tsconfig.build.json",
|