message: Fixing verbosity check.

diff:
@@ -252,7 +252,7 @@ namespace NUnit.VisualStudio.TestAdapter
}
else if(DisableParallelization && NumberOfTestWorkers > 0)
{
- if(_logger.Verbosity == 0)
+ if(_logger.Verbosity > 0)
{
_logger.Warning(string.Format("DisableParallelization:{0} & NumberOfTestWorkers:{1} are conflicting settings, hence not running in parallel", DisableParallelization, NumberOfTestWorkers));
}

original_message: Fixing verbosity check.


message:
Removed the check to verify if traits are supported by reflection method
Taken a dependency on OM 11.0.0
This will not work with VS2012 and lesser versions of OM.

change_type: MODIFY

diff:
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
- <PackageReference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel" Version="0.0.3" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" PrivateAssets="All" />
<PackageReference Include="Mono.Cecil" Version="0.9.6.4" />
<PackageReference Include="nunit.engine" Version="3.7.0" PrivateAssets="All" />
</ItemGroup>

diff:
@@ -32,52 +32,19 @@ namespace NUnit.VisualStudio.TestAdapter
{
public static class TraitsFeature
{
- private static readonly PropertyInfo TraitsProperty;
- private static readonly MethodInfo TraitsCollectionAdd;
- private static readonly PropertyInfo NameProperty;
- private static readonly PropertyInfo ValueProperty;
-
- static TraitsFeature()
- {
- TraitsProperty = typeof(TestCase).GetProperty("Traits");
- if (TraitsProperty != null)
- {
-
- var traitsCollectionType = TraitsProperty.PropertyType;
- TraitsCollectionAdd = traitsCollectionType.GetMethod("Add", new[] { typeof(string), typeof(string) });
-
- var traitType = Type.GetType("Microsoft.VisualStudio.TestPlatform.ObjectModel.Trait,Microsoft.VisualStudio.TestPlatform.ObjectModel");
- if (traitType != null)
- {
- NameProperty = traitType.GetProperty("Name");
- ValueProperty = traitType.GetProperty("Value");
- }
- }
-
- IsSupported = TraitsProperty != null && NameProperty != null && ValueProperty != null;
- }
-
- public static bool IsSupported { get; private set; }
public static void AddTrait(this TestCase testCase, string name, string value)
{
- if (TraitsCollectionAdd != null)
+ if(testCase != null)
{
- object traitsCollection = TraitsProperty.GetValue(testCase, new object[0]);
- TraitsCollectionAdd.Invoke(traitsCollection, new object[] { name, value });
+ testCase.Traits.Add(new Trait(name, value));
}
}
- public static void AddTraitsFromTestNode(this TestCase testCase, XmlNode testNode)
- {
- if (IsSupported)
- AddTraitsFromTestNode(testNode, TraitsProperty.GetValue(testCase, new object[0]));
- }
-
- private static void AddTraitsFromTestNode(XmlNode test, object traitsCollection)
+ public static void AddTraitsFromTestNode(this TestCase testCase, XmlNode test)
{
if (test.ParentNode != null)
- AddTraitsFromTestNode(test.ParentNode, traitsCollection);
+ AddTraitsFromTestNode(testCase, test.ParentNode);
foreach (XmlNode propertyNode in test.SelectNodes("properties/property"))
{
@@ -87,7 +54,7 @@ namespace NUnit.VisualStudio.TestAdapter
// Property names starting with '_' are for internal use only
if (!string.IsNullOrEmpty(propertyName) && propertyName[0] != '_' && !string.IsNullOrEmpty(propertyValue))
{
- TraitsCollectionAdd.Invoke(traitsCollection, new object[] { propertyName, propertyValue });
+ AddTrait(testCase, propertyName, propertyValue);
}
}
}
@@ -96,12 +63,9 @@ namespace NUnit.VisualStudio.TestAdapter
{
var traits = new List<NTrait>();
- if (IsSupported)
+ if (testCase != null && testCase.Traits != null)
{
- var traitsCollection = TraitsProperty.GetValue(testCase, new object[0]) as IEnumerable<object>;
-
- if (traitsCollection != null)
- traits.AddRange(from traitObject in traitsCollection let name = NameProperty.GetValue(traitObject, new object[0]) as string let value = ValueProperty.GetValue(traitObject, new object[0]) as string select new NTrait(name, value));
+ traits.AddRange(from trait in testCase.Traits let name = trait.Name let value = trait.Value select new NTrait(name, value));
}
return traits;

diff:
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
- <PackageReference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel" Version="0.0.3" PrivateAssets="All" />
+ <PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="11.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">

diff:
@@ -104,14 +104,9 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
Assert.That(testCase.LineNumber, Is.EqualTo(FakeTestData.LineNumber));
}
- // Check traits using reflection, since the feature was added
- // in an update to VisualStudio and may not be present.
- if (TraitsFeature.IsSupported)
- {
var traitList = testCase.GetTraits().Select(trait => trait.Name + ":" + trait.Value).ToList();
Assert.That(traitList, Is.EquivalentTo(new[] { "Category:super", "Category:cat1", "Priority:medium" }));
}
}
}
-}

diff:
@@ -45,8 +45,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[Test]
public void PropertyValueProviderCategoryWithOneCategory()
{
- CheckTraitsSupported();
-
var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
tc.AddTrait("Category", "CI");
var testFilter = new TfsTestFilter(null);
@@ -57,8 +55,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[Test]
public void PropertyValueProviderCategoryWithNoTraits()
{
- CheckTraitsSupported();
-
var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
var testFilter = new TfsTestFilter(null);
var obj = TfsTestFilter.PropertyValueProvider(tc, "TestCategory");
@@ -68,8 +64,6 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
[Test]
public void PropertyValueProviderCategoryWithMultipleCategories()
{
- CheckTraitsSupported();
-
var tc = new TestCase("Test1", new Uri("executor://NUnitTestExecutor"), "NUnit.VSIX");
tc.AddTrait("Category", "CI");
tc.AddTrait("Category", "MyOwn");
@@ -90,11 +84,5 @@ namespace NUnit.VisualStudio.TestAdapter.Tests
var obj = TfsTestFilter.PropertyValueProvider(tc, "Garbage");
Assert.Null(obj);
}
-
- private static void CheckTraitsSupported()
- {
- if (!TraitsFeature.IsSupported)
- Assert.Inconclusive("This version of Visual Studio does not support Traits");
- }
}
}

license: MIT License

original_message:
Removed the check to verify if traits are supported by reflection method

- Taken a dependency on OM 11.0.0
- This will not work with VS2012 and lesser versions of OM.


message: used the nameof

diff:
@@ -143,15 +143,15 @@ namespace NUnit.VisualStudio.TestAdapter
Verbosity = GetInnerTextAsInt(nunitNode, nameof(Verbosity), 0);
var runConfiguration = doc.SelectSingleNode("RunSettings/RunConfiguration");
- MaxCpuCount = GetInnerTextAsInt(runConfiguration, "MaxCpuCount", -1);
- ResultsDirectory = GetInnerTextWithLog(runConfiguration, "ResultsDirectory");
- TargetPlatform = GetInnerTextWithLog(runConfiguration, "TargetPlatform");
- TargetFrameworkVersion = GetInnerTextWithLog(runConfiguration, "TargetFrameworkVersion");
- TestAdapterPaths = GetInnerTextWithLog(runConfiguration, "TestAdapterPaths");
- CollectSourceInformation = GetInnerTextAsBool(runConfiguration, "CollectSourceInformation", true);
- DisableAppDomain = GetInnerTextAsBool(runConfiguration, "DisableAppDomain", false);
- DisableParallelization = GetInnerTextAsBool(runConfiguration, "DisableParallelization", false);
- DesignMode = GetInnerTextAsBool(runConfiguration, "DesignMode", false);
+ MaxCpuCount = GetInnerTextAsInt(runConfiguration, nameof(MaxCpuCount), -1);
+ ResultsDirectory = GetInnerTextWithLog(runConfiguration, nameof(ResultsDirectory));
+ TargetPlatform = GetInnerTextWithLog(runConfiguration, nameof(TargetPlatform));
+ TargetFrameworkVersion = GetInnerTextWithLog(runConfiguration, nameof(TargetFrameworkVersion));
+ TestAdapterPaths = GetInnerTextWithLog(runConfiguration, nameof(TestAdapterPaths));
+ CollectSourceInformation = GetInnerTextAsBool(runConfiguration, nameof(CollectSourceInformation), true);
+ DisableAppDomain = GetInnerTextAsBool(runConfiguration, nameof(DisableAppDomain), false);
+ DisableParallelization = GetInnerTextAsBool(runConfiguration, nameof(DisableParallelization), false);
+ DesignMode = GetInnerTextAsBool(runConfiguration, nameof(DesignMode), false);
TestProperties = new Dictionary<string, string>();
foreach (XmlNode node in doc.SelectNodes("RunSettings/TestRunParameters/Parameter"))

original_message: used the nameof


message: Add tests to validate untraced flag

