0

I need to translate this script (linux):

# get endpoint 
endpoint = aws codeartifact get-repository-endpoint --domain my_domain --domain-owner 111122223333 --repository my_repo --format npm

# set a scoped registry
npm config set registry endpoint --scope=@my-package <- this is what you want

# get token
token = aws codeartifact get-authorization-token --domain my_domain --domain-owner 111122223333 --repository my_repo

# set token
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:_authToken=token

# always truth
npm config set //my_domain-111122223333.d.codeartifact.region.amazonaws.com/npm/my_repo/:always-auth=true

To a powershell one. Especially, I cannot find a way to set the "endpoint" variable in powershell and recall it to set the scoped registry.

Source of the script: NPM insists on CodeArtifact, even on public registry

Nemus
  • 1,322
  • 2
  • 23
  • 47
  • 2
    What have you tried, and how has what you've tried failed? Ideally, you should provide a [MCVE] of what you've tried, and include specific information on how it failed, with error messages and/or erroneous output. [SO] is not a code-writing service; the best questions are those which provide useful information so that those who answer can guide you to devising your own correct answer. See [Ask] a Good Question (and [How do I ask and answer homework questions](https://meta.stackoverflow.com/q/334822), if relevant). – Jeff Zeitlin Sep 19 '22 at 10:33
  • What you're showing isn't a valid script for POSIX-compatible shells such as Bash, i.e. it isn't a Linux shell script. The linked post discusses some fundamental differences between POSIX-compatible shells, `cmd.exe`, and PowerShell. If that doesn't solve your problem, I encourage you to ask a _new_ question, building on the information in the linked post. – mklement0 Sep 20 '22 at 01:50

0 Answers0