mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-29 15:52:42 +08:00 
			
		
		
		
	Merge branch 'actions:main' into update-contributors-guide
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -92,7 +92,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version-file: [.nvmrc, .tool-versions] |         node-version-file: [.nvmrc, .tool-versions, package.json] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v3 |       - uses: actions/checkout@v3 | ||||||
|       - name: Setup node from node version file |       - name: Setup node from node version file | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": ">=14.0.0" |     "node": "^14.0.0" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @@ -71770,13 +71770,18 @@ function translateArchToDistUrl(arch) { | |||||||
| function parseNodeVersionFile(contents) { | function parseNodeVersionFile(contents) { | ||||||
|     var _a, _b; |     var _a, _b; | ||||||
|     let nodeVersion; |     let nodeVersion; | ||||||
|     const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); |     // Try parsing the file as an NPM `package.json`
 | ||||||
|     nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version; |     // file.
 | ||||||
|  |     try { | ||||||
|  |         nodeVersion = (_a = JSON.parse(contents).engines) === null || _a === void 0 ? void 0 : _a.node; | ||||||
|  |     } | ||||||
|  |     catch (_c) { | ||||||
|  |         core.warning('Node version file is not JSON file'); | ||||||
|  |     } | ||||||
|     if (!nodeVersion) { |     if (!nodeVersion) { | ||||||
|         try { |         try { | ||||||
|             // Try parsing the file as an NPM `package.json`
 |             const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); | ||||||
|             // file.
 |             nodeVersion = (_b = found === null || found === void 0 ? void 0 : found.groups) === null || _b === void 0 ? void 0 : _b.version; | ||||||
|             nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node; |  | ||||||
|             if (!nodeVersion) |             if (!nodeVersion) | ||||||
|                 throw new Error(); |                 throw new Error(); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -497,14 +497,18 @@ function translateArchToDistUrl(arch: string): string { | |||||||
| export function parseNodeVersionFile(contents: string): string { | export function parseNodeVersionFile(contents: string): string { | ||||||
|   let nodeVersion: string | undefined; |   let nodeVersion: string | undefined; | ||||||
|  |  | ||||||
|   const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); |   // Try parsing the file as an NPM `package.json` | ||||||
|   nodeVersion = found?.groups?.version; |   // file. | ||||||
|  |   try { | ||||||
|  |     nodeVersion = JSON.parse(contents).engines?.node; | ||||||
|  |   } catch { | ||||||
|  |     core.warning('Node version file is not JSON file'); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   if (!nodeVersion) { |   if (!nodeVersion) { | ||||||
|     try { |     try { | ||||||
|       // Try parsing the file as an NPM `package.json` |       const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); | ||||||
|       // file. |       nodeVersion = found?.groups?.version; | ||||||
|       nodeVersion = JSON.parse(contents).engines?.node; |  | ||||||
|  |  | ||||||
|       if (!nodeVersion) throw new Error(); |       if (!nodeVersion) throw new Error(); | ||||||
|     } catch (err) { |     } catch (err) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user