Skip to content

Commit

Permalink
Don't expose testing flag; Only use Env var
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaun Lloyd committed Nov 29, 2023
1 parent 85e2f3a commit 135e638
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
5 changes: 0 additions & 5 deletions code/lib/cli/src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ command('init')
.option('-y --yes', 'Answer yes to all prompts')
.option('-b --builder <webpack5 | vite>', 'Builder library')
.option('-l --linkable', 'Prepare installation for link (contributor helper)')
.option(
'--scaffold-project <name>',
'Scaffold a new project',
process.env.STORYBOOK_SCAFFOLD_PROJECT
)
.action((options: CommandOptions) => {
initiate(options, pkg).catch(() => process.exit(1));
});
Expand Down
2 changes: 1 addition & 1 deletion code/lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async function doInitiate(
// Check if the current directory is empty.
if (options.force !== true && isEmptyDir) {
// Prompt the user to create a new project from our list.
await scaffoldNewProject(packageManager.type, options);
await scaffoldNewProject(packageManager.type);
}

let projectType: ProjectType;
Expand Down
12 changes: 6 additions & 6 deletions code/lib/cli/src/scaffold-new-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { logger } from '@storybook/node-logger';
import { GenerateNewProjectOnInitError } from '@storybook/core-events/server-errors';

import type { PackageManagerName } from './js-package-manager';
import type { CommandOptions } from './generators/types';

type CoercedPackageManagerName = 'npm' | 'yarn' | 'pnpm';

Expand Down Expand Up @@ -107,10 +106,7 @@ const buildProjectDisplayNameForPrint = ({ displayName }: SupportedProject) => {
*
* @param packageManager The package manager to use.
*/
export const scaffoldNewProject = async (
packageManager: PackageManagerName,
{ scaffoldProject }: CommandOptions
) => {
export const scaffoldNewProject = async (packageManager: PackageManagerName) => {
const packageManagerName = packageManagerToCoercedName(packageManager);

logger.plain(
Expand All @@ -134,7 +130,11 @@ export const scaffoldNewProject = async (
);
logger.line(1);

let projectStrategy = SUPPORTED_PROJECTS[scaffoldProject];
let projectStrategy;

if (process.env.STORYBOOK_INIT_EMPTY_TYPE) {
projectStrategy = SUPPORTED_PROJECTS[process.env.STORYBOOK_INIT_EMPTY_TYPE];
}

if (!projectStrategy) {
const { project } = await prompts(
Expand Down

0 comments on commit 135e638

Please sign in to comment.