mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-29 15:52:42 +08:00 
			
		
		
		
	Add modification of scoped registry
This commit is contained in:
		| @@ -29,7 +29,7 @@ function writeRegistryToFile( | ||||
|     scope = '@' + scope; | ||||
|   } | ||||
|   if (scope) { | ||||
|     scope = scope.toLowerCase(); | ||||
|     scope = scope.toLowerCase() + ':'; | ||||
|   } | ||||
|  | ||||
|   core.debug(`Setting auth in ${fileLocation}`); | ||||
| @@ -38,7 +38,7 @@ function writeRegistryToFile( | ||||
|     const curContents: string = fs.readFileSync(fileLocation, 'utf8'); | ||||
|     curContents.split(os.EOL).forEach((line: string) => { | ||||
|       // Add current contents unless they are setting the registry | ||||
|       if (!line.toLowerCase().startsWith('registry')) { | ||||
|       if (!line.toLowerCase().startsWith(`${scope}registry`)) { | ||||
|         newContents += line + os.EOL; | ||||
|       } | ||||
|     }); | ||||
| @@ -46,9 +46,7 @@ function writeRegistryToFile( | ||||
|   // Remove http: or https: from front of registry. | ||||
|   const authString: string = | ||||
|     registryUrl.replace(/(^\w+:|^)/, '') + ':_authToken=${NODE_AUTH_TOKEN}'; | ||||
|   const registryString: string = scope | ||||
|     ? `${scope}:registry=${registryUrl}` | ||||
|     : `registry=${registryUrl}`; | ||||
|   const registryString: string = `${scope}registry=${registryUrl}`; | ||||
|   const alwaysAuthString: string = `always-auth=${alwaysAuth}`; | ||||
|   newContents += `${authString}${os.EOL}${registryString}${os.EOL}${alwaysAuthString}`; | ||||
|   fs.writeFileSync(fileLocation, newContents); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user