Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.

Commit d428319

Browse files
committed
refactor: simplify credential handling in creds.ts
- Removed unnecessary imports and a type guard for credential keys to streamline the code. - Enhanced clarity by focusing on the essential functionality of the getCredentials function. - This change improves maintainability and reduces complexity in the credential management logic.
1 parent b3c334c commit d428319

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

src/creds.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import { access } from 'node:fs/promises';
22
import { join } from 'node:path';
3-
import { FileSystemError, handleFileSystemError, konsola } from './utils';
4-
import chalk from 'chalk';
5-
import type { RegionCode } from './constants';
6-
import { colorPalette, regionsDomain } from './constants';
3+
import { FileSystemError, handleFileSystemError } from './utils';
74
import { getStoryblokGlobalPath, readFile, saveToFile } from './utils/filesystem';
85
import type { StoryblokCredentials } from './types';
96

10-
function isCredentialKey(k: string): k is keyof StoryblokCredentials {
11-
return k === 'login' || k === 'password' || k === 'region';
12-
}
13-
147
export const getCredentials = async (filePath = join(getStoryblokGlobalPath(), 'credentials.json')): Promise<StoryblokCredentials | null> => {
158
try {
169
await access(filePath);

0 commit comments

Comments
 (0)