Skip to content

Commit

Permalink
Merge pull request #34 from blink1073/fix-npm-registry
Browse files Browse the repository at this point in the history
Fix handling of npm token
  • Loading branch information
Steven Silvester committed Jun 16, 2021
2 parents fcab5aa + 8aab79a commit 43ec611
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jupyter_releaser/npm.py
Expand Up @@ -130,10 +130,12 @@ def extract_package(path):
def handle_npm_config(npm_token):
"""Handle npm_config"""
npmrc = Path(".npmrc")
registry = os.environ.get("NPM_REGISTRY", "registry.npmjs.org")
registry = os.environ.get("NPM_REGISTRY", "https://registry.npmjs.org/")
registry = registry.replace("https:", "")
registry = registry.replace("http:", "")
text = f"registry={registry}"
if npm_token:
text += f"\n///{registry}:_authToken={npm_token}"
text += f"\n{registry}:_authToken={npm_token}"
if npmrc.exists():
text = npmrc.read_text(encoding="utf-8") + text
npmrc.write_text(text, encoding="utf-8")
Expand Down

0 comments on commit 43ec611

Please sign in to comment.