I am working on a usecase where there is a requirement to publish multiple versions of same package.
I have to publish these version of package in to my gitlab npm registry. I have searched on this but everyone is telling to use scopes which is not possible in my requirement. Is there a way that i can publish both these versions to my gitlab registry?
when i try to publish first version its publishing fine but for second version its giving me an error -
Alialising is the life saver if you want to publish multiple versions of same package in gitlab, especially if you are trying to publish unscoped packages.
#!/bin/sh
list=$(npm ll --json | jq -r 'recurse(.dependencies[]) | [.name+"@"+.version] |@csv' | sed 's/"//g'| sort -u)
for i in $list; do
version_num=$(echo $i | rev | awk -F'@' '{print $1}' | tr '\.' '.'| rev);
name=$(echo $i | perl -pne 's/@[0-9]+(\.[0-9]+)+$//');
npm install $name-$version_num@npm:$i;
done
dirs=$(ls node_modules | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for i in $dirs; do
echo $i
npm publish node_modules/$i --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
atdirs=$(ls node_modules | grep "@")
for k in $atdirs; do
indirs=$(ls node_modules/$k | grep -Eo ".*\-[0-9]+\.[0-9]+\.[0-9]+")
for j in $indirs;do
echo $k/$j
npm publish node_modules/$k/$j --registry https://gitlabserver.com/api/v4/projects/8/packages/npm/
done
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With