mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 21:41:21 +08:00
change some references back to register, and update a few docs
This commit is contained in:
parent
789a272204
commit
b4c24689fc
@ -2,7 +2,7 @@
|
||||
// /my-addon/src/preset.js
|
||||
|
||||
function managerEntries(entry = []) {
|
||||
return [...entry, require.resolve("./manager")]; //👈 Addon implementation
|
||||
return [...entry, require.resolve("./register")]; //👈 Addon implementation
|
||||
}
|
||||
|
||||
module.exports = { managerEntries }
|
||||
|
@ -2,7 +2,7 @@
|
||||
// my-preset/index.js
|
||||
|
||||
function managerEntries(entry = []) {
|
||||
return [...entry, require.resolve('my-other-addon/manager')];
|
||||
return [...entry, require.resolve('my-other-addon/register')];
|
||||
}
|
||||
|
||||
const config = (entry = [], options) => {
|
||||
|
@ -6,7 +6,7 @@ export function config(entry = []) {
|
||||
}
|
||||
|
||||
export function managerEntries(entries) {
|
||||
return [...entries, require.resolve('./manager')];
|
||||
return [...entries, require.resolve('./register')];
|
||||
}
|
||||
|
||||
export const parameters = {
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
module.exports = {
|
||||
addons: [
|
||||
'@storybook/addon-storysource/manager', // A managerEntry registered here, in this case from the storysource addon.
|
||||
'@storybook/addon-docs/preset', // A preset registered here, in this case from the addon-docs addon.
|
||||
],
|
||||
};
|
||||
|
@ -2,6 +2,6 @@
|
||||
// .storybook/main.js
|
||||
|
||||
module.exports = {
|
||||
managerEntries: ['@storybook/addon-storysource/manager'],
|
||||
managerEntries: ['some-storybook-addon/entry-point.js'],
|
||||
};
|
||||
```
|
@ -1,7 +1,5 @@
|
||||
```js
|
||||
// storysource/preset.js
|
||||
|
||||
export function managerEntries(entry = []) {
|
||||
return [...entry, require.resolve('@storybook/addon-storysource/manager')];
|
||||
}
|
||||
/* nothing needed */
|
||||
```
|
@ -106,13 +106,20 @@ export const resolveAddonName = (
|
||||
}
|
||||
|
||||
if (managerFile || registerFile || previewFile || presetFile) {
|
||||
const managerEntries = [];
|
||||
|
||||
if (managerFile) {
|
||||
managerEntries.push(managerFile);
|
||||
}
|
||||
// register file is the old way of registering addons
|
||||
if (!managerFile && registerFile && !presetFile) {
|
||||
managerEntries.push(registerFile);
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'virtual',
|
||||
name: path,
|
||||
// register file is the old way of registering addons
|
||||
...(managerFile || registerFile
|
||||
? { managerEntries: [managerFile, !presetFile && registerFile].filter(Boolean) }
|
||||
: {}),
|
||||
...(managerEntries.length ? { managerEntries } : {}),
|
||||
...(previewFile ? { previewAnnotations: [previewFile] } : {}),
|
||||
...(presetFile ? { presets: [{ name: presetFile, options }] } : {}),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user