diff:
@@ -470,6 +470,90 @@ describe('getDependentStoryFiles', () => {
const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
expect(res).toEqual({});
});
+
+ it('does not bail on untraced global files', async () => {
+ const changedFiles = [
+ 'src/utils.js',
+ 'src/package.json',
+ 'src/package-lock.json',
+ 'src/yarn.lock',
+ ];
+ const modules = [
+ {
+ id: './src/utils.js',
+ name: './src/utils.js', // changed
+ reasons: [{ moduleName: './src/foo.js' }],
+ },
+ {
+ id: './src/foo.js',
+ name: './src/foo.js', // untraced
+ reasons: [{ moduleName: './src/foo.stories.js' }],
+ },
+ {
+ id: './src/foo.stories.js',
+ name: './src/foo.stories.js',
+ reasons: [{ moduleName: CSF_GLOB }],
+ },
+ {
+ id: 997,
+ name: CSF_GLOB,
+ reasons: [{ moduleName: './.storybook/generated-stories-entry.js' }],
+ },
+ ];
+ const ctx = getContext({
+ staticDir: ['path/to/statics'],
+ untraced: ['**/package.json', '**/package-lock.json', '**/yarn.lock'],
+ });
+ const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
+ expect(ctx.turboSnap.bailReason).toBeUndefined();
+ expect(res).toEqual({
+ './src/foo.stories.js': ['src/foo.stories.js'],
+ });
+ });
+
+ it('does not bail on changed dependency of untraced config file and untraced dependency', async () => {
+ const changedFiles = ['src/utils.js', 'src/docs-decorator.jsx'];
+ const modules = [
+ {
+ id: './path/to/storybook-config/preview.js',
+ name: './path/to/storybook-config/preview.js',
+ modules: [
+ { name: './path/to/storybook-config/preview.js' },
+ { name: './src/docs-decorator.jsx' },
+ ],
+ reasons: [],
+ },
+ {
+ id: './src/utils.js',
+ name: './src/utils.js', // changed
+ reasons: [{ moduleName: './src/foo.js' }],
+ },
+ {
+ id: './src/foo.js',
+ name: './src/foo.js', // untraced
+ reasons: [{ moduleName: './src/foo.stories.js' }],
+ },
+ {
+ id: './src/foo.stories.js',
+ name: './src/foo.stories.js',
+ reasons: [{ moduleName: CSF_GLOB }],
+ },
+ {
+ id: CSF_GLOB,
+ name: CSF_GLOB,
+ reasons: [{ moduleName: './path/to/storybook-config/generated-stories-entry.js' }],
+ },
+ ];
+ const ctx = getContext({
+ configDir: 'path/to/storybook-config',
+ untraced: ['**/docs-decorator.jsx', '**/path/to/storybook-config/preview.js'],
+ });
+ const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
+ expect(ctx.turboSnap.bailReason).toBeUndefined();
+ expect(res).toEqual({
+ './src/foo.stories.js': ['src/foo.stories.js'],
+ });
+ });
});
describe('normalizePath', () => {

repo: chromaui/chromatic-cli

original_message: Add tests to validate untraced flag


message: Updated test to untrace generated entry file

diff:
@@ -515,10 +515,10 @@ describe('getDependentStoryFiles', () => {
const changedFiles = ['src/utils.js', 'src/docs-decorator.jsx'];
const modules = [
{
- id: './path/to/storybook-config/preview.js',
- name: './path/to/storybook-config/preview.js',
+ id: './path/to/storybook-config/preview.js-generated-config-entry.js',
+ name: './path/to/storybook-config/preview.js-generated-config-entry.js + 1 modules',
modules: [
- { name: './path/to/storybook-config/preview.js' },
+ { name: './path/to/storybook-config/preview.js-generated-config-entry.js' },
{ name: './src/docs-decorator.jsx' },
],
reasons: [],
@@ -546,7 +546,10 @@ describe('getDependentStoryFiles', () => {
];
const ctx = getContext({
configDir: 'path/to/storybook-config',
- untraced: ['**/docs-decorator.jsx', '**/path/to/storybook-config/preview.js'],
+ untraced: [
+ '**/docs-decorator.jsx',
+ '**/path/to/storybook-config/preview.js-generated-config-entry.js',
+ ],
});
const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
expect(ctx.turboSnap.bailReason).toBeUndefined();


message: Added two new tests to test dependencies

diff:
@@ -511,18 +511,23 @@ describe('getDependentStoryFiles', () => {
});
});
- it('does not bail on changed dependency of untraced config file and untraced dependency', async () => {
- const changedFiles = ['src/utils.js', 'src/docs-decorator.jsx'];
+ it('does not bail on changed wrapper component of untraced config file', async () => {
+ const changedFiles = ['src/utils.js', 'src/docs-wrapper.jsx'];
const modules = [
{
id: './path/to/storybook-config/preview.js-generated-config-entry.js',
- name: './path/to/storybook-config/preview.js-generated-config-entry.js + 1 modules',
+ name: './path/to/storybook-config/preview.js-generated-config-entry.js + 28 modules', // untraced
modules: [
{ name: './path/to/storybook-config/preview.js-generated-config-entry.js' },
- { name: './src/docs-decorator.jsx' },
+ { name: './src/docs-wrapper.jsx' },
],
reasons: [],
},
+ {
+ id: './src/docs-wrapper.jsx',
+ name: './src/docs-wrapper.jsx', // untraced
+ reasons: [{ moduleName: './src/docs-wrapper.stories.js' }],
+ },
{
id: './src/utils.js',
name: './src/utils.js', // changed
@@ -530,7 +535,7 @@ describe('getDependentStoryFiles', () => {
},
{
id: './src/foo.js',
- name: './src/foo.js', // untraced
+ name: './src/foo.js',
reasons: [{ moduleName: './src/foo.stories.js' }],
},
{
@@ -547,7 +552,7 @@ describe('getDependentStoryFiles', () => {
const ctx = getContext({
configDir: 'path/to/storybook-config',
untraced: [
- '**/docs-decorator.jsx',
+ '**/docs-wrapper.jsx',
'**/path/to/storybook-config/preview.js-generated-config-entry.js',
],
});
@@ -557,6 +562,119 @@ describe('getDependentStoryFiles', () => {
'./src/foo.stories.js': ['src/foo.stories.js'],
});
});
+
+ it('does not bail on changed wrapper component of untraced config file and untraced dependencies of a wrapper component', async () => {
+ const changedFiles = ['src/utils.js', 'src/packages/design-system/components/button.jsx'];
+ const modules = [
+ {
+ id: './path/to/storybook-config/preview.js-generated-config-entry.js',
+ name: './path/to/storybook-config/preview.js-generated-config-entry.js + 28 modules', // untraced
+ modules: [
+ { name: './path/to/storybook-config/preview.js-generated-config-entry.js' },
+ { name: './src/docs-wrapper.jsx' },
+ ],
+ reasons: [],
+ },
+ {
+ id: './src/docs-wrapper.jsx',
+ name: './src/docs-wrapper.jsx',
+ reasons: [{ moduleName: './src/packages/design-system/components/button.jsx' }],
+ },
+ {
+ id: './src/packages/design-system/components/button.jsx',
+ name: './src/packages/design-system/components/button.jsx', // changed
+ reasons: [{ moduleName: './src/packages/design-system/components/button.stories.js' }],
+ },
+ {
+ id: './src/utils.js',
+ name: './src/utils.js', // changed
+ reasons: [{ moduleName: './src/foo.js' }],
+ },
+ {
+ id: './src/foo.js',
+ name: './src/foo.js',
+ reasons: [{ moduleName: './src/foo.stories.js' }],
+ },
+ {
+ id: './src/foo.stories.js',
+ name: './src/foo.stories.js',
+ reasons: [{ moduleName: CSF_GLOB }],
+ },
+ {
+ id: CSF_GLOB,
+ name: CSF_GLOB,
+ reasons: [{ moduleName: './path/to/storybook-config/generated-stories-entry.js' }],
+ },
+ ];
+ const ctx = getContext({
+ configDir: 'path/to/storybook-config',
+ untraced: ['**/docs-wrapper.jsx'],
+ });
+ const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
+ expect(ctx.turboSnap.bailReason).toBeUndefined();
+ expect(res).toEqual({
+ './src/foo.stories.js': ['src/foo.stories.js'],
+ });
+ });
+
+ it('does not bail on changed dynamic import of untraced config file', async () => {
+ const changedFiles = ['src/utils.js', 'src/packages/design-system/components/button.jsx'];
+ const modules = [
+ {
+ id: './path/to/storybook-config/preview.js-generated-config-entry.js',
+ name: './path/to/storybook-config/preview.js-generated-config-entry.js + 28 modules', // untraced
+ modules: [
+ { name: './path/to/storybook-config/preview.js-generated-config-entry.js' },
+ { name: './src/docs-wrapper.jsx' },
+ ],
+ reasons: [],
+ },
+ {
+ id: './src/docs-wrapper.jsx',
+ name: './src/docs-wrapper.jsx',
+ reasons: [{ moduleName: './src/packages/design-system/component/src/component.jsx' }],
+ },
+ {
+ id: './src/packages/design-system/component/src/component.jsx',
+ name: './src/packages/design-system/component/src/component.jsx',
+ reasons: [{ moduleName: './src/packages/design-system/components/button.jsx' }],
+ },
+ {
+ id: './src/packages/design-system/components/button.jsx',
+ name: './src/packages/design-system/components/button.jsx', // changed
+ reasons: [{ moduleName: './src/packages/design-system/components/button.stories.js' }],
+ },
+ {
+ id: './src/utils.js',
+ name: './src/utils.js', // changed
+ reasons: [{ moduleName: './src/foo.js' }],
+ },
+ {
+ id: './src/foo.js',
+ name: './src/foo.js',
+ reasons: [{ moduleName: './src/foo.stories.js' }],
+ },
+ {
+ id: './src/foo.stories.js',
+ name: './src/foo.stories.js',
+ reasons: [{ moduleName: CSF_GLOB }],
+ },
+ {
+ id: CSF_GLOB,
+ name: CSF_GLOB,
+ reasons: [{ moduleName: './path/to/storybook-config/generated-stories-entry.js' }],
+ },
+ ];
+ const ctx = getContext({
+ configDir: 'path/to/storybook-config',
+ untraced: ['**/docs-wrapper.jsx'],
+ });
+ const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
+ expect(ctx.turboSnap.bailReason).toBeUndefined();
+ expect(res).toEqual({
+ './src/foo.stories.js': ['src/foo.stories.js'],
+ });
+ });
});
describe('normalizePath', () => {


message: Added story for storybook config untraced

diff:
@@ -501,7 +501,6 @@ describe('getDependentStoryFiles', () => {
},
];
const ctx = getContext({
- staticDir: ['path/to/statics'],
untraced: ['**/package.json', '**/package-lock.json', '**/yarn.lock'],
});
const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
@@ -511,6 +510,40 @@ describe('getDependentStoryFiles', () => {
});
});
+ it('does not bail on untraced Storybook config files', async () => {
+ const changedFiles = ['src/utils.js', '.storybook/preview.js'];
+ const modules = [
+ {
+ id: './src/utils.js',
+ name: './src/utils.js', // changed
+ reasons: [{ moduleName: './src/foo.js' }],
+ },
+ {
+ id: './src/foo.js',
+ name: './src/foo.js', // untraced
+ reasons: [{ moduleName: './src/foo.stories.js' }],
+ },
+ {
+ id: './src/foo.stories.js',
+ name: './src/foo.stories.js',
+ reasons: [{ moduleName: CSF_GLOB }],
+ },
+ {
+ id: 997,
+ name: CSF_GLOB,
+ reasons: [{ moduleName: './.storybook/generated-stories-entry.js' }],
+ },
+ ];
+ const ctx = getContext({
+ untraced: ['**/preview.js'],
+ });
+ const res = await getDependentStoryFiles(ctx, { modules }, statsPath, changedFiles);
+ expect(ctx.turboSnap.bailReason).toBeUndefined();
+ expect(res).toEqual({
+ './src/foo.stories.js': ['src/foo.stories.js'],
+ });
+ });
+
it('does not bail on changed wrapper component of untraced config file', async () => {
const changedFiles = ['src/utils.js', 'src/docs-wrapper.jsx'];
const modules = [
@@ -617,7 +650,7 @@ describe('getDependentStoryFiles', () => {
});
});
- it('does not bail on changed dynamic import of untraced config file', async () => {
+ it('does not bail on changed dependency in dynamic import of untraced config file', async () => {
const changedFiles = ['src/utils.js', 'src/packages/design-system/components/button.jsx'];
const modules = [
{
@@ -632,11 +665,11 @@ describe('getDependentStoryFiles', () => {
{
id: './src/docs-wrapper.jsx',
name: './src/docs-wrapper.jsx',
- reasons: [{ moduleName: './src/packages/design-system/component/src/component.jsx' }],
+ reasons: [{ moduleName: './src/packages/website/containers/ weak ^\\.\\/.*\\/index$' }],
},
{
- id: './src/packages/design-system/component/src/component.jsx',
- name: './src/packages/design-system/component/src/component.jsx',
+ id: './packages/website/containers/ weak ^\\.\\/.*\\/index$',
+ name: './packages/website/containers/ weak ^\\.\\/.*\\/index$',
reasons: [{ moduleName: './src/packages/design-system/components/button.jsx' }],
},
{


message: use staticDirs in main.js

diff:
@@ -6,6 +6,7 @@ module.exports = {
core: {
builder: 'webpack5',
},
+ staticDirs: ['../static'],
webpackFinal: async (config, { configType }) => {
config.resolve = {
...config.resolve,

diff:
],
"scripts": {
"build": "npm-run-all --serial -l bundle:**",
- "build-storybook": "build-storybook -s static",
+ "build-storybook": "build-storybook",
"build-test-storybook": "cross-env SMOKE_TEST=true build-storybook -o test-storybook",
"build-subdir": "cd subdir ; yarn build ; cd ..",
"chromatic": "./bin/main.cjs",
"release": "node scripts/release.js",
"trace": "node -r esm bin-src/trace.js",
"trim-stats": "node -r esm bin-src/trim-stats-file.js",
- "storybook": "start-storybook -p 9009 -s static",
+ "storybook": "start-storybook -p 9009",
"test": "jest",
"prepare": "husky install",
"bundle:bin": "webpack --config=webpack-bin.config.js && chmod +x ./bin/main.cjs",

original_message: use staticDirs in main.js


message: add back getInstalledStorybookInfo via yarn

diff:
@@ -2,12 +2,44 @@ import fs from 'fs-extra';
import meow from 'meow';
import { parseArgsStringToArgv } from 'string-argv';
import semver from 'semver';
+import execa from 'execa';
+
import noViewLayerPackage from '../ui/messages/errors/noViewLayerPackage';
import { viewLayers } from './viewLayers';
import { supportedAddons } from './supportedAddons';
import { timeout, raceFulfilled } from './promises';
import { Context } from '../types';
+export const getInstalledStorybookInfo = async () => {
+ const { all } = await execa.command('yarn list --pattern @storybook/ --json', {
+ env: {},
+ timeout: 10000,
+ all: true,
+ shell: true,
+ });
+
+ const { data } = JSON.parse(all as any);
+ const trees: { name: string; version: string }[] = data.trees.map((p: any) => {
+ const [, name, version] = p.name.match(/(.+)@(.+)/);
+ return { name, version };
+ });
+
+ const viewLayer = trees.find(({ name }) => viewLayers[name]);
+ const addons = trees.filter(({ name }) => supportedAddons[name]);
+
+ const result = {
+ viewLayer: viewLayers[viewLayer ? viewLayer.name : ''],
+ version: viewLayer ? viewLayer.version : undefined,
+ addons: addons.map((a) => ({
+ packageVersion: a.version,
+ packageName: a.name,
+ name: supportedAddons[a.name],
+ })),
+ };
+
+ return result;
+};
+
const resolvePackageJson = (pkg: string) => {
try {
// we bundle this app for node, meaning all require calls are replaced by webpack.
@@ -134,6 +166,10 @@ export default async function getStorybookInfo(
const info = await Promise.all([findAddons(ctx), findConfigFlags(ctx), findViewlayer(ctx)]);
return info.reduce((acc, obj) => Object.assign(acc, obj), {});
} catch (e) {
+ const result = await getInstalledStorybookInfo();
+ if (result.viewLayer) {
+ return result;
+ }
return { viewLayer: null, version: null, addons: [] };
}
}


message: Add new test for when yarn search does not come up with anything

change_type: ADD

diff:
+import execa from 'execa';
+import { viewLayers } from './viewLayers';
+import { supportedAddons } from './supportedAddons';
+
+export const getInstalledStorybookInfo = async () => {
+ const { all } = await execa.command('yarn list --pattern @storybook/ --json', {
+ env: {},
+ timeout: 10000,
+ all: true,
+ shell: true,
+ });
+
+ const { data } = JSON.parse(all as any);
+ const trees: { name: string; version: string }[] = data.trees.map((p: any) => {
+ const [, name, version] = p.name.match(/(.+)@(.+)/);
+ return { name, version };
+ });
+
+ const viewLayer = trees.find(({ name }) => viewLayers[name]);
+ const addons = trees.filter(({ name }) => supportedAddons[name]);
+
+ const result = {
+ viewLayer: viewLayers[viewLayer ? viewLayer.name : ''],
+ version: viewLayer ? viewLayer.version : undefined,
+ addons: addons.map((a) => ({
+ packageVersion: a.version,
+ packageName: a.name,
+ name: supportedAddons[a.name],
+ })),
+ };
+
+ return result;
+};
+
+export default getInstalledStorybookInfo;

diff:
import { Context } from '../types';
import getStorybookInfo from './getStorybookInfo';
+import { getInstalledStorybookInfo } from './getInstalledStorybookPackages';
jest.useFakeTimers();
+jest.mock('./getInstalledStorybookPackages', () => {
+ const original = jest.requireActual('./getInstalledStorybookPackages'); // Step 2.
+ return {
+ __esModule: true,
+ ...original,
+ getInstalledStorybookInfo: jest.fn(() => ({
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
+ })),
+ };
+});
+
const log = { info: jest.fn(), warn: jest.fn(), error: jest.fn(), debug: jest.fn() };
const context: Context = { env: {}, log, options: {}, packageJson: {} } as any;
const getContext = (ctx: any): Context => ({ ...context, ...ctx });
@@ -52,9 +72,15 @@ describe('getStorybookInfo', () => {
it('throws on missing package', async () => {
const ctx = getContext({ packageJson: { dependencies: VUE } });
await expect(getStorybookInfo(ctx)).resolves.toEqual({
- addons: [],
- version: null,
- viewLayer: null,
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
});
});
@@ -106,18 +132,30 @@ describe('getStorybookInfo', () => {
it('throws on invalid value', async () => {
const ctx = getContext({ env: { CHROMATIC_STORYBOOK_VERSION: '3.2.1' } });
await expect(getStorybookInfo(ctx)).resolves.toEqual({
- addons: [],
- version: null,
- viewLayer: null,
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
});
});
it('throws on unsupported viewlayer', async () => {
const ctx = getContext({ env: { CHROMATIC_STORYBOOK_VERSION: '@storybook/native@3.2.1' } });
await expect(getStorybookInfo(ctx)).resolves.toEqual({
- addons: [],
- version: null,
- viewLayer: null,
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
});
});
});
@@ -129,8 +167,24 @@ describe('getStorybookInfo', () => {
packageJson: { dependencies: REACT },
});
await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '1.2.3' })
+ expect.objectContaining({ viewLayer: 'react', version: '^1.2.3' })
);
});
});
+
+ it('cannot find packages via either method', async () => {
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
+ getInstalledStorybookInfo.mockImplementation(() => ({
+ viewLayer: '',
+ version: undefined,
+ addons: [],
+ }));
+ const ctx = getContext({ packageJson: { dependencies: VUE } });
+ await expect(getStorybookInfo(ctx)).resolves.toEqual({
+ addons: [],
+ version: null,
+ viewLayer: null,
+ });
+ });
});

diff:
@@ -2,43 +2,13 @@ import fs from 'fs-extra';
import meow from 'meow';
import { parseArgsStringToArgv } from 'string-argv';
import semver from 'semver';
-import execa from 'execa';
import noViewLayerPackage from '../ui/messages/errors/noViewLayerPackage';
import { viewLayers } from './viewLayers';
import { supportedAddons } from './supportedAddons';
import { timeout, raceFulfilled } from './promises';
import { Context } from '../types';
-
-export const getInstalledStorybookInfo = async () => {
- const { all } = await execa.command('yarn list --pattern @storybook/ --json', {
- env: {},
- timeout: 10000,
- all: true,
- shell: true,
- });
-
- const { data } = JSON.parse(all as any);
- const trees: { name: string; version: string }[] = data.trees.map((p: any) => {
- const [, name, version] = p.name.match(/(.+)@(.+)/);
- return { name, version };
- });
-
- const viewLayer = trees.find(({ name }) => viewLayers[name]);
- const addons = trees.filter(({ name }) => supportedAddons[name]);
-
- const result = {
- viewLayer: viewLayers[viewLayer ? viewLayer.name : ''],
- version: viewLayer ? viewLayer.version : undefined,
- addons: addons.map((a) => ({
- packageVersion: a.version,
- packageName: a.name,
- name: supportedAddons[a.name],
- })),
- };
-
- return result;
-};
+import { getInstalledStorybookInfo } from './getInstalledStorybookPackages';
const resolvePackageJson = (pkg: string) => {
try {


message: remove semverRange from the env var runs

diff:
@@ -104,24 +104,6 @@ describe('getStorybookInfo', () => {
);
});
- it('returns viewLayer and version from with env with caret in version', async () => {
- const ctx = getContext({
- env: { CHROMATIC_STORYBOOK_VERSION: '@storybook/react@^3.2.1' },
- });
- await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '>=3.2.1 <4.0.0-0' })
- );
- });
-
- it('returns viewLayer and version from with env with tilda in version', async () => {
- const ctx = getContext({
- env: { CHROMATIC_STORYBOOK_VERSION: '@storybook/react@~3.2.1' },
- });
- await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '>=3.2.1 <3.3.0-0' })
- );
- });
-
it('supports unscoped package name', async () => {
const ctx = getContext({ env: { CHROMATIC_STORYBOOK_VERSION: 'react@3.2.1' } });
await expect(getStorybookInfo(ctx)).resolves.toEqual(

diff:
@@ -37,7 +37,7 @@ const findViewlayer = async ({ env, log, options, packageJson }) => {
// Allow setting Storybook version via CHROMATIC_STORYBOOK_VERSION='@storybook/react@4.0-alpha.8' for unusual cases
if (env.CHROMATIC_STORYBOOK_VERSION) {
const [, p, v] = env.CHROMATIC_STORYBOOK_VERSION.match(/(.+)@(.+)$/) || [];
- const version = semver.valid(v) || semver.validRange(v); // ensures we get a specific version, not a range
+ const version = semver.valid(v); // ensures we get a specific version, not a range
if (!p || !version) {
throw new Error(


message: Replace how he retreive the package.json

diff:
@@ -2,6 +2,7 @@ import jsonfile from 'jsonfile';
import Listr from 'listr';
import pkgUp from 'pkg-up';
import { v4 as uuid } from 'uuid';
+import readPkgUp from 'read-pkg-up';
import GraphQLClient from './io/GraphQLClient';
import HTTPClient from './io/HTTPClient';
@@ -34,13 +35,13 @@ export async function main(argv: string[]) {
const env = getEnv();
const log = createLogger(sessionId, env);
- const packagePath = await pkgUp(); // the user's own package.json
- if (!packagePath) {
+ const pkgInfo = readPkgUp.sync({ cwd: process.cwd() });
+ if (!pkgInfo) {
log.error(noPackageJson());
process.exit(253);
}
- const packageJson: { [key: string]: any } = await readFile(packagePath);
+ const { path: packagePath, packageJson } = pkgInfo;
if (typeof packageJson !== 'object' || typeof packageJson.scripts !== 'object') {
log.error(invalidPackageJson(packagePath));
process.exit(252);


message: Add ability to get metadata from project.json

diff:
module.exports = {
- stories: process.env.SMOKE_TEST ? ['../test-stories/*.stories.*'] : ['../bin-src/**/*.stories.*'],
+ stories: process.env.SMOKE_TEST ? ['../test-stories/*.stories.*'] : ['../**/*.stories.*'],
+ addons: ['@storybook/addon-viewport'],
features: {
postcss: false,
},
+ framework: '@storybook/react',
core: {
builder: 'webpack5',
},

diff:
import { Context } from '../types';
import getStorybookInfo from './getStorybookInfo';
+import { getStorybookMetadateFromProjectJson } from './getStorybookMetadata';
jest.useFakeTimers();
+jest.mock('./getStorybookMetadata', () => {
+ const original = jest.requireActual('./getStorybookMetadata'); // Step 2.
+ return {
+ __esModule: true,
+ ...original,
+ getStorybookMetadateFromProjectJson: jest.fn(() => ({
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
+ })),
+ };
+});
+
const log = { info: jest.fn(), warn: jest.fn(), error: jest.fn(), debug: jest.fn() };
const context: Context = { env: {}, log, options: {}, packageJson: {} } as any;
const getContext = (ctx: any): Context => ({ ...context, ...ctx });
@@ -111,8 +131,37 @@ describe('getStorybookInfo', () => {
packageJson: { dependencies: REACT },
});
await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '1.2.3' })
+ expect.objectContaining({
+ addons: [
+ {
+ name: 'essentials',
+ packageName: '@storybook/addon-essentials',
+ packageVersion: '6.5.5',
+ },
+ ],
+ version: '6.5.5',
+ viewLayer: 'react',
+ })
);
});
+
+ it('returns no metadata if cannot find project.json', async () => {
+ const ctx = getContext({
+ options: { storybookBuildDir: 'storybook-static' },
+ packageJson: { dependencies: REACT },
+ });
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
+ getStorybookMetadateFromProjectJson.mockImplementation(() => ({
+ addons: [],
+ version: null,
+ viewLayer: null,
+ }));
+ await expect(getStorybookInfo(ctx)).resolves.toEqual({
+ addons: [],
+ version: null,
+ viewLayer: null,
+ });
+ });
});
});

diff:
@@ -2,11 +2,13 @@ import fs from 'fs-extra';
import meow from 'meow';
import { parseArgsStringToArgv } from 'string-argv';
import semver from 'semver';
+import path from 'path';
import noViewLayerPackage from '../ui/messages/errors/noViewLayerPackage';
import { viewLayers } from './viewLayers';
import { supportedAddons } from './supportedAddons';
import { timeout, raceFulfilled } from './promises';
import { Context } from '../types';
+import { getStorybookMetadateFromProjectJson } from './getStorybookMetadata';
const resolvePackageJson = (pkg: string) => {
try {
@@ -15,8 +17,8 @@ const resolvePackageJson = (pkg: string) => {
// webpack will provide a '__non_webpack_require__' function to do this with,
// but this will obviously not be present during tests, hence the check and fallback to the normal require
const r = typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : require;
- const path = r.resolve(`${pkg}/package.json`);
- return fs.readJson(path);
+ const packagePath = r.resolve(`${pkg}/package.json`);
+ return fs.readJson(packagePath);
} catch (error) {
return Promise.reject(error);
}
@@ -130,6 +132,13 @@ export default async function getStorybookInfo(
ctx: Context
): Promise<Partial<Context['storybook']>> {
try {
+ if (ctx.options.storybookBuildDir) {
+ const projectJsonPath = path.resolve(ctx.options.storybookBuildDir, 'project.json');
+ // This test makes sure we fall through if the file does not exist.
+ if (fs.existsSync(projectJsonPath)) {
+ return await getStorybookMetadateFromProjectJson(ctx.options.storybookBuildDir);
+ }
+ }
const info = await Promise.all([findAddons(ctx), findConfigFlags(ctx), findViewlayer(ctx)]);
return info.reduce((acc, obj) => Object.assign(acc, obj), {});
} catch (e) {

diff:
+import { readFile } from 'jsonfile';
+import { Context } from '../types';
+import { supportedAddons } from './supportedAddons';
+import { viewLayers } from './viewLayers';
+
+/*
+ In Storybook 6.5+, when building a Storybook, a project.json file is generated,
+ containing metadata (sb builder, addons, viewLayer and viewLayer version) for the
+ particular setup.
+*/
+
+export interface SBProjectJson {
+ addons: Record<string, { version: string; options: any }>;
+ builder?: {
+ name: string;
+ };
+ framework: {
+ name: string;
+ };
+ storybookPackages?: Record<string, { version: string }>;
+}
+
+export const getStorybookMetadateFromProjectJson = async (
+ projectJsonPath: string
+): Promise<Partial<Context['storybook']>> => {
+ const sbProjectJson = (await readFile(projectJsonPath)) as SBProjectJson;
+ const viewLayerPackage = Object.keys(viewLayers).find(
+ (viewLayer) => viewLayers[viewLayer] === sbProjectJson.framework.name
+ );
+ return {
+ viewLayer: sbProjectJson.framework.name ?? '',
+ version: sbProjectJson.storybookPackages[viewLayerPackage].version,
+ builder: sbProjectJson?.builder.name ?? 'webpack4',
+ addons: Object.keys(sbProjectJson.addons).map((addon) => ({
+ name: supportedAddons[addon],
+ packageName: addon,
+ packageVersion: sbProjectJson.addons[addon].version,
+ })),
+ };
+};

diff:
@@ -170,6 +170,7 @@ export interface Context {
packageName?: string;
packageVersion?: string;
}[];
+ builder: string;
};
spawnParams: {
client: 'yarn' | 'npm';

diff:
"@babel/preset-typescript": "^7.15.0",
"@babel/runtime": "^7.15.3",
"@chromaui/localtunnel": "^2.0.3",
+ "@storybook/addon-essentials": "^6.5.6",
"@storybook/builder-webpack5": "^6.5.6",
"@storybook/eslint-config-storybook": "^3.1.2",
"@storybook/linter-config": "^3.1.2",

diff:
core-js-pure "^3.16.0"
regenerator-runtime "^0.13.4"
+"@babel/runtime@^7.0.0", "@babel/runtime@^7.17.8":
+ version "7.18.3"
+ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.3.tgz#c7b654b57f6f63cf7f8b418ac9ca04408c4579f4"
+ integrity sha512-38Y8f7YUhce/K7RMwTp7m0uCumpv9hZkitCbBClqQIow1qSbCvGkcegKOXpEWCQLfWmevgRiWokZ1GkpfhbZug==
+ dependencies:
+ regenerator-runtime "^0.13.4"
+
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.3", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.0", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4":
version "7.15.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a"
openurl "1.1.1"
yargs "16.2.0"
+"@cnakazawa/watch@^1.0.3":
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
+ integrity sha512-v9kIhKwjeZThiWrLmj0y17CWoyddASLj9O2yvbZkbvw/N3rWOYy9zkV66ursAoVr0mV15bL8g0c4QZUE6cdDoQ==
+ dependencies:
+ exec-sh "^0.3.2"
+ minimist "^1.2.0"
+
"@discoveryjs/json-ext@^0.5.0", "@discoveryjs/json-ext@^0.5.3":
version "0.5.5"
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.5.tgz#9283c9ce5b289a3c4f61c12757469e59377f81f3"
jest-haste-map "^27.2.0"
jest-runtime "^27.2.1"
+"@jest/transform@^26.6.2":
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.6.2.tgz#5ac57c5fa1ad17b2aae83e73e45813894dcf2e4b"
+ integrity sha512-E9JjhUgNzvuQ+vVAL21vlyfy12gP0GhazGgJC4h6qUt1jSdUXGWJ1wfu/X7Sd8etSgxV4ovT1pb9v5D6QW4XgA==
+ dependencies:
+ "@babel/core" "^7.1.0"
+ "@jest/types" "^26.6.2"
+ babel-plugin-istanbul "^6.0.0"
+ chalk "^4.0.0"
+ convert-source-map "^1.4.0"
+ fast-json-stable-stringify "^2.0.0"
+ graceful-fs "^4.2.4"
+ jest-haste-map "^26.6.2"
+ jest-regex-util "^26.0.0"
+ jest-util "^26.6.2"
+ micromatch "^4.0.2"
+ pirates "^4.0.1"
+ slash "^3.0.0"
+ source-map "^0.6.1"
+ write-file-atomic "^3.0.0"
+
"@jest/transform@^27.2.1":
version "27.2.1"
resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.2.1.tgz#743443adb84b3b7419951fc702515ce20ba6285e"
source-map "^0.6.1"
write-file-atomic "^3.0.0"
+"@jest/types@^26.6.2":
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.6.2.tgz#bef5a532030e1d88a2f5a6d933f84e97226ed48e"
+ integrity sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==
+ dependencies:
+ "@types/istanbul-lib-coverage" "^2.0.0"
+ "@types/istanbul-reports" "^3.0.0"
+ "@types/node" "*"
+ "@types/yargs" "^15.0.0"
+ chalk "^4.0.0"
+
"@jest/types@^27.1.1":
version "27.1.1"
resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.1.1.tgz#77a3fc014f906c65752d12123a0134359707c0ad"
unist-builder "2.0.3"
unist-util-visit "2.0.3"
+"@mdx-js/react@^1.6.22":
+ version "1.6.22"
+ resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-1.6.22.tgz#ae09b4744fddc74714ee9f9d6f17a66e77c43573"
+ integrity sha512-TDoPum4SHdfPiGSAaRBw7ECyI8VaHpK8GJugbJIJuqyh6kzw9ZLJZW3HGL3NNrJGxcAixUvqROm+YuQOo5eXtg==
+
"@mdx-js/util@1.6.22":
version "1.6.22"
resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.22.tgz#219dfd89ae5b97a8801f015323ffa4b62f45718b"
dependencies:
"@sinonjs/commons" "^1.7.0"
+"@storybook/addon-actions@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-6.5.6.tgz#0e980a0a6d8d47db8031108ffa1fd51cc627a466"
+ integrity sha512-AGtzpWOU/B0FxcqFDM7E/KSHQyr6tMbVts77JlAKCIbwqEncD1LIQoz9CyMdbr1jynkep0Ck0JjcDdmp7CXVoQ==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ "@storybook/theming" "6.5.6"
+ core-js "^3.8.2"
+ fast-deep-equal "^3.1.3"
+ global "^4.4.0"
+ lodash "^4.17.21"
+ polished "^4.2.2"
+ prop-types "^15.7.2"
+ react-inspector "^5.1.0"
+ regenerator-runtime "^0.13.7"
+ telejson "^6.0.8"
+ ts-dedent "^2.0.0"
+ util-deprecate "^1.0.2"
+ uuid-browser "^3.1.0"
+
+"@storybook/addon-backgrounds@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-backgrounds/-/addon-backgrounds-6.5.6.tgz#3763acdff1f2260286e165cf35e87d8097245496"
+ integrity sha512-D2khx57WBvQ2Ta/UMCZa8KQwAzVunk/oKmTJd6vau+1bm88wEx3a2seI9tZtC6nVHgHaBYgoH8os+7XpmlYlVQ==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ "@storybook/theming" "6.5.6"
+ core-js "^3.8.2"
+ global "^4.4.0"
+ memoizerific "^1.11.3"
+ regenerator-runtime "^0.13.7"
+ ts-dedent "^2.0.0"
+ util-deprecate "^1.0.2"
+
+"@storybook/addon-controls@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-controls/-/addon-controls-6.5.6.tgz#bca1e33dd1edb059b6d6b1e1616c60ecdc9eb294"
+ integrity sha512-pJz2ltdL8d9/2wX1XOMdXeGwMNoBX5hIXkNfBCvBfOCmeVEXOczPOZARvwx4QTqmMSu1KikhFIGT64wwoETmBg==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-common" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ "@storybook/node-logger" "6.5.6"
+ "@storybook/store" "6.5.6"
+ "@storybook/theming" "6.5.6"
+ core-js "^3.8.2"
+ lodash "^4.17.21"
+ ts-dedent "^2.0.0"
+
+"@storybook/addon-docs@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-docs/-/addon-docs-6.5.6.tgz#39ea88cf5feebc82cc7faf9c0a10f9f3cba420bb"
+ integrity sha512-18MOB4Cvr10ibRlA58Y2MqaC0EM9NG758iSjweThaU4kZtSBSDn8R2qBLDGQPwEFkww+4+oAFXxR5/J0qO2xEw==
+ dependencies:
+ "@babel/plugin-transform-react-jsx" "^7.12.12"
+ "@babel/preset-env" "^7.12.11"
+ "@jest/transform" "^26.6.2"
+ "@mdx-js/react" "^1.6.22"
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-common" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ "@storybook/docs-tools" "6.5.6"
+ "@storybook/mdx1-csf" "^0.0.1"
+ "@storybook/node-logger" "6.5.6"
+ "@storybook/postinstall" "6.5.6"
+ "@storybook/preview-web" "6.5.6"
+ "@storybook/source-loader" "6.5.6"
+ "@storybook/store" "6.5.6"
+ "@storybook/theming" "6.5.6"
+ babel-loader "^8.0.0"
+ core-js "^3.8.2"
+ fast-deep-equal "^3.1.3"
+ global "^4.4.0"
+ lodash "^4.17.21"
+ regenerator-runtime "^0.13.7"
+ remark-external-links "^8.0.0"
+ remark-slug "^6.0.0"
+ ts-dedent "^2.0.0"
+ util-deprecate "^1.0.2"
+
+"@storybook/addon-essentials@^6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-essentials/-/addon-essentials-6.5.6.tgz#502e6152b729696d8de8c792fb44aae76fae934e"
+ integrity sha512-n+kDN/AI6NDJNJjofYXjGBh618Yg17DuRppFdXROnocwndKufuImF+/tRaQ0YLwXmnULpAiFSGbja6F0pc7fOw==
+ dependencies:
+ "@storybook/addon-actions" "6.5.6"
+ "@storybook/addon-backgrounds" "6.5.6"
+ "@storybook/addon-controls" "6.5.6"
+ "@storybook/addon-docs" "6.5.6"
+ "@storybook/addon-measure" "6.5.6"
+ "@storybook/addon-outline" "6.5.6"
+ "@storybook/addon-toolbars" "6.5.6"
+ "@storybook/addon-viewport" "6.5.6"
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/core-common" "6.5.6"
+ "@storybook/node-logger" "6.5.6"
+ core-js "^3.8.2"
+ regenerator-runtime "^0.13.7"
+ ts-dedent "^2.0.0"
+
+"@storybook/addon-measure@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-measure/-/addon-measure-6.5.6.tgz#843de6286861fed1761544adecf3c49d2982136c"
+ integrity sha512-V+KKoCTMVakExVmNiSu/1AHVsOgxUt62wo/Xm2fJvtRz+y/5LFFCLnENcN7/8qDTya8vgaHY7FR69zHvGiR4SA==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ core-js "^3.8.2"
+ global "^4.4.0"
+
+"@storybook/addon-outline@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-outline/-/addon-outline-6.5.6.tgz#8fedfc7b86faf3dc552b7ca12972909fd022ee5b"
+ integrity sha512-/Bgo+yQSDwriAZ7pnO0kzaiyMg77bBgieEhrPpjb+AMlWIBU2j9rZYVdmi0egYy075Hle3E/hLwjG4FT4QIo5A==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ core-js "^3.8.2"
+ global "^4.4.0"
+ regenerator-runtime "^0.13.7"
+ ts-dedent "^2.0.0"
+
+"@storybook/addon-toolbars@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-toolbars/-/addon-toolbars-6.5.6.tgz#f4f311aaf918e1922d21e9c6f15b06e2cb7ac66c"
+ integrity sha512-9FvnuvLj8QdtSeY7QEuqJieNckwhIkSdmovaFzeToRzJso3eAmqoo6I6pp444QVVnMzrCl5As+2uAxhgaDLEXg==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/theming" "6.5.6"
+ core-js "^3.8.2"
+ regenerator-runtime "^0.13.7"
+
+"@storybook/addon-viewport@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/addon-viewport/-/addon-viewport-6.5.6.tgz#bc6456b1d2f586da104fdc6b91a2d0355530e730"
+ integrity sha512-zjBjMLfeqflHW7W7iFL5EvxtGbUg+4j+yHjONnKKpZteUjrX4fsBBMOL56mQsC0bAJEQCb3w2SFFskYBa4CzIw==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/api" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/components" "6.5.6"
+ "@storybook/core-events" "6.5.6"
+ "@storybook/theming" "6.5.6"
+ core-js "^3.8.2"
+ global "^4.4.0"
+ memoizerific "^1.11.3"
+ prop-types "^15.7.2"
+ regenerator-runtime "^0.13.7"
+
"@storybook/addons@6.5.6":
version "6.5.6"
resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-6.5.6.tgz#ed7ab72ac3a4e2d74e2ba4d10b4a0721d66cd1cd"
npmlog "^5.0.1"
pretty-hrtime "^1.0.3"
+"@storybook/postinstall@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/postinstall/-/postinstall-6.5.6.tgz#df0bab91b0d1f576a9d4d63842ad56238e26c9d6"
+ integrity sha512-MPrlmVOXbfAiSaGzG1jgUM4l2zXOI9h3pvrh+0dQLJYP3tjO+5RNmJKMjH8c1PkTcAeoHkp1gUYZ0KKy2imRRQ==
+ dependencies:
+ core-js "^3.8.2"
+
"@storybook/preview-web@6.5.6":
version "6.5.6"
resolved "https://registry.yarnpkg.com/@storybook/preview-web/-/preview-web-6.5.6.tgz#d4cf4a90a27819aa3315b48b21df6a515bb49b7a"
core-js "^3.6.5"
find-up "^4.1.0"
+"@storybook/source-loader@6.5.6":
+ version "6.5.6"
+ resolved "https://registry.yarnpkg.com/@storybook/source-loader/-/source-loader-6.5.6.tgz#e20c6a827c2021bbbab05d0bb2c1e6fb66e133a9"
+ integrity sha512-KsV9DU3JucYjWHq55f1bOu52mprgSpTIRUnvK2BojQdjY+kqN2ow0pP/I9FZzNpEKKsGFWdnREfYM5dYHZyvLw==
+ dependencies:
+ "@storybook/addons" "6.5.6"
+ "@storybook/client-logger" "6.5.6"
+ "@storybook/csf" "0.0.2--canary.4566f4d.1"
+ core-js "^3.8.2"
+ estraverse "^5.2.0"
+ global "^4.4.0"
+ loader-utils "^2.0.0"
+ lodash "^4.17.21"
+ prettier ">=2.2.1 <=2.3.0"
+ regenerator-runtime "^0.13.7"
+
"@storybook/store@6.5.6":
version "6.5.6"
resolved "https://registry.yarnpkg.com/@storybook/store/-/store-6.5.6.tgz#0250d92f10d9590f4df2f7e6e11a07103055c350"
resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-20.2.1.tgz#3b9ce2489919d9e4fea439b76916abc34b2df129"
integrity sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==
+"@types/yargs@^15.0.0":
+ version "15.0.14"
+ resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.14.tgz#26d821ddb89e70492160b66d10a0eb6df8f6fb06"
+ integrity sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==
+ dependencies:
+ "@types/yargs-parser" "*"
+
"@types/yargs@^16.0.0":
version "16.0.4"
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977"
@@ -4591,6 +4850,13 @@ caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001254:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz#ae21691d3da9c4be6144403ac40f71d9f6efd790"
integrity sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg==
+capture-exit@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4"
+ integrity sha512-PiT/hQmTonHhl/HFGN+Lx3JJUznrVYJ3+AQsnthneZbvW7x+f08Tk7yLJTLEOUvBTbduLeeBkxEaYXUOUrRq6g==
+ dependencies:
+ rsvp "^4.8.4"
+
case-sensitive-paths-webpack-plugin@^2.3.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/case-sensitive-paths-webpack-plugin/-/case-sensitive-paths-webpack-plugin-2.4.0.tgz#db64066c6422eed2e08cc14b986ca43796dbc6d4"
@@ -4711,6 +4977,11 @@ chrome-trace-event@^1.0.2:
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz#1015eced4741e15d06664a957dbbf50d041e26ac"
integrity sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==
+ci-info@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
+ integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==
+
ci-info@^3.1.1:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6"
@@ -5199,7 +5470,7 @@ cross-env@^7.0.3:
dependencies:
cross-spawn "^7.0.1"
-cross-spawn@^6.0.5:
+cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
@@ -6256,6 +6527,24 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"
+exec-sh@^0.3.2:
+ version "0.3.6"
+ resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.6.tgz#ff264f9e325519a60cb5e273692943483cca63bc"
+ integrity sha512-nQn+hI3yp+oD0huYhKwvYI32+JFeq+XkNcD1GAo3Y/MjxsfVGmrrzrnzjWiNY6f+pUCP440fThsFh5gZrRAU/w==
+
+execa@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8"
+ integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==
+ dependencies:
+ cross-spawn "^6.0.0"
+ get-stream "^4.0.0"
+ is-stream "^1.1.0"
+ npm-run-path "^2.0.0"
+ p-finally "^1.0.0"
+ signal-exit "^3.0.0"
+ strip-eof "^1.0.0"
+
execa@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a"
@@ -6833,7 +7122,7 @@ fsevents@^1.2.7:
bindings "^1.5.0"
nan "^2.12.1"
-fsevents@^2.3.2, fsevents@~2.3.2:
+fsevents@^2.1.2, fsevents@^2.3.2, fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
@@ -6912,6 +7201,13 @@ get-stdin@^4.0.1:
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
integrity sha512-F5aQMywwJ2n85s4hJPTT9RPxGmubonuB10MNYo17/xph174n2MIR33HRguhzVag10O/npM7SPk73LMZNP+FaWw==
+get-stream@^4.0.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5"
+ integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==
+ dependencies:
+ pump "^3.0.0"
+
get-stream@^5.0.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
@@ -6949,6 +7245,11 @@ git-hooks-list@1.0.3:
resolved "https://registry.yarnpkg.com/git-hooks-list/-/git-hooks-list-1.0.3.tgz#be5baaf78203ce342f2f844a9d2b03dba1b45156"
integrity sha512-Y7wLWcrLUXwk2noSka166byGCvhMtDRpgHdzCno1UQv/n/Hegp++a2xBWJL1lJarnKD3SWaljD+0z1ztqxuKyQ==
+github-slugger@^1.0.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.4.0.tgz#206eb96cdb22ee56fdc53a28d5a302338463444e"
+ integrity sha512-w0dzqw/nt51xMVmlaV1+JRzN+oCa1KfcgGEWhxUG16wbdA+Xnt/yoFO8Z8x/V82ZcZ0wy6ln9QDup5avbhiDhQ==
+
glob-parent@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-3.1.0.tgz#9e6af6299d8d3bd2bd40430832bd113df906c5ae"
@@ -7613,6 +7914,11 @@ ipaddr.js@1.9.1:
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==
+is-absolute-url@^3.0.0:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-3.0.3.tgz#96c6a22b6a23929b11ea0afb1836c36ad4a5d698"
+ integrity sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q==
+
is-accessor-descriptor@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6"
@@ -7697,6 +8003,13 @@ is-callable@^1.1.4, is-callable@^1.2.4:
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945"
integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==
+is-ci@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c"
+ integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==
+ dependencies:
+ ci-info "^2.0.0"
+
is-ci@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.0.tgz#c7e7be3c9d8eef7d0fa144390bd1e4b88dc4c994"
@@ -7760,6 +8073,14 @@ is-docker@^2.0.0, is-docker@^2.1.1:
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==
+is-dom@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/is-dom/-/is-dom-1.1.0.tgz#af1fced292742443bb59ca3f76ab5e80907b4e8a"
+ integrity sha512-u82f6mvhYxRPKpw8V1N0W8ce1xXwOrQtgGcxl6UCL5zBmZu3is/18K0rR7uFCnMDuAsS/3W54mGL4vsaFUQlEQ==
+ dependencies:
+ is-object "^1.0.1"
+ is-window "^1.0.2"
+
is-empty@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/is-empty/-/is-empty-1.2.0.tgz#de9bb5b278738a05a0b09a57e1fb4d4a341a9f6b"
@@ -7867,6 +8188,11 @@ is-obj@^1.0.1:
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f"
integrity sha1-PkcprB9f3gJc19g6iW2rn09n2w8=
+is-object@^1.0.1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/is-object/-/is-object-1.0.2.tgz#a56552e1c665c9e950b4a025461da87e72f86fcf"
+ integrity sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==
+
is-observable@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e"
@@ -7968,6 +8294,11 @@ is-whitespace-character@^1.0.0:
resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz#0858edd94a95594c7c9dd0b5c174ec6e45ee4aa7"
integrity sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==
+is-window@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d"
+ integrity sha512-uj00kdXyZb9t9RcAUAwMZAnkBUwdYGhYlt7djMXhfyhUCzwNba50tIiBKR7q0l7tdoBtFVw/3JmLY6fI3rmZmg==
+
is-windows@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
@@ -8246,6 +8577,27 @@ jest-get-type@^27.4.0:
resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.4.0.tgz#7503d2663fffa431638337b3998d39c5e928e9b5"
integrity sha512-tk9o+ld5TWq41DkK14L4wox4s2D9MtTpKaAVzXfr5CUKm5ZK2ExcaFE0qls2W71zE/6R2TxxrK9w2r6svAFDBQ==
+jest-haste-map@^26.6.2:
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.6.2.tgz#dd7e60fe7dc0e9f911a23d79c5ff7fb5c2cafeaa"
+ integrity sha512-easWIJXIw71B2RdR8kgqpjQrbMRWQBgiBwXYEhtGUTaX+doCjBheluShdDMeR8IMfJiTqH4+zfhtg29apJf/8w==
+ dependencies:
+ "@jest/types" "^26.6.2"
+ "@types/graceful-fs" "^4.1.2"
+ "@types/node" "*"
+ anymatch "^3.0.3"
+ fb-watchman "^2.0.0"
+ graceful-fs "^4.2.4"
+ jest-regex-util "^26.0.0"
+ jest-serializer "^26.6.2"
+ jest-util "^26.6.2"
+ jest-worker "^26.6.2"
+ micromatch "^4.0.2"
+ sane "^4.0.3"
+ walker "^1.0.7"
+ optionalDependencies:
+ fsevents "^2.1.2"
+
jest-haste-map@^27.2.0:
version "27.2.0"
resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.2.0.tgz#703b3a473e3f2e27d75ab07864ffd7bbaad0d75e"
@@ -8336,6 +8688,11 @@ jest-pnp-resolver@^1.2.2:
resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c"
integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==
+jest-regex-util@^26.0.0:
+ version "26.0.0"
+ resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28"
+ integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A==
+
jest-regex-util@^27.0.6:
version "27.0.6"
resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.0.6.tgz#02e112082935ae949ce5d13b2675db3d8c87d9c5"
@@ -8427,6 +8784,14 @@ jest-runtime@^27.2.1:
strip-bom "^4.0.0"
yargs "^16.0.3"
+jest-serializer@^26.6.2:
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.6.2.tgz#d139aafd46957d3a448f3a6cdabe2919ba0742d1"
+ integrity sha512-S5wqyz0DXnNJPd/xfIzZ5Xnp1HrJWBczg8mMfMpN78OJ5eDxXyf+Ygld9wX1DnUWbIbhM1YDY95NjR4CBXkb2g==
+ dependencies:
+ "@types/node" "*"
+ graceful-fs "^4.2.4"
+
jest-serializer@^27.0.6:
version "27.0.6"
resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.0.6.tgz#93a6c74e0132b81a2d54623251c46c498bb5bec1"
@@ -8465,6 +8830,18 @@ jest-snapshot@^27.2.1:
pretty-format "^27.2.0"
semver "^7.3.2"
+jest-util@^26.6.2:
+ version "26.6.2"
+ resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.6.2.tgz#907535dbe4d5a6cb4c47ac9b926f6af29576cbc1"
+ integrity sha512-MDW0fKfsn0OI7MS7Euz6h8HNDXVQ0gaM9uW6RjfDmd1DAFcaxX9OqIakHIqhbnmF08Cf2DLDG+ulq8YQQ0Lp0Q==
+ dependencies:
+ "@jest/types" "^26.6.2"
+ "@types/node" "*"
+ chalk "^4.0.0"
+ graceful-fs "^4.2.4"
+ is-ci "^2.0.0"
+ micromatch "^4.0.2"
+
jest-util@^27.2.0:
version "27.2.0"
resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.2.0.tgz#bfccb85cfafae752257319e825a5b8d4ada470dc"
@@ -8502,7 +8879,7 @@ jest-watcher@^27.2.0:
jest-util "^27.2.0"
string-length "^4.0.1"
-jest-worker@^26.5.0:
+jest-worker@^26.5.0, jest-worker@^26.6.2:
version "26.6.2"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed"
integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==
@@ -9137,6 +9514,13 @@ make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0:
dependencies:
semver "^6.0.0"
+makeerror@1.0.12:
+ version "1.0.12"
+ resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a"
+ integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==
+ dependencies:
+ tmpl "1.0.5"
+
makeerror@1.0.x:
version "1.0.11"
resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c"
@@ -9258,7 +9642,7 @@ mdast-util-to-markdown@^0.6.0:
repeat-string "^1.0.0"
zwitch "^1.0.0"
-mdast-util-to-string@^1.0.2:
+mdast-util-to-string@^1.0.0, mdast-util-to-string@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz#27055500103f51637bd07d01da01eb1967a43527"
integrity sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==
@@ -9522,7 +9906,7 @@ minimist-options@4.1.0:
is-plain-obj "^1.1.0"
kind-of "^6.0.3"
-minimist@^1.1.3:
+minimist@^1.1.1, minimist@^1.1.3:
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
@@ -9862,6 +10246,13 @@ npm-run-all@^4.0.2:
shell-quote "^1.6.1"
string.prototype.padend "^3.0.0"
+npm-run-path@^2.0.0:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
+ integrity sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==
+ dependencies:
+ path-key "^2.0.0"
+
npm-run-path@^4.0.0, npm-run-path@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea"
@@ -10361,7 +10752,7 @@ path-is-absolute@^1.0.0:
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
-path-key@^2.0.1:
+path-key@^2.0.0, path-key@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
@@ -10538,6 +10929,13 @@ pnp-webpack-plugin@1.6.4:
dependencies:
ts-pnp "^1.1.6"
+polished@^4.2.2:
+ version "4.2.2"
+ resolved "https://registry.yarnpkg.com/polished/-/polished-4.2.2.tgz#2529bb7c3198945373c52e34618c8fe7b1aa84d1"
+ integrity sha512-Sz2Lkdxz6F2Pgnpi9U5Ng/WdWAUZxmHrNPoVlm3aAemxoy2Qy7LGjQg4uf8qKelDAUW94F4np3iH2YPf2qefcQ==
+ dependencies:
+ "@babel/runtime" "^7.17.8"
+
posix-character-classes@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@@ -10800,6 +11198,15 @@ prompts@^2.0.1, prompts@^2.4.0:
kleur "^3.0.3"
sisteransi "^1.0.5"
+prop-types@^15.0.0:
+ version "15.8.1"
+ resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
+ integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
+ dependencies:
+ loose-envify "^1.4.0"
+ object-assign "^4.1.1"
+ react-is "^16.13.1"
+
prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
@@ -11015,12 +11422,21 @@ react-element-to-jsx-string@^14.3.4:
is-plain-object "5.0.0"
react-is "17.0.2"
+react-inspector@^5.1.0:
+ version "5.1.1"
+ resolved "https://registry.yarnpkg.com/react-inspector/-/react-inspector-5.1.1.tgz#58476c78fde05d5055646ed8ec02030af42953c8"
+ integrity sha512-GURDaYzoLbW8pMGXwYPDBIv6nqei4kK7LPRZ9q9HCZF54wqXz/dnylBp/kfE9XmekBhHvLDdcYeyIwSrvtOiWg==
+ dependencies:
+ "@babel/runtime" "^7.0.0"
+ is-dom "^1.0.0"
+ prop-types "^15.0.0"
+
react-is@17.0.2, react-is@^17.0.1:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
-react-is@^16.8.1:
+react-is@^16.13.1, react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
@@ -11262,6 +11678,17 @@ remark-cli@^9.0.0:
remark "^13.0.0"
unified-args "^8.0.0"
+remark-external-links@^8.0.0:
+ version "8.0.0"
+ resolved "https://registry.yarnpkg.com/remark-external-links/-/remark-external-links-8.0.0.tgz#308de69482958b5d1cd3692bc9b725ce0240f345"
+ integrity sha512-5vPSX0kHoSsqtdftSHhIYofVINC8qmp0nctkeU9YoJwV3YfiBRiI6cbFRJ0oI/1F9xS+bopXG0m2KS8VFscuKA==
+ dependencies:
+ extend "^3.0.0"
+ is-absolute-url "^3.0.0"
+ mdast-util-definitions "^4.0.0"
+ space-separated-tokens "^1.0.0"
+ unist-util-visit "^2.0.0"
+
remark-footnotes@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/remark-footnotes/-/remark-footnotes-2.0.0.tgz#9001c4c2ffebba55695d2dd80ffb8b82f7e6303f"
@@ -11500,6 +11927,15 @@ remark-preset-lint-recommended@^5.0.0:
remark-lint-no-unused-definitions "^2.0.0"
remark-lint-ordered-list-marker-style "^2.0.0"
+remark-slug@^6.0.0:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/remark-slug/-/remark-slug-6.1.0.tgz#0503268d5f0c4ecb1f33315c00465ccdd97923ce"
+ integrity sha512-oGCxDF9deA8phWvxFuyr3oSJsdyUAxMFbA0mZ7Y1Sas+emILtO+e5WutF9564gDsEN4IXaQXm5pFo6MLH+YmwQ==
+ dependencies:
+ github-slugger "^1.0.0"
+ mdast-util-to-string "^1.0.0"
+ unist-util-visit "^2.0.0"
+
remark-squeeze-paragraphs@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/remark-squeeze-paragraphs/-/remark-squeeze-paragraphs-4.0.0.tgz#76eb0e085295131c84748c8e43810159c5653ead"
@@ -11704,6 +12140,11 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"
+rsvp@^4.8.4:
+ version "4.8.5"
+ resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734"
+ integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==
+
run-parallel@^1.1.9:
version "1.2.0"
resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
@@ -11752,6 +12193,21 @@ safe-regex@^1.1.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
+sane@^4.0.3:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/sane/-/sane-4.1.0.tgz#ed881fd922733a6c461bc189dc2b6c006f3ffded"
+ integrity sha512-hhbzAgTIX8O7SHfp2c8/kREfEn4qO/9q8C9beyY6+tvZ87EpoZ3i1RIEvp27YBswnNbY9mWd6paKVmKbAgLfZA==
+ dependencies:
+ "@cnakazawa/watch" "^1.0.3"
+ anymatch "^2.0.0"
+ capture-exit "^2.0.0"
+ exec-sh "^0.3.2"
+ execa "^1.0.0"
+ fb-watchman "^2.0.0"
+ micromatch "^3.1.4"
+ minimist "^1.1.1"
+ walker "~1.0.5"
+
saxes@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d"
@@ -12464,6 +12920,11 @@ strip-bom@^4.0.0:
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878"
integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==
+strip-eof@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf"
+ integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=
+
strip-final-newline@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
@@ -12778,7 +13239,7 @@ tmp@^0.2.0:
dependencies:
rimraf "^3.0.0"
-tmpl@1.0.x:
+tmpl@1.0.5, tmpl@1.0.x:
version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
@@ -13375,6 +13836,11 @@ utils-merge@1.0.1:
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713"
integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=
+uuid-browser@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/uuid-browser/-/uuid-browser-3.1.0.tgz#0f05a40aef74f9e5951e20efbf44b11871e56410"
+ integrity sha1-DwWkCu90+eWVHiDvv0SxGHHlZBA=
+
uuid@^3.3.2:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
@@ -13530,6 +13996,13 @@ walker@^1.0.7:
dependencies:
makeerror "1.0.x"
+walker@~1.0.5:
+ version "1.0.8"
+ resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f"
+ integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==
+ dependencies:
+ makeerror "1.0.12"
+
watchpack-chokidar2@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz#38500072ee6ece66f3769936950ea1771be1c957"


message: Mock the project.json file

diff:
+import mock from 'mock-fs';
import { Context } from '../types';
import getStorybookInfo from './getStorybookInfo';
import { getStorybookMetadateFromProjectJson } from './getStorybookMetadata';
@@ -125,6 +126,19 @@ describe('getStorybookInfo', () => {
});
describe('with --storybook-build-dir', () => {
+ beforeAll(() => {
+ mock({
+ 'storybook-static': {
+ 'project.json':
+ '{"generatedAt":1654054690474,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"yarn","version":"1.22.18"},"features":{"postcss":false},"storybookVersion":"6.5.6","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"6.5.6"},"@storybook/builder-webpack5":{"version":"6.5.6"},"@storybook/eslint-config-storybook":{"version":"3.1.2"},"@storybook/linter-config":{"version":"3.1.2"},"@storybook/manager-webpack5":{"version":"6.5.6"},"@storybook/react":{"version":"6.5.6"}},"framework":{"name":"react"},"addons":{"@storybook/addon-viewport":{"version":"6.5.6"}}}',
+ },
+ });
+ });
+
+ afterAll(() => {
+ mock.restore();
+ });
+
it('returns viewLayer and version from packageJson', async () => {
const ctx = getContext({
options: { storybookBuildDir: 'storybook-static' },

original_message: Mock the project.json file


message: revert stories to render

diff:
module.exports = {
- stories: process.env.SMOKE_TEST ? ['../test-stories/*.stories.*'] : ['../**/*.stories.*'],
+ stories: process.env.SMOKE_TEST ? ['../test-stories/*.stories.*'] : ['../bin-src/**/*.stories.*'],
addons: ['@storybook/addon-viewport'],
features: {
postcss: false,

original_message: revert stories to render


message: Add ability to get the builder

diff:
@@ -18,6 +18,7 @@ jest.mock('./getStorybookMetadata', () => {
packageVersion: '6.5.5',
},
],
+ builder: 'webpack5',
version: '6.5.5',
viewLayer: 'react',
})),
@@ -76,6 +77,7 @@ describe('getStorybookInfo', () => {
addons: [],
version: null,
viewLayer: null,
+ builder: null,
});
});
@@ -112,6 +114,7 @@ describe('getStorybookInfo', () => {
addons: [],
version: null,
viewLayer: null,
+ builder: null,
});
});
@@ -121,6 +124,7 @@ describe('getStorybookInfo', () => {
addons: [],
version: null,
viewLayer: null,
+ builder: null,
});
});
});
@@ -144,8 +148,7 @@ describe('getStorybookInfo', () => {
options: { storybookBuildDir: 'storybook-static' },
packageJson: { dependencies: REACT },
});
- await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({
+ await expect(getStorybookInfo(ctx)).resolves.toEqual({
addons: [
{
name: 'essentials',
@@ -153,10 +156,10 @@ describe('getStorybookInfo', () => {
packageVersion: '6.5.5',
},
],
+ builder: 'webpack5',
version: '6.5.5',
viewLayer: 'react',
- })
- );
+ });
});
it('returns no metadata if cannot find project.json', async () => {
@@ -170,11 +173,13 @@ describe('getStorybookInfo', () => {
addons: [],
version: null,
viewLayer: null,
+ builder: null,
}));
await expect(getStorybookInfo(ctx)).resolves.toEqual({
addons: [],
version: null,
viewLayer: null,
+ builder: null,
});
});
});

diff:
@@ -135,13 +135,14 @@ export default async function getStorybookInfo(
if (ctx.options.storybookBuildDir) {
const projectJsonPath = path.resolve(ctx.options.storybookBuildDir, 'project.json');
// This test makes sure we fall through if the file does not exist.
- if (fs.existsSync(projectJsonPath)) {
- return await getStorybookMetadateFromProjectJson(ctx.options.storybookBuildDir);
+ if (fs.pathExistsSync(projectJsonPath)) {
+ return await getStorybookMetadateFromProjectJson(projectJsonPath);
}
}
const info = await Promise.all([findAddons(ctx), findConfigFlags(ctx), findViewlayer(ctx)]);
return info.reduce((acc, obj) => Object.assign(acc, obj), {});
} catch (e) {
- return { viewLayer: null, version: null, addons: [] };
+ ctx.log.debug(e);
+ return { viewLayer: null, version: null, addons: [], builder: null };
}
}

diff:
@@ -30,7 +30,7 @@ export const getStorybookMetadateFromProjectJson = async (
return {
viewLayer: sbProjectJson.framework.name ?? '',
version: sbProjectJson.storybookPackages[viewLayerPackage].version,
- builder: sbProjectJson?.builder.name ?? 'webpack4',
+ builder: sbProjectJson.builder.name ?? 'webpack4',
addons: Object.keys(sbProjectJson.addons).map((addon) => ({
name: supportedAddons[addon],
packageName: addon,

diff:
@@ -9,6 +9,7 @@ export default {
const storybook = {
version: '5.3.0',
viewLayer: 'web-components',
+ builder: 'webpack4',
addons: [],
};
const addons = [{ name: 'actions' }, { name: 'docs' }, { name: 'design-assets' }];

diff:
@@ -6,11 +6,17 @@ const capitalize = (string: string) =>
.map((str) => str.charAt(0).toUpperCase() + str.slice(1))
.join(' ');
-const infoMessage = ({ addons, version, viewLayer }: Context['storybook']) => {
- const info = version && viewLayer ? `Storybook ${version} for ${capitalize(viewLayer)}` : '';
+const infoMessage = ({ addons, version, viewLayer, builder }: Context['storybook']) => {
+ const info =
+ version && viewLayer
+ ? `Storybook ${version} for ${capitalize(viewLayer)} using the ${builder} builder`
+ : '';
+ const builderInfo = builder ? `${info}; using the ${builder} builder` : info;
return addons.length
- ? `${info}; supported addons found: ${addons.map((addon) => capitalize(addon.name)).join(', ')}`
- : `${info}; no supported addons found`;
+ ? `${builderInfo}; supported addons found: ${addons
+ .map((addon) => capitalize(addon.name))
+ .join(', ')}`
+ : `${builderInfo}; no supported addons found`;
};
export const initial = {

original_message: Add ability to get the builder


message: add ability to get info from sb main file

diff:
@@ -30,7 +30,14 @@ export const getStorybookMetadataFromProjectJson = async (
return {
viewLayer: sbProjectJson.framework.name ?? '',
version: sbProjectJson.storybookPackages[viewLayerPackage].version,
- builder: sbProjectJson.builder.name ?? 'webpack4',
+ builder: sbProjectJson?.builder
+ ? {
+ name:
+ typeof sbProjectJson.builder === 'string'
+ ? sbProjectJson.builder
+ : sbProjectJson?.builder.name,
+ }
+ : { name: 'webpack4' },
addons: Object.keys(sbProjectJson.addons).map((addon) => ({
name: supportedAddons[addon],
packageName: addon,

diff:
@@ -18,7 +18,7 @@ jest.mock('./getPrebuiltStorybookMetadata', () => {
packageVersion: '6.5.5',
},
],
- builder: 'webpack5',
+ builder: { name: 'webpack5' },
version: '6.5.5',
viewLayer: 'react',
})),
@@ -49,7 +49,11 @@ describe('getStorybookInfo', () => {
const ctx = getContext({ packageJson: { dependencies: REACT } });
await expect(getStorybookInfo(ctx)).resolves.toEqual(
// We're getting the result of tracing chromatic-cli's node_modules here.
- expect.objectContaining({ viewLayer: 'react', version: expect.any(String) })
+ expect.objectContaining({
+ viewLayer: 'react',
+ version: expect.any(String),
+ builder: { name: 'webpack5', version: '6.5.6' },
+ })
);
});
@@ -84,7 +88,11 @@ describe('getStorybookInfo', () => {
it('looks up package in node_modules on missing dependency', async () => {
await expect(getStorybookInfo(context)).resolves.toEqual(
// We're getting the result of tracing chromatic-cli's node_modules here.
- expect.objectContaining({ viewLayer: 'react', version: expect.any(String) })
+ expect.objectContaining({
+ viewLayer: 'react',
+ version: expect.any(String),
+ builder: { name: 'webpack5', version: '6.5.6' },
+ })
);
expect(log.info).toHaveBeenCalledWith(
expect.stringContaining('No viewlayer package listed in dependencies')
@@ -97,14 +105,22 @@ describe('getStorybookInfo', () => {
env: { CHROMATIC_STORYBOOK_VERSION: '@storybook/react@3.2.1' },
});
await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '3.2.1' })
+ expect.objectContaining({
+ viewLayer: 'react',
+ version: '3.2.1',
+ builder: { name: 'webpack5', version: '6.5.6' },
+ })
);
});
it('supports unscoped package name', async () => {
const ctx = getContext({ env: { CHROMATIC_STORYBOOK_VERSION: 'react@3.2.1' } });
await expect(getStorybookInfo(ctx)).resolves.toEqual(
- expect.objectContaining({ viewLayer: 'react', version: '3.2.1' })
+ expect.objectContaining({
+ viewLayer: 'react',
+ version: '3.2.1',
+ builder: { name: 'webpack5', version: '6.5.6' },
+ })
);
});
@@ -156,7 +172,7 @@ describe('getStorybookInfo', () => {
packageVersion: '6.5.5',
},
],
- builder: 'webpack5',
+ builder: { name: 'webpack5' },
version: '6.5.5',
viewLayer: 'react',
});

diff:
@@ -2,11 +2,14 @@ import fs from 'fs-extra';
import meow from 'meow';
import { parseArgsStringToArgv } from 'string-argv';
import semver from 'semver';
-import { loadMainConfig } from '@storybook/core-common';
+
+import path from 'path';
import { Context } from '../types';
-import noViewLayerPackage from '../ui/messages/errors/noViewLayerPackage';
+import packageDoesNotExist from '../ui/messages/errors/noViewLayerPackage';
import { viewLayers } from './viewLayers';
import { timeout, raceFulfilled } from './promises';
+import { supportedAddons } from './supportedAddons';
+import { builders } from './builders';
const resolvePackageJson = (pkg: string) => {
try {
@@ -82,7 +85,7 @@ const findViewlayer = async ({ env, log, options, packageJson }) => {
return Promise.race([
resolvePackageJson(pkg)
.then((json) => ({ viewLayer, version: json.version }))
- .catch(() => Promise.reject(new Error(noViewLayerPackage(pkg)))),
+ .catch(() => Promise.reject(new Error(packageDoesNotExist(pkg)))),
timeout(10000),
]);
}
@@ -100,27 +103,25 @@ const findViewlayer = async ({ env, log, options, packageJson }) => {
const json = await resolvePackageJson(key);
return { viewLayer: value, version: json.version };
})
- ).catch(() => Promise.reject(new Error(noViewLayerPackage(pkg)))),
+ ).catch(() => Promise.reject(new Error(packageDoesNotExist(pkg)))),
timeout(10000),
]);
};
const findAddons = async (deps, mainConfig) => {
- if (mainConfig.addons) {
+ if (mainConfig?.addons) {
return {
addons: mainConfig.addons.map((addon) => {
let name: string;
- let options: any;
if (typeof addon === 'string') {
name = addon.replace('/register', '');
} else {
- options = addon.options;
name = addon.name;
}
return {
- name,
- options,
+ name: supportedAddons[name],
+ packageName: name,
version: deps[name],
};
}),
@@ -150,25 +151,26 @@ const findConfigFlags = async ({ options, packageJson }) => {
};
const findBuilder = async (mainConfig) => {
- if (mainConfig.core?.builder) {
+ let name: string;
+ if (mainConfig?.core.builder) {
const { builder } = mainConfig.core;
-
- return {
- name: typeof builder === 'string' ? builder : builder.name,
- options: typeof builder === 'string' ? undefined : builder?.options ?? undefined,
- };
+ name = typeof builder === 'string' ? builder : builder.name;
+ } else {
+ name = 'webpack4';
}
- return {
- builder: {
- name: 'webpack4',
- options: undefined,
- },
- };
+
+ return Promise.race([
+ resolvePackageJson(builders[name])
+ .then((json) => ({ builder: { name, version: json.version } }))
+ .catch(() => Promise.reject(new Error(packageDoesNotExist(builders[name])))),
+ timeout(10000),
+ ]);
};
export const getStorybookMetadata = async (ctx: Context) => {
const configDir = ctx.options.storybookConfigDir ?? '.storybook';
- const mainConfig = loadMainConfig({ configDir });
+ const r = typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : require;
+ const mainConfig = await r(path.resolve(configDir, 'main'));
const allDependencies = {
...ctx.packageJson?.dependencies,
...ctx.packageJson?.devDependencies,

diff:
@@ -170,7 +170,9 @@ export interface Context {
packageName?: string;
packageVersion?: string;
}[];
- builder: string;
+ builder: {
+ name: string;
+ };
};
spawnParams: {
client: 'yarn' | 'npm';

diff:
@@ -8,8 +8,8 @@ const capitalize = (string: string) =>
const infoMessage = ({ addons, version, viewLayer, builder }: Context['storybook']) => {
const info = version && viewLayer ? `Storybook ${version} for ${capitalize(viewLayer)}` : '';
- const builderInfo = builder ? `${info}; using the ${builder} builder` : info;
- return addons.length
+ const builderInfo = builder ? `${info}; using the ${builder.name} builder` : info;
+ return addons?.length
? `${builderInfo}; supported addons found: ${addons
.map((addon) => capitalize(addon.name))
.join(', ')}`


message: get package info for builder

diff:
import { readFile } from 'jsonfile';
import { Context } from '../types';
+import { builders } from './builders';
import { supportedAddons } from './supportedAddons';
import { viewLayers } from './viewLayers';
+import packageDoesNotExist from '../ui/messages/errors/noViewLayerPackage';
+import { resolvePackageJson } from './getStorybookMetadata';
+import { timeout } from './promises';
/*
In Storybook 6.5+, when building a Storybook, a project.json file is generated,
containing metadata (sb builder, addons, viewLayer and viewLayer version) for the
particular setup.
*/
+type BuilderConfig =
+ | string
+ | {
+ name: string;
+ };
export interface SBProjectJson {
addons: Record<string, { version: string; options: any }>;
- builder?: {
- name: string;
- };
+ builder?: BuilderConfig;
framework: {
name: string;
};
+ storybookVersion: string;
storybookPackages?: Record<string, { version: string }>;
}
+const getBuilder = (sbProjectJson: SBProjectJson): { name: string; packageVersion: string } => {
+ let name: string;
+ if (sbProjectJson.builder) {
+ const { builder } = sbProjectJson;
+ name = typeof builder === 'string' ? sbProjectJson.builder : sbProjectJson.builder.name;
+ return {
+ name,
+ packageVersion: sbProjectJson.storybookPackages[builders[name]].version,
+ };
+ }
+
+ // Stroybook uses Webpack4 if no builder is explicitly set.
+ return {
+ name: 'webpack4',
+ packageVersion: sbProjectJson.storybookVersion,
+ };
+};
+
export const getStorybookMetadataFromProjectJson = async (
projectJsonPath: string
): Promise<Partial<Context['storybook']>> => {
@@ -27,17 +53,12 @@ export const getStorybookMetadataFromProjectJson = async (
const viewLayerPackage = Object.keys(viewLayers).find(
(viewLayer) => viewLayers[viewLayer] === sbProjectJson.framework.name
);
+ const builder = getBuilder(sbProjectJson);
+
return {
- viewLayer: sbProjectJson.framework.name ?? '',
+ viewLayer: sbProjectJson.framework.name ?? null,
version: sbProjectJson.storybookPackages[viewLayerPackage].version,
- builder: sbProjectJson?.builder
- ? {
- name:
- typeof sbProjectJson.builder === 'string'
- ? sbProjectJson.builder
- : sbProjectJson?.builder.name,
- }
- : { name: 'webpack4' },
+ builder,
addons: Object.keys(sbProjectJson.addons).map((addon) => ({
name: supportedAddons[addon],
packageName: addon,

diff:
@@ -18,7 +18,7 @@ jest.mock('./getPrebuiltStorybookMetadata', () => {
packageVersion: '6.5.5',
},
],
- builder: { name: 'webpack5' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
version: '6.5.5',
viewLayer: 'react',
})),
@@ -52,7 +52,7 @@ describe('getStorybookInfo', () => {
expect.objectContaining({
viewLayer: 'react',
version: expect.any(String),
- builder: { name: 'webpack5', version: '6.5.6' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
})
);
});
@@ -91,7 +91,7 @@ describe('getStorybookInfo', () => {
expect.objectContaining({
viewLayer: 'react',
version: expect.any(String),
- builder: { name: 'webpack5', version: '6.5.6' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
})
);
expect(log.info).toHaveBeenCalledWith(
@@ -108,7 +108,7 @@ describe('getStorybookInfo', () => {
expect.objectContaining({
viewLayer: 'react',
version: '3.2.1',
- builder: { name: 'webpack5', version: '6.5.6' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
})
);
});
@@ -119,7 +119,7 @@ describe('getStorybookInfo', () => {
expect.objectContaining({
viewLayer: 'react',
version: '3.2.1',
- builder: { name: 'webpack5', version: '6.5.6' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
})
);
});
@@ -172,7 +172,7 @@ describe('getStorybookInfo', () => {
packageVersion: '6.5.5',
},
],
- builder: { name: 'webpack5' },
+ builder: { name: 'webpack5', packageVersion: '6.5.6' },
version: '6.5.5',
viewLayer: 'react',
});

diff:
@@ -11,7 +11,7 @@ import { timeout, raceFulfilled } from './promises';
import { supportedAddons } from './supportedAddons';
import { builders } from './builders';
-const resolvePackageJson = (pkg: string) => {
+export const resolvePackageJson = (pkg: string) => {
try {
// we bundle this app for node, meaning all require calls are replaced by webpack.
// in this case we want to use node's actual require functionality!
@@ -108,8 +108,13 @@ const findViewlayer = async ({ env, log, options, packageJson }) => {
]);
};
-const findAddons = async (deps, mainConfig) => {
+const findAddons = async (ctx, mainConfig) => {
if (mainConfig?.addons) {
+ const allDependencies = {
+ ...ctx.packageJson?.dependencies,
+ ...ctx.packageJson?.devDependencies,
+ ...ctx.packageJson?.peerDependencies,
+ };
return {
addons: mainConfig.addons.map((addon) => {
let name: string;
@@ -122,7 +127,7 @@ const findAddons = async (deps, mainConfig) => {
return {
name: supportedAddons[name],
packageName: name,
- version: deps[name],
+ packageVersion: allDependencies[name],
};
}),
};
@@ -150,7 +155,7 @@ const findConfigFlags = async ({ options, packageJson }) => {
};
};
-const findBuilder = async (mainConfig) => {
+export const findBuilder = async (mainConfig) => {
let name: string;
if (mainConfig?.core.builder) {
const { builder } = mainConfig.core;
@@ -161,7 +166,7 @@ const findBuilder = async (mainConfig) => {
return Promise.race([
resolvePackageJson(builders[name])
- .then((json) => ({ builder: { name, version: json.version } }))
+ .then((json) => ({ builder: { name, packageVersion: json.version } }))
.catch(() => Promise.reject(new Error(packageDoesNotExist(builders[name])))),
timeout(10000),
]);
@@ -171,14 +176,9 @@ export const getStorybookMetadata = async (ctx: Context) => {
const configDir = ctx.options.storybookConfigDir ?? '.storybook';
const r = typeof __non_webpack_require__ !== 'undefined' ? __non_webpack_require__ : require;
const mainConfig = await r(path.resolve(configDir, 'main'));
- const allDependencies = {
- ...ctx.packageJson?.dependencies,
- ...ctx.packageJson?.devDependencies,
- ...ctx.packageJson?.peerDependencies,
- };
const info = await Promise.all([
- findAddons(allDependencies, mainConfig),
+ findAddons(ctx, mainConfig),
findConfigFlags(ctx),
findViewlayer(ctx),
findBuilder(mainConfig),

diff:
@@ -172,6 +172,8 @@ export interface Context {
}[];
builder: {
name: string;
+ packageName?: string;
+ packageVersion?: string;
};
};
spawnParams: {

diff:
@@ -9,7 +9,7 @@ export default {
const storybook = {
version: '5.3.0',
viewLayer: 'web-components',
- builder: 'webpack4',
+ builder: { name: 'webpack4', packageVersion: '5.3.0' },
addons: [],
};
const addons = [{ name: 'actions' }, { name: 'docs' }, { name: 'design-assets' }];

diff:
@@ -8,7 +8,9 @@ const capitalize = (string: string) =>
const infoMessage = ({ addons, version, viewLayer, builder }: Context['storybook']) => {
const info = version && viewLayer ? `Storybook ${version} for ${capitalize(viewLayer)}` : '';
- const builderInfo = builder ? `${info}; using the ${builder.name} builder` : info;
+ const builderInfo = builder
+ ? `${info}; using the ${builder.name} builder (${builder.packageVersion})`
+ : info;
return addons?.length
? `${builderInfo}; supported addons found: ${addons
.map((addon) => capitalize(addon.name))

original_message: get package info for builder


message: Remove incorrect tyoe

diff:
@@ -12,15 +12,12 @@ import { timeout } from './promises';
containing metadata (sb builder, addons, viewLayer and viewLayer version) for the
particular setup.
*/
-type BuilderConfig =
- | string
- | {
- name: string;
- };
export interface SBProjectJson {
addons: Record<string, { version: string; options: any }>;
- builder?: BuilderConfig;
+ builder?: {
+ name: string;
+ };
framework: {
name: string;
};
@@ -32,7 +29,7 @@ const getBuilder = (sbProjectJson: SBProjectJson): { name: string; packageVersio
let name: string;
if (sbProjectJson.builder) {
const { builder } = sbProjectJson;
- name = typeof builder === 'string' ? sbProjectJson.builder : sbProjectJson.builder.name;
+ name = sbProjectJson.builder.name;
return {
name,
packageVersion: sbProjectJson.storybookPackages[builders[name]].version,

original_message: Remove incorrect tyoe


message: Add new builder item"

diff:
@@ -2,4 +2,5 @@ export const builders = {
webpack4: '@storybook/builder-webpack4',
webpack5: '@storybook/builder-webpack5',
'@storybook/vite-builder': '@storybook/builder-vite',
+ '@storybook/builder-webpack5': '@storybook/builder-webpack5',
} as Record<string, string>;

original_message: Add new builder item"


message: Add actual project json files to be read

diff:
+{
+ "generatedAt": 1654054690474,
+ "builder": {
+ "name": "webpack5"
+ },
+ "hasCustomBabel": false,
+ "hasCustomWebpack": true,
+ "hasStaticDirs": false,
+ "hasStorybookEslint": false,
+ "refCount": 0,
+ "packageManager": {
+ "type": "yarn",
+ "version": "1.22.18"
+ },
+ "features": {
+ "postcss": false
+ },
+ "storybookVersion": "6.5.6",
+ "language": "typescript",
+ "storybookPackages": {
+ "@storybook/addon-essentials": {
+ "version": "6.5.6"
+ },
+ "@storybook/builder-webpack5": {
+ "version": "6.5.6"
+ },
+ "@storybook/eslint-config-storybook": {
+ "version": "3.1.2"
+ },
+ "@storybook/linter-config": {
+ "version": "3.1.2"
+ },
+ "@storybook/manager-webpack5": {
+ "version": "6.5.6"
+ },
+ "@storybook/react": {
+ "version": "6.5.6"
+ }
+ },
+ "framework": {
+ "name": "react"
+ },
+ "addons": {
+ "@storybook/addon-viewport": {
+ "version": "6.5.6"
+ }
+ }
+}

diff:
@@ -54,7 +54,7 @@ export const getStorybookMetadataFromProjectJson = async (
return {
viewLayer: sbProjectJson.framework.name ?? null,
- version: sbProjectJson.storybookPackages[viewLayerPackage].version,
+ version: sbProjectJson.storybookPackages[viewLayerPackage].version ?? null,
builder,
addons: Object.keys(sbProjectJson.addons).map((addon) => ({
name: supportedAddons[addon],

diff:
import mock from 'mock-fs';
import { Context } from '../types';
import getStorybookInfo from './getStorybookInfo';
-import { getStorybookMetadataFromProjectJson } from './getPrebuiltStorybookMetadata';
jest.useFakeTimers();
-jest.mock('./getPrebuiltStorybookMetadata', () => {
- const original = jest.requireActual('./getPrebuiltStorybookMetadata'); // Step 2.
- return {
- __esModule: true,
- ...original,
- getStorybookMetadataFromProjectJson: jest.fn(() => ({
- addons: [
- {
- name: 'essentials',
- packageName: '@storybook/addon-essentials',
- packageVersion: '6.5.5',
- },
- ],
- builder: { name: 'webpack5', packageVersion: '6.5.6' },
- version: '6.5.5',
- viewLayer: 'react',
- })),
- };
-});
-
const log = { info: jest.fn(), warn: jest.fn(), error: jest.fn(), debug: jest.fn() };
const context: Context = { env: {}, log, options: {}, packageJson: {} } as any;
const getContext = (ctx: any): Context => ({ ...context, ...ctx });
@@ -39,6 +18,7 @@ afterEach(() => {
log.debug.mockReset();
});
+jest.setTimeout(10000);
describe('getStorybookInfo', () => {
afterEach(() => {
// This would clear all existing timer functions
@@ -146,51 +126,30 @@ describe('getStorybookInfo', () => {
});
describe('with --storybook-build-dir', () => {
- beforeAll(() => {
- mock({
- 'storybook-static': {
- 'project.json':
- '{"generatedAt":1654054690474,"builder":{"name":"webpack5"},"hasCustomBabel":false,"hasCustomWebpack":true,"hasStaticDirs":false,"hasStorybookEslint":false,"refCount":0,"packageManager":{"type":"yarn","version":"1.22.18"},"features":{"postcss":false},"storybookVersion":"6.5.6","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"6.5.6"},"@storybook/builder-webpack5":{"version":"6.5.6"},"@storybook/eslint-config-storybook":{"version":"3.1.2"},"@storybook/linter-config":{"version":"3.1.2"},"@storybook/manager-webpack5":{"version":"6.5.6"},"@storybook/react":{"version":"6.5.6"}},"framework":{"name":"react"},"addons":{"@storybook/addon-viewport":{"version":"6.5.6"}}}',
- },
- });
- });
-
- afterAll(() => {
- mock.restore();
- });
-
it('returns viewLayer and version from packageJson', async () => {
const ctx = getContext({
- options: { storybookBuildDir: 'storybook-static' },
+ options: { storybookBuildDir: 'bin-src/__mocks__/normalProjectJson' },
packageJson: { dependencies: REACT },
});
await expect(getStorybookInfo(ctx)).resolves.toEqual({
addons: [
{
- name: 'essentials',
- packageName: '@storybook/addon-essentials',
- packageVersion: '6.5.5',
+ name: 'viewport',
+ packageName: '@storybook/addon-viewport',
+ packageVersion: '6.5.6',
},
],
builder: { name: 'webpack5', packageVersion: '6.5.6' },
- version: '6.5.5',
+ version: '6.5.6',
viewLayer: 'react',
});
});
it('returns no metadata if cannot find project.json', async () => {
const ctx = getContext({
- options: { storybookBuildDir: 'storybook-static' },
+ options: { storybookBuildDir: 'bin-src/__mocks__/malformedProjectJson' },
packageJson: { dependencies: REACT },
});
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
- getStorybookMetadataFromProjectJson.mockImplementation(() => ({
- addons: [],
- version: null,
- viewLayer: null,
- builder: null,
- }));
await expect(getStorybookInfo(ctx)).resolves.toEqual({
addons: [],
version: null,

diff:
@@ -14,9 +14,14 @@ export default async function getStorybookInfo(
const projectJsonPath = path.resolve(ctx.options.storybookBuildDir, 'project.json');
// This test makes sure we fall through if the file does not exist.
if (fs.pathExistsSync(projectJsonPath)) {
+ /*
+ This await is needed in order to for the catch block
+ to get the result in the case that this function fails.
+ */
return await getStorybookMetadataFromProjectJson(projectJsonPath);
}
}
+ // Same for this await.
return await getStorybookMetadata(ctx);
} catch (e) {
ctx.log.debug(e);

diff:
@@ -31,7 +31,7 @@ export async function main(argv: string[]) {
const env = getEnv();
const log = createLogger(sessionId, env);
- const pkgInfo = readPkgUp.sync({ cwd: process.cwd() });
+ const pkgInfo = await readPkgUp({ cwd: process.cwd() });
if (!pkgInfo) {
log.error(noPackageJson());
process.exit(253);


message: make getBuilder more readable

diff:
@@ -26,20 +26,15 @@ export interface SBProjectJson {
}
const getBuilder = (sbProjectJson: SBProjectJson): { name: string; packageVersion: string } => {
- let name: string;
- if (sbProjectJson.builder) {
- const { builder } = sbProjectJson;
- name = sbProjectJson.builder.name;
- return {
- name,
- packageVersion: sbProjectJson.storybookPackages[builders[name]].version,
- };
+ const { builder, storybookPackages, storybookVersion } = sbProjectJson;
+ return builder
+ ? {
+ name: builder.name,
+ packageVersion: storybookPackages[builders[builder.name]].version,
}
-
- // Storybook uses Webpack4 if no builder is explicitly set.
- return {
- name: 'webpack4',
- packageVersion: sbProjectJson.storybookVersion,
+ : {
+ name: 'webpack4', // the default builder for Storybook v6
+ packageVersion: storybookVersion,
};
};

original_message: make getBuilder more readable


diff:
@@ -51,10 +51,10 @@ export const getStorybookMetadataFromProjectJson = async (
viewLayer: sbProjectJson.framework.name ?? null,
version: sbProjectJson.storybookPackages[viewLayerPackage].version ?? null,
builder,
- addons: Object.keys(sbProjectJson.addons).map((addon) => ({
- name: supportedAddons[addon],
- packageName: addon,
- packageVersion: sbProjectJson.addons[addon].version,
+ addons: Object.entries(sbProjectJson.addons).map(([packageName, addon]) => ({
+ name: supportedAddons[packageName],
+ packageName,
+ packageVersion: addon.version,
})),
};
};

original_message:
refactor addons map for prebuiltMetadata

Co-authored-by: Gert Hengeveld <info@ghengeveld.nl>


message: remove if branch for findBuilder

diff:
@@ -156,12 +156,10 @@ const findConfigFlags = async ({ options, packageJson }) => {
};
export const findBuilder = async (mainConfig) => {
- let name: string;
+ let name = 'webpack4'; // default builder in Storybook v6
if (mainConfig?.core.builder) {
const { builder } = mainConfig.core;
name = typeof builder === 'string' ? builder : builder.name;
- } else {
- name = 'webpack4';
}
return Promise.race([

original_message:
remove if branch for findBuilder

Co-authored-by: Gert Hengeveld <info@ghengeveld.nl>