mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 22:11:15 +08:00
Merge pull request #19585 from LBBO/19420-init-remove-deprecated-s-flag
CLI: Remove deprecated `-s` flag on `sb init`
This commit is contained in:
commit
b9af9f72af
@ -1,3 +1,4 @@
|
||||
import path from 'path';
|
||||
import fse from 'fs-extra';
|
||||
import { dedent } from 'ts-dedent';
|
||||
import type { NpmOptions } from '../NpmOptions';
|
||||
@ -195,6 +196,7 @@ export async function baseGenerator(
|
||||
addons: pnp ? addons.map(wrapForPnp) : addons,
|
||||
extensions,
|
||||
commonJs,
|
||||
...(staticDir ? { staticDirs: [path.join('..', staticDir)] } : null),
|
||||
...extraMain,
|
||||
...(type !== 'framework'
|
||||
? {
|
||||
@ -235,7 +237,6 @@ export async function baseGenerator(
|
||||
if (addScripts) {
|
||||
packageManager.addStorybookCommandInScripts({
|
||||
port: 6006,
|
||||
staticFolder: staticDir,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -6,13 +6,14 @@ interface ConfigureMainOptions {
|
||||
addons: string[];
|
||||
extensions?: string[];
|
||||
commonJs?: boolean;
|
||||
staticDirs?: string[];
|
||||
/**
|
||||
* Extra values for main.js
|
||||
*
|
||||
* In order to provide non-serializable data like functions, you can use
|
||||
* { value: '%%yourFunctionCall()%%' }
|
||||
*
|
||||
* '%% and %%' will be replace.
|
||||
* '%% and %%' will be replaced.
|
||||
*
|
||||
*/
|
||||
[key: string]: any;
|
||||
|
@ -304,19 +304,11 @@ export abstract class JsPackageManager {
|
||||
return versions.reverse().find((version) => satisfies(version, constraint));
|
||||
}
|
||||
|
||||
public addStorybookCommandInScripts(options?: {
|
||||
port: number;
|
||||
staticFolder?: string;
|
||||
preCommand?: string;
|
||||
}) {
|
||||
public addStorybookCommandInScripts(options?: { port: number; preCommand?: string }) {
|
||||
const sbPort = options?.port ?? 6006;
|
||||
const storybookCmd = options?.staticFolder
|
||||
? `storybook dev -p ${sbPort} -s ${options.staticFolder}`
|
||||
: `storybook dev -p ${sbPort}`;
|
||||
const storybookCmd = `storybook dev -p ${sbPort}`;
|
||||
|
||||
const buildStorybookCmd = options?.staticFolder
|
||||
? `storybook build -s ${options.staticFolder}`
|
||||
: `storybook build`;
|
||||
const buildStorybookCmd = `storybook build`;
|
||||
|
||||
const preCommand = options?.preCommand ? this.getRunCommand(options.preCommand) : undefined;
|
||||
this.addScripts({
|
||||
|
Loading…
x
Reference in New Issue
Block a user