Skip to content

Commit

Permalink
populate node_modules from host.js in packages
Browse files Browse the repository at this point in the history
  • Loading branch information
complyue committed May 23, 2021
1 parent 9f27c3a commit b51958a
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion epm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function main() {
# @VARIABLE: VERSION
# @DESCRIPTION:
# Version of this script.
VERSION=0.2.11
VERSION=0.3.0

# Default base URL for short package names
BASE_URL=${EPM_REPO_BASE:-"https://github.com/e-wrks"}
Expand All @@ -32,6 +32,7 @@ function main() {
[ -w "${EPM_HOME}/edh_modules" ] || edo mkdir "${EPM_HOME}/edh_modules"
[ -w "${EPM_HOME}/edh-universe/bin" ] || edo mkdir -p "${EPM_HOME}/edh-universe/bin"
[ -w "${EPM_HOME}/python_modules" ] || edo mkdir "${EPM_HOME}/python_modules"
[ -w "${EPM_HOME}/node_modules" ] || edo mkdir "${EPM_HOME}/node_modules"
) || die "Can NOT create EPM home artifacts in [${EPM_HOME}]"
}

Expand Down Expand Up @@ -501,6 +502,18 @@ FLAGS:
edo popd >/dev/null
) || die "Failed linking Python module artifacts"

(
edo pushd node_modules >/dev/null
for a in ../"${pkg_dir}"/host.js/*; do
# deal with empty dir without nullglob
[ ! -e "$a" ] && continue
b=$(basename "$a")
edo rm -rf "./$b" 2>/dev/null
edo ln -s "$a" "$b"
done
edo popd >/dev/null
) || die "Failed linking NodeJS module artifacts"

status_message "Installed $1 ."

unset full_url pkg_id pkg_dir a b
Expand Down Expand Up @@ -702,6 +715,25 @@ FLAGS:
edo popd >/dev/null
) || die "Failed re-linking Python module artifacts"

(
find node_modules -type l | while read -r modu_root; do
mr_path=$(readlink "${modu_root}")
if [ "${mr_path#../${pkg_dir1}/}" != "${mr_path}" ]; then
edo rm "${modu_root}" || die "Failed unlink ${modu_root}"
fi
done

edo pushd node_modules >/dev/null
for a in ../"${pkg_dir}"/host.js/*; do
# deal with empty dir without nullglob
[ ! -e "$a" ] && continue
b=$(basename "$a")
edo rm -rf "./$b" 2>/dev/null
edo ln -s "$a" "$b"
done
edo popd >/dev/null
) || die "Failed re-linking NodeJS module artifacts"

done
); }

Expand Down Expand Up @@ -742,6 +774,12 @@ FLAGS:
edo rm "${modu_root}" || die "Failed unlink ${modu_root}"
fi
done
find node_modules -type l | while read -r modu_root; do
mr_path=$(readlink "${modu_root}")
if [ "${mr_path#../${pkg_dir1}/}" != "${mr_path}" ]; then
edo rm "${modu_root}" || die "Failed unlink ${modu_root}"
fi
done
edo rm -rf "${pkg_dir}"
fi
fi
Expand Down

0 comments on commit b51958a

Please sign in to comment.