Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0680440
feat: remove storybook-html in favor of storybook-react v9.x
Jun 10, 2025
3d3518f
feat: install vite and dependencies
cienvaras Jun 29, 2025
4040960
feat: update storybook configuration
cienvaras Jun 30, 2025
60dbdcc
feat: remove all webpack specific plugins but leave the config files …
Sep 10, 2025
ab7efbd
feat: port file compilation logic from webpack and split up config
Sep 11, 2025
b255a4d
chore: version bump
Sep 11, 2025
4b167b5
feat: enable vite watching and refactor the entry array being passed …
Sep 12, 2025
89cd952
chore: remove eslint-disable flag
Sep 12, 2025
fdcb146
feat: configure compilation logic for JS/CSS file locations
Sep 15, 2025
602bd8a
feat: copy srcmaps to compiled folders
Sep 15, 2025
eb6b2bc
feat: copy srcmaps to compiled folders
Sep 15, 2025
918ef9d
feat: jsdoc standards for entries.js
Sep 15, 2025
4c25bb6
chore: cleanup unused packages
Sep 15, 2025
e6c6983
chore: prettier format changes
Sep 15, 2025
beb3b1f
Merge pull request #208 from emulsify-ds/feat-split-plugin-entries-en…
callinmullaney Sep 15, 2025
c62331d
fix: vite integration issues fix
cienvaras Sep 29, 2025
ec62bdb
chore: dependency updates
Oct 1, 2025
fc6316a
feat: ensure static assets are copied over with compiled assets
Oct 2, 2025
a7509d5
chore: eslint fixes for entries
Oct 2, 2025
e3ea68b
chore: eslint fixes for environment
Oct 2, 2025
858d2fb
chore: eslint fixes for plugins
Oct 2, 2025
7fb24e3
chore: eslint fixes for plugins
Oct 2, 2025
40d4a84
feat: add sass glob importer support
Oct 2, 2025
91cb110
feat: account for structureImplementations when compiling files for l…
Oct 3, 2025
ff75a72
feat: account for structureImplementations when compiling files for l…
Oct 3, 2025
8945833
chore: lint fixes
Oct 3, 2025
dcf8a68
chore: lint fixes
Oct 3, 2025
e07bb85
feat: change legacy reference to structure overrides
Oct 3, 2025
592ae21
feat: move svgsprite plugin to baseplugins
Oct 3, 2025
b3ebff0
chore: restore legacy emulsify compiling structure
Oct 3, 2025
0aa365d
feat: allow for plugin and vite.config extension per project
Oct 3, 2025
89ef589
feat: better code commenting for vite.config.js
Oct 3, 2025
2bbd0ae
Merge pull request #220 from emulsify-ds/emulsify-537
callinmullaney Oct 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/emulsifyTheme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Documentation on theming Storybook: https://storybook.js.org/docs/configurations/theming/
import { create } from '@storybook/theming';
import { create } from 'storybook/theming';

