Skip to content

Commit

Permalink
Update internal dependencies with actual versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Sep 10, 2024
1 parent 7ce98c2 commit ae1d654
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 39 deletions.
18 changes: 9 additions & 9 deletions apps/nocapd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"license": "MIT",
"dependencies": {
"@nostr-fetch/adapter-nostr-tools": "0.14.1",
"@nostrwatch/announce": "*",
"@nostrwatch/controlflow": "*",
"@nostrwatch/logger": "*",
"@nostrwatch/nocap": "*",
"@nostrwatch/nocap-every-adapter-default": "*",
"@nostrwatch/nwcache": "*",
"@nostrwatch/publisher": "*",
"@nostrwatch/seed": "*",
"@nostrwatch/utils": "*",
"@nostrwatch/announce": "0.4.1",
"@nostrwatch/controlflow": "0.5.1",
"@nostrwatch/logger": "0.0.9",
"@nostrwatch/nocap": "0.5.7",
"@nostrwatch/nocap-every-adapter-default": "1.4.6",
"@nostrwatch/nwcache": "0.1.5",
"@nostrwatch/publisher": "0.8.1",
"@nostrwatch/seed": "0.0.5",
"@nostrwatch/utils": "0.1.6",
"bluebird": "3.7.2",
"chalk": "5.3.0",
"ngeohash": "^0.6.3",
Expand Down
14 changes: 7 additions & 7 deletions apps/trawler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
},
"dependencies": {
"@nostr-fetch/adapter-nostr-tools": "0.13.1",
"@nostrwatch/controlflow": "*",
"@nostrwatch/logger": "*",
"@nostrwatch/nocap": "*",
"@nostrwatch/nwcache": "*",
"@nostrwatch/publisher": "*",
"@nostrwatch/seed": "*",
"@nostrwatch/utils": "*",
"@nostrwatch/controlflow": "0.5.1",
"@nostrwatch/logger": "0.0.9",
"@nostrwatch/nocap": "0.5.7",
"@nostrwatch/nwcache": "0.1.5",
"@nostrwatch/publisher": "0.8.1",
"@nostrwatch/seed": "0.0.5",
"@nostrwatch/utils": "0.1.6",
"@types/ioredis": "5.0.0",
"bullmq": "4.13.3",
"chalk": "^5.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@nostrwatch/nocap-dns-adapter-default": "*",
"@nostrwatch/nocap-geo-adapter-default": "*",
"@nostrwatch/nocap-info-adapter-default": "*",
"@nostrwatch/nocap-ssl-adapter-default": "*",
"@nostrwatch/nocap-websocket-adapter-default": "*",
"@nostrwatch/nocap-websocket-browser-adapter-default": "*"
"@nostrwatch/nocap-dns-adapter-default": "1.1.4",
"@nostrwatch/nocap-geo-adapter-default": "1.0.7",
"@nostrwatch/nocap-info-adapter-default": "1.1.4",
"@nostrwatch/nocap-ssl-adapter-default": "1.4.5",
"@nostrwatch/nocap-websocket-adapter-default": "1.3.5",
"@nostrwatch/nocap-websocket-browser-adapter-default": "0.0.5"
}
}
39 changes: 22 additions & 17 deletions scripts/prerelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ if [[ $1 == "--dry-run" ]]; then
echo "Running in dry-run mode. No changes will be made."
fi

# Create an array to store package names and their versions
package_versions=()

# Get all internal package names and their versions
declare -A package_versions
for package_json in $(find . -type f -name "package.json" -not -path "*/node_modules/*"); do
package_name=$(jq -r '.name // empty' "$package_json")
package_version=$(jq -r '.version // empty' "$package_json")
if [[ -n "$package_name" && -n "$package_version" ]]; then
package_versions[$package_name]=$package_version
package_versions+=("$package_name:$package_version")
fi
done

Expand All @@ -28,22 +30,25 @@ for file in $(find . -type f -name "package.json" -not -path "*/node_modules/*")
dep=$(echo $dep | tr -d '"')

# Check if the dependency is an internal package
if [[ -n "${package_versions[$dep]}" ]]; then
dep_version=${package_versions[$dep]}

# Provide feedback on what will be replaced
echo "Found dependency $dep with version '*'. Will replace it with $dep_version."

if [[ $DRY_RUN == false ]]; then
# Replace "*" with the actual version in the dependency
sed -i '' "s/\"$dep\": \"\*\"/\"$dep\": \"$dep_version\"/g" "$file"
echo "Replaced $dep version '*' with $dep_version in $file."
else
echo "(Dry run) Would replace $dep version '*' with $dep_version in $file."
for package in "${package_versions[@]}"; do
package_name=${package%%:*}
package_version=${package##*:}

if [[ "$dep" == "$package_name" ]]; then
echo "Found dependency $dep with version '*'. Will replace it with $package_version."

if [[ $DRY_RUN == false ]]; then
# Escape special characters in package name
escaped_dep=$(echo "$dep" | sed 's/[]\/$*.^[]/\\&/g')
# Replace "*" with the actual version in the dependency
sed -i '' "s|\"$escaped_dep\": \"\*\"|\"$dep\": \"$package_version\"|g" "$file"
echo "Replaced $dep version '*' with $package_version in $file."
else
echo "(Dry run) Would replace $dep version '*' with $package_version in $file."
fi
break
fi
else
echo "No matching internal dependency found for $dep in $file."
fi
done
done
done

Expand Down

0 comments on commit ae1d654

Please sign in to comment.