Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/lib/cli-storybook/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export const link = async ({ target, local, start }: LinkOptions) => {
reproDir = join(reprosDir, reproName);
}

const reproPackageJson = JSON.parse(
await readFile(join(reproDir, 'package.json'), { encoding: 'utf8' })
);

const version = spawnSync('yarn', ['--version'], {
cwd: reproDir,
stdio: 'pipe',
Expand All @@ -109,6 +105,10 @@ export const link = async ({ target, local, start }: LinkOptions) => {

logger.info(`Installing ${reproName}`);

const reproPackageJson = JSON.parse(
await readFile(join(reproDir, 'package.json'), { encoding: 'utf8' })
);

if (!reproPackageJson.devDependencies?.vite) {
reproPackageJson.devDependencies = {
...reproPackageJson.devDependencies,
Expand Down
6 changes: 5 additions & 1 deletion scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import path from 'node:path';

import dirSize from 'fast-folder-size';
// eslint-disable-next-line depend/ban-dependencies
import { pathExists, remove } from 'fs-extra';
Expand Down Expand Up @@ -49,7 +51,8 @@ export const sandbox: Task = {

options.link = false;
}
if (await this.ready(details, options)) {

if (!(await this.ready(details, options))) {
logger.info('🗑 Removing old sandbox dir');
await remove(details.sandboxDir);
}
Comment thread
valentinpalkovic marked this conversation as resolved.
Expand Down Expand Up @@ -151,6 +154,7 @@ export const sandbox: Task = {

const packageManager = JsPackageManagerFactory.getPackageManager({}, details.sandboxDir);

await remove(path.join(details.sandboxDir, 'node_modules'));
await packageManager.installDependencies();
Comment thread
valentinpalkovic marked this conversation as resolved.
Comment thread
valentinpalkovic marked this conversation as resolved.

logger.info(`✅ Storybook sandbox created at ${details.sandboxDir}`);
Expand Down