fix(js): restore registry for only localhost (#17999)
This commit is contained in:
parent
9940a0c544
commit
8d5cfcc2b3
@ -131,7 +131,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
let npmRegistryPath;
|
let npmRegistryPath: string;
|
||||||
try {
|
try {
|
||||||
npmRegistryPath = execSync(
|
npmRegistryPath = execSync(
|
||||||
`npm config get registry --location ${options.location}`
|
`npm config get registry --location ${options.location}`
|
||||||
@ -154,7 +154,13 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
try {
|
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(
|
execSync(
|
||||||
`npm config set registry ${npmRegistryPath} --location ${options.location}`
|
`npm config set registry ${npmRegistryPath} --location ${options.location}`
|
||||||
);
|
);
|
||||||
@ -240,7 +246,13 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
try {
|
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(
|
execSync(
|
||||||
`yarn config set ${registryConfigName} ${yarnRegistryPath}` +
|
`yarn config set ${registryConfigName} ${yarnRegistryPath}` +
|
||||||
(options.location === 'user' ? ' --home' : '')
|
(options.location === 'user' ? ' --home' : '')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user