Skip to content

Commit

Permalink
fix: Don't overwrite user's .npmrc when local option is used (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachzhao1984 committed Jun 1, 2023
1 parent 4f5030c commit e87e78d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,7 @@ export async function main(pkgManager = 'npm') {
'nnrm use taobao',
)}\n`,
)
}
else {
await setCurrentRegistry(registry, pkgManager)
await listRegistries(pkgManager)
}

if (options.l || options.local) {
} else if (options.l || options.local) {

Check failure on line 171 in src/utils/index.ts

View workflow job for this annotation

GitHub Actions / lint

Closing curly brace appears on the same line as the subsequent block
const registryText = `registry=${registries[registry].registry}`
if (existsSync('.npmrc')) {
const content = await fs.readFile('.npmrc', 'utf-8')
Expand All @@ -185,7 +179,11 @@ export async function main(pkgManager = 'npm') {
}
else {
await fs.writeFile('.npmrc', registryText)
await listRegistries(pkgManager)
}
} else {

Check failure on line 184 in src/utils/index.ts

View workflow job for this annotation

GitHub Actions / lint

Closing curly brace appears on the same line as the subsequent block
await setCurrentRegistry(registry, pkgManager)
await listRegistries(pkgManager)
}
})

Expand Down

0 comments on commit e87e78d

Please sign in to comment.