Skip to content

Commit

Permalink
fix the call to init in the cwd & ignore if next tag is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelangen committed Jan 15, 2024
1 parent ded297c commit 24f72ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/lib/cli/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export const sandbox = async (
force: pkgMgr,
});
const latestVersion = await packageManager.latestVersion('@storybook/cli');
const nextVersion = await packageManager.latestVersion('@storybook/cli@next');
// In verdaccio we often only have the latest tag, so this will fail.
const nextVersion = await packageManager
.latestVersion('@storybook/cli@next')
.catch((e) => '0.0.0');
const currentVersion = versions['@storybook/cli'];
const isPrerelease = prerelease(currentVersion);
const isOutdated = lt(currentVersion, isPrerelease ? nextVersion : latestVersion);
Expand Down Expand Up @@ -215,12 +218,15 @@ export const sandbox = async (
// we warned the user the sandbox step would take longer
if ((isOutdated || isPrerelease) && init) {
// we run doInitiate, instead of initiate, to avoid sending this init event to telemetry, because it's not a real world project
const before = process.cwd();
process.chdir(templateDestination);
await doInitiate(
{
...options,
},
pkg
);
process.chdir(before);
}
} catch (err) {
logger.error(`🚨 Failed to download sandbox template: ${err.message}`);
Expand Down

0 comments on commit 24f72ed

Please sign in to comment.