kitstore-cli 1.0.87 → 1.0.89
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/commands/login.js +6 -0
- package/dist/config.js +22 -2
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -13,7 +13,13 @@ const client_1 = require("../api/client");
|
|
|
13
13
|
*/
|
|
14
14
|
async function loginCommand(options) {
|
|
15
15
|
const config = await (0, config_1.getConfig)();
|
|
16
|
+
// Ensure server is always defined: use explicit option, then config.server (which should always be set by getConfig)
|
|
17
|
+
// If somehow config.server is undefined, getConfig() should have provided a default, but we'll ensure it here
|
|
16
18
|
const server = options.server || config.server;
|
|
19
|
+
// Validate server is defined (should always be true, but safety check)
|
|
20
|
+
if (!server) {
|
|
21
|
+
throw new Error('Server URL is required. Please provide --server option or ensure default-config.json is available.');
|
|
22
|
+
}
|
|
17
23
|
try {
|
|
18
24
|
let email = options.email;
|
|
19
25
|
let password = options.password;
|
package/dist/config.js
CHANGED
|
@@ -57,7 +57,10 @@ async function loadBundledDefaultConfig() {
|
|
|
57
57
|
const defaultConfigPath = path.join(packageDir, 'default-config.json');
|
|
58
58
|
if (await fs.pathExists(defaultConfigPath)) {
|
|
59
59
|
const defaultConfig = await fs.readJson(defaultConfigPath);
|
|
60
|
-
|
|
60
|
+
// Validate that defaultConfig has a server property
|
|
61
|
+
if (defaultConfig && typeof defaultConfig === 'object' && defaultConfig.server) {
|
|
62
|
+
return defaultConfig;
|
|
63
|
+
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
catch (err) {
|
|
@@ -68,7 +71,24 @@ async function loadBundledDefaultConfig() {
|
|
|
68
71
|
const defaultConfigPath = path.join(__dirname, '..', 'default-config.json');
|
|
69
72
|
if (await fs.pathExists(defaultConfigPath)) {
|
|
70
73
|
const defaultConfig = await fs.readJson(defaultConfigPath);
|
|
71
|
-
|
|
74
|
+
// Validate that defaultConfig has a server property
|
|
75
|
+
if (defaultConfig && typeof defaultConfig === 'object' && defaultConfig.server) {
|
|
76
|
+
return defaultConfig;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Strategy 3: Try to find default-config.json in process.cwd()/node_modules/kitstore-cli/
|
|
80
|
+
// This is a fallback for cases where require.resolve doesn't work
|
|
81
|
+
try {
|
|
82
|
+
const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'kitstore-cli', 'default-config.json');
|
|
83
|
+
if (await fs.pathExists(nodeModulesPath)) {
|
|
84
|
+
const defaultConfig = await fs.readJson(nodeModulesPath);
|
|
85
|
+
if (defaultConfig && typeof defaultConfig === 'object' && defaultConfig.server) {
|
|
86
|
+
return defaultConfig;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
// Strategy 3 failed, continue
|
|
72
92
|
}
|
|
73
93
|
}
|
|
74
94
|
catch (err) {
|