Addon-controls: Make ensureDocsBeforeControls support sub-dependencies

This commit is contained in:
Jonathan Trang 2020-11-21 14:07:58 +01:00
parent a5bd17f262
commit d5efc50048
2 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ describe.each([
describe.each([
[['@storybook/addon-docs', '@storybook/addon-controls']],
[['@storybook/addon-docs', 'foo/node_modules/@storybook/addon-controls']],
[[{ name: '@storybook/addon-docs' }, '@storybook/addon-controls']],
[['@storybook/addon-essentials', '@storybook/addon-controls']],
[['@storybook/addon-essentials']],

View File

@ -8,7 +8,7 @@ type Entry = string | OptionsEntry;
const findIndex = (addon: string, addons: Entry[]) =>
addons.findIndex((entry) => {
const name = (entry as OptionsEntry).name || (entry as string);
return name && name.startsWith(addon);
return name && name.includes(addon);
});
const indexOfAddonOrEssentials = (addon: string, addons: Entry[]) => {