Compare commits
3 Commits
c14dbeccda
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c399b938df | |||
| 189ffd55d2 | |||
| 4e8ecce090 |
@@ -13,18 +13,37 @@ def get_all_urls_packages():
|
|||||||
return list(dict.fromkeys(findall("https://.+.tgz", content)))
|
return list(dict.fromkeys(findall("https://.+.tgz", content)))
|
||||||
|
|
||||||
|
|
||||||
def download_npm_package(url:str, path="./"):
|
def download_npm_package(url:str, dir="npm-packages"):
|
||||||
try:
|
try:
|
||||||
with open(path + url.split("/")[-1], "wb") as npm_package_file:
|
mkdir(dir)
|
||||||
npm_package_file.write(requests.get(url))
|
|
||||||
except:
|
except:
|
||||||
raise "Path not exist!\nPlease create the path: " + path
|
pass
|
||||||
|
with open(dir + "/" + url.split("/")[-1], "wb") as npm_package_file:
|
||||||
|
npm_package_file.write(requests.get(url))
|
||||||
|
|
||||||
|
|
||||||
def download_all_package():
|
def download_all_package():
|
||||||
packages_urls = get_all_urls_packages()
|
packages_urls = get_all_urls_packages()
|
||||||
for package_url in packages_urls:
|
for package_url in packages_urls:
|
||||||
download_npm_package(package_url, "npm-packages/")
|
download_npm_package(package_url, "npm-packages")
|
||||||
|
|
||||||
|
def upload_package(nexus_host, repository, package_file):
|
||||||
|
if nexus_host[-1] != "/":
|
||||||
|
nexus_host += "/"
|
||||||
|
res = requests.post(
|
||||||
|
nexus_host + "service/rest/v1/components?repository=" + repository,
|
||||||
|
headers={
|
||||||
|
"accept": "application/json",
|
||||||
|
"Content-Type": "multipart/form-data"
|
||||||
|
},
|
||||||
|
files={
|
||||||
|
"npm.asset": open(package_file, "rb")
|
||||||
|
})
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def publish_all_packages():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user