Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @ts-ignore
const prompt = inquirer.createPromptModule({
input: this.context.stdin,
output: this.context.stdout,
});
let registry: string;
if (this.scope && this.publish)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration, type: npmConfigUtils.RegistryType.PUBLISH_REGISTRY});
else if (this.scope)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration});
else if (this.publish)
registry = npmConfigUtils.getPublishRegistry((await openWorkspace(configuration, this.context.cwd)).manifest, {configuration});
else
registry = npmConfigUtils.getDefaultRegistry({configuration});
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async report => {
const credentials = await getCredentials(prompt);
const url = `/-/user/org.couchdb.user:${encodeURIComponent(credentials.name)}`;
try {
const response = await npmHttpUtils.put(url, credentials, {
configuration,
registry,
json: true,
authType: npmHttpUtils.AuthType.NO_AUTH,
});
async execute() {
const configuration = await Configuration.find(this.context.cwd, this.context.plugins);
let registry: string;
if (this.scope && this.publish)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration, type: npmConfigUtils.RegistryType.PUBLISH_REGISTRY});
else if (this.scope)
registry = npmConfigUtils.getScopeRegistry(this.scope, {configuration});
else if (this.publish)
registry = npmConfigUtils.getPublishRegistry((await openWorkspace(configuration, this.context.cwd)).manifest, {configuration});
else
registry = npmConfigUtils.getDefaultRegistry({configuration});
const report = await StreamReport.start({
configuration,
stdout: this.context.stdout,
}, async report => {
try {
const response = await npmHttpUtils.get(`/-/whoami`, {
configuration,
registry,
authType: npmHttpUtils.AuthType.ALWAYS_AUTH,
json: true,
});
report.reportInfo(MessageName.UNNAMED, response.username);
} catch (err) {
if (err.name !== `HTTPError`) {