Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit f71aa1d

Browse files
authored
Jai/hyp 2571 hyp login error no such file or directory open (#31)
* add ci for build and lint * . * fix hyp login when settings is empty or doesnt exist
1 parent 114989c commit f71aa1d

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/commands/login/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,16 @@ export default class LoginIndex extends Command {
162162
fs.mkdirSync(envDir, {recursive: true})
163163
}
164164

165-
const settings = readSettingsJson(envFilePath)
166-
167-
// Prepare the JSON object with the new content
168-
const newEnvContent = {
165+
const newEnvContent: { HYP_EMAIL: string; HYP_JWT: string; HYP_ORG_ID: string; INSTALLATION_IDS: { [key: string]: string } | null } = {
169166
HYP_EMAIL: email,
170167
HYP_JWT: jwt,
171168
HYP_ORG_ID: orgId,
172-
INSTALLATION_IDS: settings.installationIds,
169+
INSTALLATION_IDS: null,
170+
};
171+
172+
if (fileExists(envFilePath)) {
173+
const settings = readSettingsJson(envFilePath)
174+
newEnvContent.INSTALLATION_IDS = settings.installationIds
173175
}
174176

175177
// Write the new content to the file, replacing any existing content

src/util/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ export function readSettingsJson(filePath: string): {
140140
jwt = jsonContent.HYP_JWT || null
141141
orgId = jsonContent.HYP_ORG_ID || null
142142
installationIds = jsonContent.INSTALLATION_IDS || null
143-
} catch (error) {
144-
console.error('Error parsing JSON content:', error)
143+
} catch {
144+
// ignore error
145145
}
146146

147147
return {

0 commit comments

Comments
 (0)