mirror of
				https://github.com/actions/setup-node.git
				synced 2025-11-04 19:38:22 +08:00 
			
		
		
		
	refactor: check volta first, then engine
This commit is contained in:
		@@ -502,10 +502,9 @@ export function parseNodeVersionFile(contents: string): string {
 | 
			
		||||
 | 
			
		||||
  if (!nodeVersion) {
 | 
			
		||||
    try {
 | 
			
		||||
      // Try parsing the file as an NPM `package.json`
 | 
			
		||||
      // file.
 | 
			
		||||
      nodeVersion = JSON.parse(contents).engines?.node;
 | 
			
		||||
      if (!nodeVersion) JSON.parse(contents).volta?.node;
 | 
			
		||||
      // Try parsing the file as an NPM `package.json` file.
 | 
			
		||||
      nodeVersion = JSON.parse(contents).volta?.node;
 | 
			
		||||
      if (!nodeVersion)nodeVersion = JSON.parse(contents).engines?.node;
 | 
			
		||||
      if (!nodeVersion) throw new Error();
 | 
			
		||||
    } catch (err) {
 | 
			
		||||
      // In the case of an unknown format,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user