Skip to content

Commit

Permalink
move addon order check from preset.js to dist/preset.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Jan 15, 2025
1 parent 1664776 commit 1a0d0ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
11 changes: 1 addition & 10 deletions code/addons/interactions/preset.js
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
const { checkActionsLoaded } = require('./dist/preset');

function previewAnnotations(entry = [], options) {
checkActionsLoaded(options.configDir);
return entry;
}

module.exports = {
previewAnnotations,
};
module.exports = require('./dist/preset');
11 changes: 6 additions & 5 deletions code/addons/interactions/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isAbsolute, join } from 'node:path';

import { checkAddonOrder, serverRequire } from 'storybook/internal/common';

export const checkActionsLoaded = (configDir: string) => {
export function previewAnnotations(entry: string[] = [], options: { configDir: string }) {
checkAddonOrder({
before: {
name: '@storybook/addon-actions',
Expand All @@ -12,12 +12,13 @@ export const checkActionsLoaded = (configDir: string) => {
name: '@storybook/addon-interactions',
inEssentials: false,
},
configFile: isAbsolute(configDir)
? join(configDir, 'main')
: join(process.cwd(), configDir, 'main'),
configFile: isAbsolute(options.configDir)
? join(options.configDir, 'main')
: join(process.cwd(), options.configDir, 'main'),
getConfig: (configFile) => serverRequire(configFile),
});
};
return entry;
}

// This annotation is read by addon-test, so it can throw an error if both addons are used
export const ADDON_INTERACTIONS_IN_USE = true;

0 comments on commit 1a0d0ea

Please sign in to comment.