export default create({
base: 'dark',
Expand Down
48 changes: 37 additions & 11 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* @module .storybook/main
*/

import { resolve } from 'path';
import fs from 'fs';
import path from 'path';
import path, { resolve } from 'path';
import { fileURLToPath } from 'url';
import configOverrides from '../../../../config/emulsify-core/storybook/main.js';
import viteConfig from '../config/vite/vite.config.js';

/**
* The full path to the current file (ESM compatible).
Expand All @@ -23,7 +23,7 @@ const __filename = fileURLToPath(import.meta.url);
* The directory name of the current module file.
* @type {string}
*/
const __dirname = path.dirname(__filename);
const __dirname = path.dirname(__filename);

/**
* Safely apply any user-provided overrides or fall back to an empty object.
Expand All @@ -41,7 +41,7 @@ const config = {
* @type {string[]}
*/
stories: [
'../../../../(src|components)/**/*.stories.@(js|jsx|ts|tsx)',
'../../../../@(src|components)/**/*.stories.@(js|jsx|ts|tsx)',
],

/**
Expand All @@ -59,19 +59,17 @@ const config = {
* @type {string[]}
*/
addons: [
'../../../@storybook/addon-a11y',
'../../../@storybook/addon-links',
'../../../@storybook/addon-essentials',
'../../../@storybook/addon-themes',
'../../../@storybook/addon-styling-webpack',
'@storybook/addon-a11y',
'@storybook/addon-links',
'@storybook/addon-themes',
],

/**
* Core builder configuration for Storybook.
* @type {{builder: string, disableTelemetry: boolean}}
*/
core: {
builder: 'webpack5',
builder: '@storybook/builder-vite',
disableTelemetry: true,
},

Expand All @@ -80,7 +78,7 @@ const config = {
* @type {{name: string, options: object}}
*/
framework: {
name: '@storybook/html-webpack5',
name: '@storybook/react-vite',
options: {},
},

Expand Down Expand Up @@ -237,6 +235,34 @@ ${externalManagerHtml}`;
${externalHtml}`;
},

// Storybook specific Vite configuration.
async viteFinal(config) {
const { mergeConfig } = await import('vite');
return mergeConfig(config, {
...viteConfig,
esbuild: {
'jsx': 'automatic',
loader: 'jsx',
include: /.*\.jsx?$/,
exclude: [],
},
optimizeDeps: {
include: [
'path',
'twig',
'twig-drupal-filters',
'bem-twig-extension',
'add-attributes-twig-extension',
],
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
})
},

// Merge in user overrides without modifying original logic
...safeConfigOverrides,
};
Expand Down
3 changes: 1 addition & 2 deletions .storybook/manager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// .storybook/manager.js

import { addons } from '@storybook/manager-api';
import { addons } from 'storybook/manager-api';
import emulsifyTheme from './emulsifyTheme';

/**
Expand Down Expand Up @@ -42,4 +42,3 @@ import('../../../../config/emulsify-core/storybook/theme')
theme: emulsifyTheme,
});
});

6 changes: 3 additions & 3 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// .storybook/preview.js
import { useEffect } from '@storybook/preview-api';
import Twig from 'twig';
import { setupTwig, fetchCSSFiles } from './utils.js';
import { getRules } from 'axe-core';
import { useEffect } from 'storybook/preview-api';
import Twig from 'twig';
import { fetchCSSFiles, setupTwig } from './utils.js';

/**
* External override parameters loaded from project config file, if present.
Expand Down
29 changes: 6 additions & 23 deletions .storybook/utils.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
import { resolve, dirname } from 'path';
import twigDrupal from 'twig-drupal-filters';
import twigBEM from 'bem-twig-extension';
import twigAddAttributes from 'add-attributes-twig-extension';
import twigBEM from 'bem-twig-extension';
import twigDrupal from 'twig-drupal-filters';
import emulsifyConfig from '../../../../project.emulsify.json' with { type: 'json' };

// Create __filename from import.meta.url without fileURLToPath
let _filename = decodeURIComponent(new URL(import.meta.url).pathname);

// On Windows, remove the leading slash (e.g. "/C:/path" -> "C:/path")
if (process.platform === 'win32' && _filename.startsWith('/')) {
_filename = _filename.slice(1);
}

const _dirname = dirname(_filename);

/**
* Fetches project-based variant configuration. If no such configuration
* exists, returns default values as a flat component structure.
Expand Down Expand Up @@ -42,25 +31,19 @@ const fetchVariantConfig = () => {
const fetchCSSFiles = () => {
try {
// Load all CSS files from 'dist'.
const cssFiles = require.context('../../../../dist', true, /\.css$/);
cssFiles.keys().forEach((file) => cssFiles(file));
const cssFiles = import.meta.glob('../../../../dist/**/*.css', { eager: true });
Object.values(cssFiles).forEach((css) => css);

// Load all CSS files from 'components' for 'drupal' platform.
if (emulsifyConfig.project.platform === 'drupal') {
const drupalCSSFiles = require.context('../../../../components', true, /\.css$/);
drupalCSSFiles.keys().forEach((file) => drupalCSSFiles(file));
const drupalCSSFiles = import.meta.glob('../../../../components/**/*.css', { eager: true });
Object.values(drupalCSSFiles).forEach((css) => css);
}
} catch (e) {
return undefined;
}
};

// Build namespaces mapping.
export const namespaces = {};
for (const { name, directory } of fetchVariantConfig()) {
namespaces[name] = resolve(_dirname, '../../../../', directory);
}

/**
* Configures and extends a standard Twig object.
*
Expand Down
Loading