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

Commit d1a8adf

Browse files
authored
Merge pull request #177 from storyblok/bugfix/166-4-pull-commands-hang-if-given-space-id-that-i-dont-have-access-to
fix: added spinnesr fail on try catch error handler
2 parents d80dfa0 + 18aeee8 commit d1a8adf

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

src/commands/components/pull/index.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,41 @@ componentsCommand
4040

4141
const { password, region } = state;
4242

43+
const spinnerGroups = new Spinner({
44+
verbose: !isVitest,
45+
});
46+
const spinnerPresets = new Spinner({
47+
verbose: !isVitest,
48+
});
49+
const spinnerInternalTags = new Spinner({
50+
verbose: !isVitest,
51+
});
52+
const spinnerComponents = new Spinner({
53+
verbose: !isVitest,
54+
});
55+
4356
try {
4457
// Fetch components groups
45-
const spinnerGroups = new Spinner({
46-
verbose: !isVitest,
47-
})
48-
.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components groups')}`);
58+
spinnerGroups.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components groups')}`);
4959

5060
const groups = await fetchComponentGroups(space, password, region);
5161
spinnerGroups.succeed(`${chalk.hex(colorPalette.COMPONENTS)('Groups')} - Completed in ${spinnerGroups.elapsedTime.toFixed(2)}ms`);
5262

5363
// Fetch components presets
54-
const spinnerPresets = new Spinner()
55-
.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components presets')}`);
64+
spinnerPresets.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components presets')}`);
5665

5766
const presets = await fetchComponentPresets(space, password, region);
5867
spinnerPresets.succeed(`${chalk.hex(colorPalette.COMPONENTS)('Presets')} - Completed in ${spinnerPresets.elapsedTime.toFixed(2)}ms`);
5968

6069
// Fetch components internal tags
61-
const spinnerInternalTags = new Spinner()
62-
.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components internal tags')}`);
70+
spinnerInternalTags.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components internal tags')}`);
6371

6472
const internalTags = await fetchComponentInternalTags(space, password, region);
6573
spinnerInternalTags.succeed(`${chalk.hex(colorPalette.COMPONENTS)('Tags')} - Completed in ${spinnerInternalTags.elapsedTime.toFixed(2)}ms`);
6674

6775
// Save everything using the new structure
6876
let components;
69-
const spinnerComponents = new Spinner()
70-
.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components')}`);
77+
spinnerComponents.start(`Fetching ${chalk.hex(colorPalette.COMPONENTS)('components')}`);
7178

7279
if (componentName) {
7380
const component = await fetchComponent(space, componentName, password, region);
@@ -112,6 +119,10 @@ componentsCommand
112119
}
113120
}
114121
catch (error) {
122+
spinnerGroups.failed(`Pulling ${chalk.hex(colorPalette.COMPONENTS)('Groups')} - Failed`);
123+
spinnerPresets.failed(`Pulling ${chalk.hex(colorPalette.COMPONENTS)('Presets')} - Failed`);
124+
spinnerInternalTags.failed(`Pulling ${chalk.hex(colorPalette.COMPONENTS)('Tags')} - Failed`);
125+
spinnerComponents.failed(`Pulling ${chalk.hex(colorPalette.COMPONENTS)('Components')} - Failed`);
115126
handleError(error as Error, verbose);
116127
}
117128
});

0 commit comments

Comments
 (0)