Add composition path prefix to storybook to allow publishing to gh-pages (#51700)

Add composition path prefix to storybook
This commit is contained in:
louwie17 2024-09-26 09:24:29 -03:00 committed by GitHub
parent 645832da4b
commit ed1e40204a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -27,6 +27,8 @@ jobs:
- name: Build Storybook
run: pnpm --filter='@woocommerce/storybook' build-storybook --quiet
env:
STORYBOOK_COMPOSITION_PATH_PREFIX: /woocommerce
- name: Deploy
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0

View File

@ -28,11 +28,18 @@ module.exports = {
if ( configType === 'DEVELOPMENT' ) {
return {};
}
let pathPrefix = (
process.env.STORYBOOK_COMPOSITION_PATH_PREFIX ?? ''
).trim();
if ( pathPrefix && ! pathPrefix.startsWith( '/' ) ) {
pathPrefix = '/' + pathPrefix;
}
return {
'woocommerce-blocks': {
expanded: false,
title: 'WooCommerce Blocks',
url: '/assets/woocommerce-blocks',
url: pathPrefix + '/assets/woocommerce-blocks',
},
};
},