-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that the project build with npm workspaces and bun
- Loading branch information
adamczykm
committed
May 7, 2024
1 parent
f2e71b4
commit b1998b4
Showing
21 changed files
with
90 additions
and
63,388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Check if direnv is installed | ||
if ! command -v direnv &> /dev/null; then | ||
echo "Error: 'direnv' is not installed. Please install it and try again." | ||
exit 1 | ||
fi | ||
|
||
# Check if the path to the .envrc file is provided | ||
if [ -z "$1" ]; then | ||
echo "Please provide the path to the .envrc file as an argument." | ||
exit 1 | ||
fi | ||
|
||
# Resolve the absolute path of the given .envrc file | ||
DIRPATH=$(realpath "$1") | ||
ENVRCPATH=$DIRPATH/.envrc | ||
|
||
# Construct the export command using the current working directory | ||
NODE_MODULES_PATH=$DIRPATH/node_modules | ||
EXPORT_COMMAND="export NODE_MODULES=${NODE_MODULES_PATH}" | ||
|
||
# Check if the .envrc file exists, if not, create it | ||
if [ ! -f "$ENVRCPATH" ]; then | ||
touch "$ENVRCPATH" | ||
fi | ||
|
||
# Check if the export command is already present in the .envrc file | ||
if grep -Fxq "$EXPORT_COMMAND" "$ENVRCPATH"; then | ||
echo "NODE_MODULES is already set in ${ENVRCPATH}" | ||
else | ||
# Append the export command to the file | ||
echo "$EXPORT_COMMAND" >> "$ENVRCPATH" | ||
echo "Successfully added NODE_MODULES to ${ENVRCPATH}" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.