Skip to content

Commit cae4ede

Browse files
authored
chore(dev-scripts): allow to link cube packages without need for project (#9075)
1 parent 667f309 commit cae4ede

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

dev-env.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ set -e
55
CURRENT_DIR=$(pwd)
66
SCRIPT_DIR=$(dirname "$(realpath "$0")")
77

8+
IGNORED_PACKAGES=("cubejs-testing*" "cubejs-linter" "cubejs-docker")
9+
810
# Function to install dependencies in root
911
install_root_dependencies() {
1012
echo "Running 'yarn install' in the root directory..."
@@ -35,6 +37,21 @@ link_packages() {
3537
cd "$SCRIPT_DIR"
3638
for package in packages/*; do
3739
if [ -d "$package" ]; then
40+
package_name=$(basename "$package")
41+
42+
skip_package="false"
43+
for pattern in "${IGNORED_PACKAGES[@]}"; do
44+
# shellcheck disable=SC2053
45+
if [[ "$package_name" == $pattern ]]; then
46+
echo "Skipping $package_name..."
47+
skip_package="true"
48+
fi
49+
done
50+
51+
if [ "$skip_package" = "true" ]; then
52+
continue
53+
fi
54+
3855
echo "Linking $package..."
3956
cd "$package"
4057
yarn link
@@ -106,6 +123,21 @@ link_project_packages() {
106123
cd "$CURRENT_DIR/$app_name"
107124
for package in "$SCRIPT_DIR"/packages/*; do
108125
if [ -d "$package" ]; then
126+
package_name=$(basename "$package")
127+
128+
skip_package="false"
129+
for pattern in "${IGNORED_PACKAGES[@]}"; do
130+
# shellcheck disable=SC2053
131+
if [[ "$package_name" == $pattern ]]; then
132+
echo "Skipping $package_name..."
133+
skip_package="true"
134+
fi
135+
done
136+
137+
if [ "$skip_package" = "true" ]; then
138+
continue
139+
fi
140+
109141
package_name=$(node -p "require('$package/package.json').name")
110142
echo "Linking $package_name..."
111143
yarn link "$package_name"
@@ -146,6 +178,7 @@ show_help() {
146178
echo ""
147179
echo " link Link all packages and link them to a project"
148180
echo " Usage: ./dev-env.sh link [app_name]"
181+
echo " If argument is omitted, cube packages will be marked as linked"
149182
echo ""
150183
echo " setup Run all steps (install, build, link, create project)"
151184
echo " Usage: ./dev-env.sh setup [app_name] [db_type]"
@@ -177,7 +210,9 @@ case "$command" in
177210
;;
178211
"link")
179212
link_packages
180-
link_project_packages "$2"
213+
if [ -n "$2" ]; then
214+
link_project_packages "$2"
215+
fi
181216
;;
182217
"drivers")
183218
get_db_types

0 commit comments

Comments
 (0)