kitstore-cli 1.0.43 → 1.0.45
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 +1 -1
- package/dist/config.js +19 -1
- package/package.json +1 -1
package/dist/commands/login.js
CHANGED
|
@@ -87,7 +87,7 @@ async function loginCommand(options) {
|
|
|
87
87
|
else if (err && typeof err === 'object') {
|
|
88
88
|
// Try to extract meaningful information from object
|
|
89
89
|
const errObj = err;
|
|
90
|
-
errorMessage = errObj.message || errObj.error || errObj
|
|
90
|
+
errorMessage = errObj.message || errObj.error || String(errObj) || 'Unknown error occurred';
|
|
91
91
|
}
|
|
92
92
|
console.error(`❌ Login failed: ${errorMessage}`);
|
|
93
93
|
process.exit(1);
|
package/dist/config.js
CHANGED
|
@@ -46,7 +46,25 @@ const CONFIG_DIR = process.env.KITSTORE_CONFIG_DIR || path.join(os.homedir(), '.
|
|
|
46
46
|
const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
47
47
|
async function loadBundledDefaultConfig() {
|
|
48
48
|
try {
|
|
49
|
-
// Try to
|
|
49
|
+
// Try multiple path resolution strategies to work in both development and npm-installed contexts
|
|
50
|
+
// Strategy 1: Use require.resolve to find package.json, then resolve config relative to it
|
|
51
|
+
// This works reliably in npm-installed packages where the package is in node_modules
|
|
52
|
+
try {
|
|
53
|
+
// Try to resolve the package.json from the installed package
|
|
54
|
+
// This will work when the package is installed via npm
|
|
55
|
+
const packageJsonPath = require.resolve('kitstore-cli/package.json');
|
|
56
|
+
const packageDir = path.dirname(packageJsonPath);
|
|
57
|
+
const defaultConfigPath = path.join(packageDir, 'default-config.json');
|
|
58
|
+
if (await fs.pathExists(defaultConfigPath)) {
|
|
59
|
+
const defaultConfig = await fs.readJson(defaultConfigPath);
|
|
60
|
+
return defaultConfig;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
// Strategy 1 failed (package not in node_modules or not installed), try Strategy 2
|
|
65
|
+
}
|
|
66
|
+
// Strategy 2: Use __dirname relative path (works in development/local builds)
|
|
67
|
+
// When running from source or local tarball, __dirname points to dist/ directory
|
|
50
68
|
const defaultConfigPath = path.join(__dirname, '..', 'default-config.json');
|
|
51
69
|
if (await fs.pathExists(defaultConfigPath)) {
|
|
52
70
|
const defaultConfig = await fs.readJson(defaultConfigPath);
|