woocommerce/tools/storybook/import-wp-css-storybook.sh

30 lines
1.3 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
STORYBOOK_WORDPRESS_DIR="$DIR/../storybook/wordpress";
STORY_BOOK_CSS_PATH="$DIR/../storybook/wordpress/css";
TMP_DIR="$DIR/../storybook/wordpress/tmp";
ARCHIVE_CSS_PATH="wordpress/wp-admin/css";
ARCHIVE_IMG_PATH="wordpress/wp-admin/images";
[DataView]: Add Products View and Product Edit stories (#50999) * Product Editor: add storybook * fix storybook * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * WIP * WIP * WIP * Fix storybook build * Ignore storybook from version pinning * add slug stories * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * Fix custom status filters * Make sure page size works with view config * improve storybook * rename file * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * Remove use of canvasMode and navigation context as it is not needed * Remove wordpress/dom from syncpack * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * add edit-site style * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * remove not necessary file * address feedback * fix webpack configuration * fix lint errors --------- Co-authored-by: Lourens Schep <lourensschep@gmail.com> Co-authored-by: Sam Seay <samueljseay@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
2024-09-03 14:09:54 +00:00
ARCHIVE_EDIT_SITE_PATH="wordpress/wp-includes/css/dist/edit-site/style.css";
mkdir -p "$STORY_BOOK_CSS_PATH";
mkdir -p "$TMP_DIR";
function download_and_extract_css {
curl -o "$STORYBOOK_WORDPRESS_DIR/wordpress-latest.zip" https://wordpress.org/nightly-builds/wordpress-latest.zip;
[DataView]: Add Products View and Product Edit stories (#50999) * Product Editor: add storybook * fix storybook * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * WIP * WIP * WIP * Fix storybook build * Ignore storybook from version pinning * add slug stories * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * Fix custom status filters * Make sure page size works with view config * improve storybook * rename file * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * Remove use of canvasMode and navigation context as it is not needed * Remove wordpress/dom from syncpack * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * add edit-site style * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * remove not necessary file * address feedback * fix webpack configuration * fix lint errors --------- Co-authored-by: Lourens Schep <lourensschep@gmail.com> Co-authored-by: Sam Seay <samueljseay@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
2024-09-03 14:09:54 +00:00
unzip -qq "$STORYBOOK_WORDPRESS_DIR/wordpress-latest.zip" "$ARCHIVE_CSS_PATH/*" "$ARCHIVE_IMG_PATH/*" "$ARCHIVE_EDIT_SITE_PATH" -d "$TMP_DIR";
rsync -a "$TMP_DIR/$ARCHIVE_CSS_PATH" "$STORYBOOK_WORDPRESS_DIR";
rsync -a "$TMP_DIR/$ARCHIVE_IMG_PATH" "$STORYBOOK_WORDPRESS_DIR";
[DataView]: Add Products View and Product Edit stories (#50999) * Product Editor: add storybook * fix storybook * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * WIP * WIP * WIP * Fix storybook build * Ignore storybook from version pinning * add slug stories * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * Fix custom status filters * Make sure page size works with view config * improve storybook * rename file * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * Remove use of canvasMode and navigation context as it is not needed * Remove wordpress/dom from syncpack * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * add edit-site style * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * remove not necessary file * address feedback * fix webpack configuration * fix lint errors --------- Co-authored-by: Lourens Schep <lourensschep@gmail.com> Co-authored-by: Sam Seay <samueljseay@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
2024-09-03 14:09:54 +00:00
rsync -a "$TMP_DIR/$ARCHIVE_EDIT_SITE_PATH" "$STORYBOOK_WORDPRESS_DIR/css/edit-site.css";
rm -r "$TMP_DIR";
[DataView]: Add Products View and Product Edit stories (#50999) * Product Editor: add storybook * fix storybook * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * WIP * WIP * WIP * Fix storybook build * Ignore storybook from version pinning * add slug stories * Add products data views list * Add navigation on the left * Update edit site package * Fix styling * Add changelog * Add wp/icons package to syncpack exception list * Delete some unused stuff and address types * Add changelog * Remove un needed css * Remove dependency on edit-site package * Fix custom status filters * Make sure page size works with view config * improve storybook * rename file * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * Remove use of canvasMode and navigation context as it is not needed * Remove wordpress/dom from syncpack * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * add edit-site style * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor * remove not necessary file * address feedback * fix webpack configuration * fix lint errors --------- Co-authored-by: Lourens Schep <lourensschep@gmail.com> Co-authored-by: Sam Seay <samueljseay@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
2024-09-03 14:09:54 +00:00
rm -r "$STORYBOOK_WORDPRESS_DIR/wordpress-latest.zip";
}
if [ -z "$(find "$STORY_BOOK_CSS_PATH" -iname '*.css')" ] || [ "$1" == "-f" ]
then
# The directory is not empty, import css
download_and_extract_css;
else
echo "Wordpress CSS already imported, pass -f to force an update";
fi