Skip to content

Commit

Permalink
Add functionality to automatically insert new package into pubspec.ya…
Browse files Browse the repository at this point in the history
…ml workspace section
  • Loading branch information
YumNumm committed Jan 17, 2025
1 parent 562caca commit 2168224
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/add-package.sh
Original file line number Diff line number Diff line change
@@ -53,6 +53,20 @@ for f in $(find packages/$PACKAGE_NAME -type f -name "*_base*"); do
mv "$f" "${f/_base/$PACKAGE_NAME}"
done

# Add the new package to workspace in pubspec.yaml before the comment line
info "Adding package to workspace in pubspec.yaml..."
python3 -c "
import sys
with open('pubspec.yaml', 'r') as f:
lines = f.readlines()
for i, line in enumerate(lines):
if '<ADD_PACKAGE_HERE>' in line:
lines.insert(i, ' - packages/$PACKAGE_NAME\n')
break
with open('pubspec.yaml', 'w') as f:
f.writelines(lines)
"

info "Executing bootstrap script for $PACKAGE_NAME ... Please wait..."

melos bootstrap &>/dev/null

0 comments on commit 2168224

Please sign in to comment.