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

Commit d6dd0f8

Browse files
authored
fix: 203-v4-languages-infinite-fetching-for-space-with-no-languages-in-the-list (#204)
* fix: call spinner.failed on warning - Added a spinner failure indication when no languages are found. - Updated the warning message format in the konsola utility for better readability. * chore: enable sourcemaps for debugging * tests: update warning message format in tests
1 parent 99e259f commit d6dd0f8

7 files changed

Lines changed: 12 additions & 5 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"request": "launch",
6363
"name": "Debug Pull languages",
6464
"program": "${workspaceFolder}/dist/index.mjs",
65-
"args": ["languages", "pull", "--space", "2950182323", "--path", ".storyblok"],
65+
"args": ["languages", "pull", "--space", "295018"],
6666
"cwd": "${workspaceFolder}",
6767
"console": "integratedTerminal",
6868
"sourceMaps": true,

build.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export default defineBuildConfig({
44
declaration: true,
55
entries: ['./src/index'],
66
failOnWarn: false,
7+
sourcemap: true,
78
});

src/commands/languages/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('languagesCommand', () => {
138138
vi.mocked(fetchLanguages).mockResolvedValue(mockResponse);
139139

140140
await languagesCommand.parseAsync(['node', 'test', 'pull', '--space', '24568']);
141-
expect(konsola.warn).toHaveBeenCalledWith(`No languages found in the space 24568`);
141+
expect(konsola.warn).toHaveBeenCalledWith(`No languages found in the space 24568`, true);
142142
});
143143
});
144144

src/commands/languages/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ languagesCommand
5252
const internationalization = await fetchLanguages(space, state.password, state.region);
5353

5454
if (!internationalization || internationalization.languages?.length === 0) {
55-
konsola.warn(`No languages found in the space ${space}`);
55+
spinner.failed();
56+
57+
konsola.warn(`No languages found in the space ${space}`, true);
58+
konsola.br();
5659
return;
5760
}
5861
await saveLanguagesToFile(space, internationalization, {

src/utils/konsola.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('konsola', () => {
1616
const consoleSpy = vi.spyOn(console, 'warn');
1717
konsola.warn('This is a test warning message');
1818

19-
expect(consoleSpy).toHaveBeenCalledWith(`${chalk.yellow('⚠️')} This is a test warning message`);
19+
expect(consoleSpy).toHaveBeenCalledWith(`${chalk.yellow('⚠️ ')} This is a test warning message`);
2020
});
2121

2222
it('should prompt a warning message with header', () => {

src/utils/konsola.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const konsola = {
5454
console.warn(formatHeader(warnHeader));
5555
}
5656

57-
console.warn(message ? `${chalk.yellow('⚠️')} ${message}` : '');
57+
console.warn(message ? `${chalk.yellow('⚠️ ')} ${message}` : '');
5858
},
5959
error: (message: string, info?: unknown, options?: KonsolaFormatOptions) => {
6060
if (options?.header) {

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"noFallthroughCasesInSwitch": true,
1414
"noUnusedLocals": true,
1515
"noUnusedParameters": true,
16+
"inlineSourceMap": false,
1617
"noEmit": true,
18+
/* Debugging */
19+
"sourceMap": true,
1720
"allowSyntheticDefaultImports": true,
1821
"esModuleInterop": true,
1922
"isolatedModules": true,

0 commit comments

Comments
 (0)