Skip to content

Commit

Permalink
fix(js): restore default registry for only localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi committed Jul 7, 2023
1 parent d0c3772 commit 0680279
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions packages/js/src/executors/verdaccio/verdaccio.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
return () => {};
}

let npmRegistryPath;
let npmRegistryPath: string;
try {
npmRegistryPath = execSync(
`npm config get registry --location ${options.location}`
Expand All @@ -154,7 +154,13 @@ function setupNpm(options: VerdaccioExecutorSchema) {

return () => {
try {
if (npmRegistryPath) {
const currentNpmRegistryPath = execSync(
`npm config get registry --location ${options.location}`
)
?.toString()
?.trim()
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
if (npmRegistryPath && currentNpmRegistryPath.includes('localhost')) {
execSync(
`npm config set registry ${npmRegistryPath} --location ${options.location}`
);
Expand Down Expand Up @@ -240,7 +246,13 @@ function setupYarn(options: VerdaccioExecutorSchema) {

return () => {
try {
if (yarnRegistryPath) {
const currentYarnRegistryPath = execSync(
`yarn config get ${registryConfigName}`
)
?.toString()
?.trim()
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
if (yarnRegistryPath && currentYarnRegistryPath.includes('localhost')) {
execSync(
`yarn config set ${registryConfigName} ${yarnRegistryPath}` +
(options.location === 'user' ? ' --home' : '')
Expand Down

0 comments on commit 0680279

Please sign in to comment.