@storybook/cli 0.0.0-pr-28318-sha-24019b5c → 0.0.0-pr-28255-sha-b988fb35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ var blocker={id:"storyStoreV7removal",async check({mainConfig}){let features=mai
9
9
  Please see the migration guide for more information:
10
10
  ${chalk.yellow("https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#storystorev6-and-storiesof-is-deprecated")}
11
11
 
12
- In your Storybook configuration we found storyStoreV7 feature defined. For instance:
12
+ In your Storybook configuration we found storyStoryV7 feature defined. For instance:
13
13
 
14
14
  export default = {
15
15
  features: {
package/dist/generate.js CHANGED
@@ -5,7 +5,7 @@
5
5
  Please see the migration guide for more information:
6
6
  ${import_chalk40.default.yellow("https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#storystorev6-and-storiesof-is-deprecated")}
7
7
 
8
- In your Storybook configuration we found storyStoreV7 feature defined. For instance:
8
+ In your Storybook configuration we found storyStoryV7 feature defined. For instance:
9
9
 
10
10
  export default = {
11
11
  features: {
package/dist/generate.mjs CHANGED
@@ -632,7 +632,7 @@ ${chalk15.cyan("npx storybook doctor")}`;logger25.info(),foundIssues?(logger25.i
632
632
  ${availableFixes}
633
633
  `);},doAutomigrate=async options=>{let packageManager=JsPackageManagerFactory.getPackageManager({force:options.packageManager}),[packageJson,storybookVersion]=await Promise.all([packageManager.retrievePackageJson(),getCoercedStorybookVersion(packageManager)]),{configDir:inferredConfigDir,mainConfig:mainConfigPath}=getStorybookInfo(packageJson,options.configDir),configDir=options.configDir||inferredConfigDir||".storybook";if(!storybookVersion)throw new Error("Could not determine Storybook version");if(!mainConfigPath)throw new Error("Could not determine main config path");await automigrate({...options,packageManager,storybookVersion,beforeVersion:storybookVersion,mainConfigPath,configDir,isUpgrade:!1,isLatest:!1})&&await doctor({configDir,packageManager:options.packageManager});},automigrate=async({fixId,fixes:inputFixes,dryRun,yes,packageManager,list,configDir,mainConfigPath,storybookVersion,beforeVersion,renderer:rendererPackage,skipInstall,hideMigrationSummary=!1,isUpgrade,isLatest})=>{if(list)return logAvailableMigrations(),null;let selectedFixes=inputFixes||allFixes.filter(fix=>!(fix.id===upgradeStorybookRelatedDependencies.id&&isLatest===!1&&fixId!==upgradeStorybookRelatedDependencies.id)),fixes=fixId?selectedFixes.filter(f=>f.id===fixId):selectedFixes;if(fixId&&fixes.length===0)return logger26.info(`\u{1F4ED} No migrations found for ${chalk15.magenta(fixId)}.`),logAvailableMigrations(),null;await augmentLogsToFile2(),logger26.info("\u{1F50E} checking possible migrations..");let{fixResults,fixSummary,preCheckFailure}=await runFixes({fixes,packageManager,rendererPackage,skipInstall,configDir,mainConfigPath,storybookVersion,beforeVersion,isUpgrade:!!isUpgrade,dryRun,yes});if(Object.values(fixResults).some(r=>r==="failed"||r==="check_failed")?await move(TEMP_LOG_FILE_PATH2,join(process.cwd(),LOG_FILE_NAME2),{overwrite:!0}):await remove(TEMP_LOG_FILE_PATH2),!hideMigrationSummary){let installationMetadata=await packageManager.findInstallations(["@storybook/*","storybook"]);logger26.info(),logger26.info(getMigrationSummary({fixResults,fixSummary,logFile:LOG_FILE_PATH2,installationMetadata})),logger26.info();}return cleanup2(),{fixResults,preCheckFailure}};async function runFixes({fixes,dryRun,yes,rendererPackage,skipInstall,configDir,packageManager,mainConfigPath,storybookVersion,beforeVersion,isUpgrade}){let fixResults={},fixSummary={succeeded:[],failed:{},manual:[],skipped:[]};for(let i=0;i<fixes.length;i+=1){let f=fixes[i],result;try{let{mainConfig,previewConfigPath}=await getStorybookData({configDir,packageManager});(isUpgrade&&semver.satisfies(beforeVersion,f.versionRange[0],{includePrerelease:!0})&&semver.satisfies(storybookVersion,f.versionRange[1],{includePrerelease:!0})||!isUpgrade)&&(result=await f.check({packageManager,configDir,rendererPackage,mainConfig,storybookVersion,previewConfigPath,mainConfigPath}));}catch(error){logger26.info(`\u26A0\uFE0F failed to check fix ${chalk15.bold(f.id)}`),error instanceof Error&&(logger26.error(`
634
634
  ${error.stack}`),fixSummary.failed[f.id]=error.message),fixResults[f.id]="check_failed";}if(result){let promptType=typeof f.promptType=="function"?await f.promptType(result):f.promptType??"auto";logger26.info(`
635
- \u{1F50E} found a '${chalk15.cyan(f.id)}' migration:`);let message=f.prompt(result),getTitle=()=>{switch(promptType){case"auto":return "Automigration detected";case"manual":return "Manual migration detected";case"notification":return "Migration notification"}};logger26.info(boxen(message,{borderStyle:"round",padding:1,borderColor:"#F1618C",title:getTitle()}));let runAnswer;try{if(dryRun)runAnswer={fix:!1};else if(yes)runAnswer={fix:!0},promptType==="manual"&&(fixResults[f.id]="manual_succeeded",fixSummary.manual.push(f.id));else if(promptType==="manual"){fixResults[f.id]="manual_succeeded",fixSummary.manual.push(f.id),logger26.info();let{shouldContinue}=await prompts5({type:"toggle",name:"shouldContinue",message:"Select continue once you have made the required changes, or quit to exit the migration process",initial:!0,active:"continue",inactive:"quit"},{onCancel:()=>{throw new Error}});if(!shouldContinue){fixResults[f.id]="manual_skipped";break}}else promptType==="auto"?runAnswer=await prompts5({type:"confirm",name:"fix",message:`Do you want to run the '${chalk15.cyan(f.id)}' migration on your project?`,initial:f.promptDefaultValue??!0},{onCancel:()=>{throw new Error}}):promptType==="notification"&&(runAnswer=await prompts5({type:"confirm",name:"fix",message:"Do you want to continue?",initial:!0},{onCancel:()=>{throw new Error}}));}catch{break}if(promptType==="auto")if(invariant5(runAnswer,"runAnswer must be defined if not promptOnly"),runAnswer.fix)try{invariant5(typeof f.run=="function","run method should be available in fix."),invariant5(mainConfigPath,"Main config path should be defined to run migration."),await f.run({result,packageManager,dryRun,mainConfigPath,skipInstall}),logger26.info(`\u2705 ran ${chalk15.cyan(f.id)} migration`),fixResults[f.id]="succeeded",fixSummary.succeeded.push(f.id);}catch(error){fixResults[f.id]="failed",fixSummary.failed[f.id]=error instanceof Error?error.message:"Failed to run migration",logger26.info(`\u274C error when running ${chalk15.cyan(f.id)} migration`),logger26.info(error),logger26.info();}else fixResults[f.id]="skipped",fixSummary.skipped.push(f.id);}else fixResults[f.id]=fixResults[f.id]||"unnecessary";}return {fixResults,fixSummary}}var logger27=console;async function migrate(migration,{glob:glob2,dryRun,list,rename,parser,configDir:userSpecifiedConfigDir}){if(list)listCodemods().forEach(key=>logger27.log(key));else if(migration){if(migration==="mdx-to-csf"&&!dryRun){let packageManager=JsPackageManagerFactory.getPackageManager(),[packageJson,storybookVersion]=await Promise.all([packageManager.retrievePackageJson(),getCoercedStorybookVersion(packageManager)]),{configDir:inferredConfigDir,mainConfig:mainConfigPath}=getStorybookInfo(packageJson,userSpecifiedConfigDir),configDir=userSpecifiedConfigDir||inferredConfigDir||".storybook";if(!storybookVersion)throw new Error("Could not determine Storybook version");if(!mainConfigPath)throw new Error("Could not determine main config path");await runFixes({fixes:[mdxToCSF],configDir,mainConfigPath,packageManager,storybookVersion,beforeVersion:storybookVersion,isUpgrade:!1}),await addStorybookBlocksPackage();}await runCodemod(migration,{glob:glob2,dryRun,logger:logger27,rename,parser});}else throw new Error("Migrate: please specify a migration name or --list")}async function addStorybookBlocksPackage(){let packageManager=JsPackageManagerFactory.getPackageManager(),packageJson=await packageManager.retrievePackageJson(),versionToInstall=getStorybookVersionSpecifier(await packageManager.retrievePackageJson());logger27.info('\u2705 Adding "@storybook/blocks" package'),await packageManager.addDependencies({installAsDevDependencies:!0,packageJson},[`@storybook/blocks@${versionToInstall}`]);}var excludesFalse=x=>x!==!1,blockers=()=>[import('./block-storystorev6-2V4XGHW2.mjs'),import('./block-dependencies-versions-ONWPA5NK.mjs'),import('./block-node-version-GDD4HW5I.mjs')],segmentDivider2=`
635
+ \u{1F50E} found a '${chalk15.cyan(f.id)}' migration:`);let message=f.prompt(result),getTitle=()=>{switch(promptType){case"auto":return "Automigration detected";case"manual":return "Manual migration detected";case"notification":return "Migration notification"}};logger26.info(boxen(message,{borderStyle:"round",padding:1,borderColor:"#F1618C",title:getTitle()}));let runAnswer;try{if(dryRun)runAnswer={fix:!1};else if(yes)runAnswer={fix:!0},promptType==="manual"&&(fixResults[f.id]="manual_succeeded",fixSummary.manual.push(f.id));else if(promptType==="manual"){fixResults[f.id]="manual_succeeded",fixSummary.manual.push(f.id),logger26.info();let{shouldContinue}=await prompts5({type:"toggle",name:"shouldContinue",message:"Select continue once you have made the required changes, or quit to exit the migration process",initial:!0,active:"continue",inactive:"quit"},{onCancel:()=>{throw new Error}});if(!shouldContinue){fixResults[f.id]="manual_skipped";break}}else promptType==="auto"?runAnswer=await prompts5({type:"confirm",name:"fix",message:`Do you want to run the '${chalk15.cyan(f.id)}' migration on your project?`,initial:f.promptDefaultValue??!0},{onCancel:()=>{throw new Error}}):promptType==="notification"&&(runAnswer=await prompts5({type:"confirm",name:"fix",message:"Do you want to continue?",initial:!0},{onCancel:()=>{throw new Error}}));}catch{break}if(promptType==="auto")if(invariant5(runAnswer,"runAnswer must be defined if not promptOnly"),runAnswer.fix)try{invariant5(typeof f.run=="function","run method should be available in fix."),invariant5(mainConfigPath,"Main config path should be defined to run migration."),await f.run({result,packageManager,dryRun,mainConfigPath,skipInstall}),logger26.info(`\u2705 ran ${chalk15.cyan(f.id)} migration`),fixResults[f.id]="succeeded",fixSummary.succeeded.push(f.id);}catch(error){fixResults[f.id]="failed",fixSummary.failed[f.id]=error instanceof Error?error.message:"Failed to run migration",logger26.info(`\u274C error when running ${chalk15.cyan(f.id)} migration`),logger26.info(error),logger26.info();}else fixResults[f.id]="skipped",fixSummary.skipped.push(f.id);}else fixResults[f.id]=fixResults[f.id]||"unnecessary";}return {fixResults,fixSummary}}var logger27=console;async function migrate(migration,{glob:glob2,dryRun,list,rename,parser,configDir:userSpecifiedConfigDir}){if(list)listCodemods().forEach(key=>logger27.log(key));else if(migration){if(migration==="mdx-to-csf"&&!dryRun){let packageManager=JsPackageManagerFactory.getPackageManager(),[packageJson,storybookVersion]=await Promise.all([packageManager.retrievePackageJson(),getCoercedStorybookVersion(packageManager)]),{configDir:inferredConfigDir,mainConfig:mainConfigPath}=getStorybookInfo(packageJson,userSpecifiedConfigDir),configDir=userSpecifiedConfigDir||inferredConfigDir||".storybook";if(!storybookVersion)throw new Error("Could not determine Storybook version");if(!mainConfigPath)throw new Error("Could not determine main config path");await runFixes({fixes:[mdxToCSF],configDir,mainConfigPath,packageManager,storybookVersion,beforeVersion:storybookVersion,isUpgrade:!1}),await addStorybookBlocksPackage();}await runCodemod(migration,{glob:glob2,dryRun,logger:logger27,rename,parser});}else throw new Error("Migrate: please specify a migration name or --list")}async function addStorybookBlocksPackage(){let packageManager=JsPackageManagerFactory.getPackageManager(),packageJson=await packageManager.retrievePackageJson(),versionToInstall=getStorybookVersionSpecifier(await packageManager.retrievePackageJson());logger27.info('\u2705 Adding "@storybook/blocks" package'),await packageManager.addDependencies({installAsDevDependencies:!0,packageJson},[`@storybook/blocks@${versionToInstall}`]);}var excludesFalse=x=>x!==!1,blockers=()=>[import('./block-storystorev6-N6QNOLBD.mjs'),import('./block-dependencies-versions-ONWPA5NK.mjs'),import('./block-node-version-GDD4HW5I.mjs')],segmentDivider2=`
636
636
 
637
637
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
638
638
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/cli",
3
- "version": "0.0.0-pr-28318-sha-24019b5c",
3
+ "version": "0.0.0-pr-28255-sha-b988fb35",
4
4
  "description": "Storybook's CLI - install, dev, build, upgrade, and more",
5
5
  "keywords": [
6
6
  "cli",
@@ -59,14 +59,14 @@
59
59
  "@babel/core": "^7.24.4",
60
60
  "@babel/types": "^7.24.0",
61
61
  "@ndelangen/get-tarball": "^3.0.7",
62
- "@storybook/codemod": "0.0.0-pr-28318-sha-24019b5c",
63
- "@storybook/core-common": "0.0.0-pr-28318-sha-24019b5c",
64
- "@storybook/core-events": "0.0.0-pr-28318-sha-24019b5c",
65
- "@storybook/core-server": "0.0.0-pr-28318-sha-24019b5c",
66
- "@storybook/csf-tools": "0.0.0-pr-28318-sha-24019b5c",
67
- "@storybook/node-logger": "0.0.0-pr-28318-sha-24019b5c",
68
- "@storybook/telemetry": "0.0.0-pr-28318-sha-24019b5c",
69
- "@storybook/types": "0.0.0-pr-28318-sha-24019b5c",
62
+ "@storybook/codemod": "0.0.0-pr-28255-sha-b988fb35",
63
+ "@storybook/core-common": "0.0.0-pr-28255-sha-b988fb35",
64
+ "@storybook/core-events": "0.0.0-pr-28255-sha-b988fb35",
65
+ "@storybook/core-server": "0.0.0-pr-28255-sha-b988fb35",
66
+ "@storybook/csf-tools": "0.0.0-pr-28255-sha-b988fb35",
67
+ "@storybook/node-logger": "0.0.0-pr-28255-sha-b988fb35",
68
+ "@storybook/telemetry": "0.0.0-pr-28255-sha-b988fb35",
69
+ "@storybook/types": "0.0.0-pr-28255-sha-b988fb35",
70
70
  "@types/semver": "^7.3.4",
71
71
  "@yarnpkg/fslib": "2.10.3",
72
72
  "@yarnpkg/libzip": "2.3.0",