2020-02-24 02:25:26 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2020-04-29 17:03:20 +00:00
|
|
|
const path = require( 'path' );
|
2021-06-02 03:54:00 +00:00
|
|
|
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
|
2020-02-24 02:25:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
const wcAdminWebpackConfig = require( '../webpack.config.js' );
|
|
|
|
|
2020-04-29 17:03:20 +00:00
|
|
|
const wcAdminPackages = [
|
|
|
|
'components',
|
|
|
|
'csv-export',
|
|
|
|
'currency',
|
|
|
|
'date',
|
|
|
|
'navigation',
|
|
|
|
'number',
|
|
|
|
'data',
|
2020-08-20 04:59:52 +00:00
|
|
|
'tracks',
|
2021-05-14 15:23:01 +00:00
|
|
|
'experimental',
|
2020-04-29 17:03:20 +00:00
|
|
|
];
|
|
|
|
|
2021-06-02 03:54:00 +00:00
|
|
|
module.exports = ( storybookConfig ) => {
|
|
|
|
storybookConfig.module.rules.push( ...wcAdminWebpackConfig.module.rules );
|
2020-02-24 02:25:26 +00:00
|
|
|
|
|
|
|
storybookConfig.resolve.alias = wcAdminWebpackConfig.resolve.alias;
|
|
|
|
|
2020-04-29 17:03:20 +00:00
|
|
|
wcAdminPackages.forEach( ( name ) => {
|
|
|
|
storybookConfig.resolve.alias[
|
|
|
|
`@woocommerce/${ name }`
|
|
|
|
] = path.resolve( __dirname, `../packages/${ name }/src` );
|
|
|
|
} );
|
|
|
|
|
2021-06-02 03:54:00 +00:00
|
|
|
storybookConfig.resolve.alias[ '@woocommerce/settings' ] = path.resolve(
|
|
|
|
__dirname,
|
2022-01-07 05:05:22 +00:00
|
|
|
'./setting.mock.js'
|
2021-06-02 03:54:00 +00:00
|
|
|
);
|
|
|
|
|
2020-05-19 13:16:19 +00:00
|
|
|
storybookConfig.resolve.modules = [
|
|
|
|
path.join( __dirname, '../client' ),
|
|
|
|
'node_modules',
|
|
|
|
];
|
|
|
|
|
2020-02-24 02:25:26 +00:00
|
|
|
storybookConfig.plugins.push(
|
2021-06-02 03:54:00 +00:00
|
|
|
...wcAdminWebpackConfig.plugins,
|
2022-03-18 10:59:05 +00:00
|
|
|
new CopyWebpackPlugin( {
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: path.resolve( __dirname, 'wordpress/css' ),
|
|
|
|
to: 'wordpress/css/[name][ext]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: path.resolve(
|
|
|
|
__dirname,
|
|
|
|
`../packages/components/build-style/*.css`
|
|
|
|
),
|
|
|
|
to: `./component-css/[name][ext]`,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: path.resolve(
|
|
|
|
__dirname,
|
|
|
|
`../packages/experimental/build-style/*.css`
|
|
|
|
),
|
|
|
|
to: `./experimental-css/[name][ext]`,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
} )
|
2020-02-24 02:25:26 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return storybookConfig;
|
|
|
|
};
|