Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed paths in generated main.cjs for the default sandbox on Windows #20724

Merged
merged 1 commit into from
Jan 24, 2023
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
5 changes: 3 additions & 2 deletions scripts/tasks/sandbox-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from 'fs-extra';
import { join, resolve, sep } from 'path';

import slash from 'slash';
import type { Task } from '../task';
import { executeCLIStep, steps } from '../utils/cli-step';
import { installYarn2, configureYarn2ForVerdaccio, addPackageResolutions } from '../utils/yarn';
Expand Down Expand Up @@ -262,8 +263,8 @@ function addStoriesEntry(mainConfig: ConfigFile, path: string) {
const stories = mainConfig.getFieldValue(['stories']) as string[];

const entry = {
directory: join('../template-stories', path),
titlePrefix: path,
directory: slash(join('../template-stories', path)),
titlePrefix: slash(path),
files: '**/*.@(mdx|stories.@(js|jsx|ts|tsx))',
};

Expand Down
3 changes: 2 additions & 1 deletion scripts/utils/main-js.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { existsSync } from 'fs';
import { join, resolve } from 'path';

import slash from 'slash';
import type { ConfigFile } from '../../code/lib/csf-tools';
import { readConfig } from '../../code/lib/csf-tools';
import { getInterpretedFile } from '../../code/lib/core-common';
Expand All @@ -19,5 +20,5 @@ export async function readMainConfig({ cwd }: { cwd: string }) {

export function addPreviewAnnotations(mainConfig: ConfigFile, paths: string[]) {
const config = mainConfig.getFieldValue(['previewAnnotations']) as string[];
mainConfig.setFieldValue(['previewAnnotations'], [...(config || []), ...paths]);
mainConfig.setFieldValue(['previewAnnotations'], [...(config || []), ...paths.map(slash)]);
}