mirror of
				https://github.com/actions/setup-node.git
				synced 2025-10-31 16:14:00 +08:00 
			
		
		
		
	improve latest version syntax
This commit is contained in:
		
							
								
								
									
										10
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -62362,6 +62362,10 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { | ||||
|                 core.info(`Failed to resolve version ${versionSpec} from manifest`); | ||||
|             } | ||||
|         } | ||||
|         if (['current', 'latest', 'node'].includes(versionSpec)) { | ||||
|             versionSpec = yield queryDistForMatch(versionSpec, arch); | ||||
|             core.info(`getting latest node version...`); | ||||
|         } | ||||
|         // check cache
 | ||||
|         let toolPath; | ||||
|         toolPath = tc.find('node', versionSpec, osArch); | ||||
| @@ -62587,12 +62591,6 @@ function queryDistForMatch(versionSpec, arch = os.arch()) { | ||||
|         } | ||||
|         let versions = []; | ||||
|         let nodeVersions = yield getVersionsFromDist(); | ||||
|         if (versionSpec === 'current' || | ||||
|             versionSpec === 'latest' || | ||||
|             versionSpec === 'node') { | ||||
|             core.info(`getting latest node version...`); | ||||
|             return nodeVersions[0].version; | ||||
|         } | ||||
|         nodeVersions.forEach((nodeVersion) => { | ||||
|             // ensure this version supports your os and platform
 | ||||
|             if (nodeVersion.files.indexOf(dataFileName) >= 0) { | ||||
|   | ||||
							
								
								
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -26,7 +26,7 @@ | ||||
|         "@zeit/ncc": "^0.21.0", | ||||
|         "jest": "^27.2.5", | ||||
|         "jest-circus": "^27.2.5", | ||||
|         "prettier": "^1.19.1", | ||||
|         "prettier": "1.19.1", | ||||
|         "ts-jest": "^27.0.5", | ||||
|         "typescript": "^3.8.3" | ||||
|       } | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
|     "@zeit/ncc": "^0.21.0", | ||||
|     "jest": "^27.2.5", | ||||
|     "jest-circus": "^27.2.5", | ||||
|     "prettier": "^1.19.1", | ||||
|     "prettier": "1.19.1", | ||||
|     "ts-jest": "^27.0.5", | ||||
|     "typescript": "^3.8.3" | ||||
|   } | ||||
|   | ||||
| @@ -66,6 +66,11 @@ export async function getNode( | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   if (['current', 'latest', 'node'].includes(versionSpec)) { | ||||
|     versionSpec = await queryDistForMatch(versionSpec, arch); | ||||
|     core.info(`getting latest node version...`); | ||||
|   } | ||||
|  | ||||
|   // check cache | ||||
|   let toolPath: string; | ||||
|   toolPath = tc.find('node', versionSpec, osArch); | ||||
| @@ -373,15 +378,6 @@ async function queryDistForMatch( | ||||
|   let versions: string[] = []; | ||||
|   let nodeVersions = await getVersionsFromDist(); | ||||
|  | ||||
|   if ( | ||||
|     versionSpec === 'current' || | ||||
|     versionSpec === 'latest' || | ||||
|     versionSpec === 'node' | ||||
|   ) { | ||||
|     core.info(`getting latest node version...`); | ||||
|     return nodeVersions[0].version; | ||||
|   } | ||||
|  | ||||
|   nodeVersions.forEach((nodeVersion: INodeVersion) => { | ||||
|     // ensure this version supports your os and platform | ||||
|     if (nodeVersion.files.indexOf(dataFileName) >= 0) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 panticmilos
					panticmilos