diff --git a/lib/cli/src/repro-generators/scripts.ts b/lib/cli/src/repro-generators/scripts.ts index 8db534e8485..b94baee4224 100644 --- a/lib/cli/src/repro-generators/scripts.ts +++ b/lib/cli/src/repro-generators/scripts.ts @@ -72,16 +72,16 @@ const installYarn2 = async ({ cwd }: Options) => { const configureYarn2 = async ({ cwd }: Options) => { const commands = [ // Create file to ensure yarn will be ok to set some config in the current directory and not in the parent - `touch yarn.lock`, + // NOT NEEDED ANYMORE?`touch yarn.lock`, // ⚠️ Need to set registry because Yarn 2 is not using the conf of Yarn 1 // `yarn config set npmScopes --json '{ "storybook": { "npmRegistryServer": "http://localhost:6000/" } }'`, // Some required magic to be able to fetch deps from local registry - `yarn config set unsafeHttpWhitelist --json '["localhost"]'`, + // ONLY E2E `yarn config set unsafeHttpWhitelist --json '["localhost"]'`, // Disable fallback mode to make sure everything is required correctly - `yarn config set pnpFallbackMode none`, - `yarn config set enableGlobalCache true`, + // ONLY E2E `yarn config set pnpFallbackMode none`, + // ONLY E2E `yarn config set enableGlobalCache true`, // We need to be able to update lockfile when bootstrapping the examples - `yarn config set enableImmutableInstalls false`, + // ONLY E2E `yarn config set enableImmutableInstalls false`, // Add package extensions // https://github.com/facebook/create-react-app/pull/9872 `yarn config set "packageExtensions.react-scripts@*.peerDependencies.react" "*"`, @@ -209,13 +209,12 @@ export const createAndInit = async ( logger.debug(options); logger.log(); - await doTask( - installYarn2, - { ...options, cwd: options.creationPath }, - options.installer === 'yarn dlx' - ); await doTask(generate, { ...options, cwd: options.creationPath }); - await doTask(configureYarn2, options, options.installer === 'yarn dlx'); + + await doTask(installYarn2, options); + // Only e2e + await doTask(configureYarn2, options); + await doTask(addTypescript, options, options.typescript); await doTask(addRequiredDeps, options); await doTask(initStorybook, options); diff --git a/lib/cli/src/repro.ts b/lib/cli/src/repro.ts index c94bf82691c..f5b7f0c9bff 100644 --- a/lib/cli/src/repro.ts +++ b/lib/cli/src/repro.ts @@ -1,7 +1,7 @@ import prompts from 'prompts'; import { logger } from '@storybook/node-logger'; import path from 'path'; -import { createAndInit, Parameters } from './repro-generators/scripts'; +import { createAndInit, Parameters, exec } from './repro-generators/scripts'; import * as configs from './repro-generators/configs'; import { SupportedFrameworks } from './project_types'; @@ -23,7 +23,7 @@ const FRAMEWORKS = Object.values(configs).reduce ); -export const repro = async ({ outputDirectory, list, template, framework, e2e }: ReproOptions) => { +export const repro = async ({ outputDirectory, list, template, framework }: ReproOptions) => { if (list) { logger.info('Available templates'); Object.entries(FRAMEWORKS).forEach(([fmwrk, templates]) => { @@ -82,9 +82,13 @@ export const repro = async ({ outputDirectory, list, template, framework, e2e }: logger.info(`Running ${selectedTemplate} into ${path.join(process.cwd(), selectedDirectory)}`); try { - await createAndInit(path.join(process.cwd(), selectedDirectory), selectedConfig, { - installer: e2e ? 'yarn dlx' : 'npx', + const cwd = path.join(process.cwd(), selectedDirectory); + await createAndInit(cwd, selectedConfig, { + installer: 'npx', }); + await exec('git add --all', { cwd }); + await exec('git commit -am "added storybook"', { cwd }); + await exec('git tag repro-base', { cwd }); } catch (error) { logger.error('Failed to create repro'); }