-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathcopy-vendor-styles.sh
executable file
·52 lines (40 loc) · 1.29 KB
/
copy-vendor-styles.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
################################################################################
# Helper script to copy over scss folders from `@carbon/<package>` dependencies
# located in `node_modules`. You can run this script in the terminal by running:
#
# ```
# ./tools/copy-vendor-styles.sh
# ```
################################################################################
set -e
# Start in tools/ even if run from root directory
cd "$(dirname "$0")"
# Go to root
cd ..
root_path=$PWD
echo "Cleaning vendor directory..."
VENDOR_DIR="$PWD/src/globals/scss/vendor"
rm -rf $VENDOR_DIR
for package in node_modules/@carbon/*; do
PKG_NAME="@carbon/$(basename $package)"
TARGET_DIR="$VENDOR_DIR/$PKG_NAME"
SCSS_FILES="$package/scss"
if [ -d "$SCSS_FILES" ]; then
echo "Copying scss files for package: $PKG_NAME to $TARGET_DIR"
mkdir -p $TARGET_DIR
cp -R $SCSS_FILES $TARGET_DIR
fi
done
for symlink in $(find ../../node_modules/@carbon -type l -maxdepth 1); do
package=$(readlink $symlink)
PKG_NAME="@carbon/$(basename $package)"
TARGET_DIR="$VENDOR_DIR/$PKG_NAME"
SCSS_FILES="$package/scss"
if [ -d "$SCSS_FILES" ]; then
echo "Copying scss files for package: $PKG_NAME to $TARGET_DIR"
mkdir -p $TARGET_DIR
cp -R $SCSS_FILES $TARGET_DIR
fi
done
echo "Success! 🎉"