mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-10-31 15:53:45 +00:00 
			
		
		
		
	Parse global.json with JSON5
This commit is contained in:
		
							parent
							
								
									3447fd6a9f
								
							
						
					
					
						commit
						d1c99df34e
					
				
							
								
								
									
										426
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										426
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -58476,91 +58476,91 @@ exports["default"] = _default; | ||||
| /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||
|     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||
|       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||
|     } | ||||
|     Object.defineProperty(o, k2, desc); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.run = void 0; | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const node_fs_1 = __importDefault(__nccwpck_require__(7561)); | ||||
| const cache_utils_1 = __nccwpck_require__(1678); | ||||
| const constants_1 = __nccwpck_require__(9042); | ||||
| // Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | ||||
| // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | ||||
| // throw an uncaught exception.  Instead of failing this action, just warn.
 | ||||
| process.on('uncaughtException', e => { | ||||
|     const warningPrefix = '[warning]'; | ||||
|     core.info(`${warningPrefix}${e.message}`); | ||||
| }); | ||||
| function run() { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         try { | ||||
|             if (core.getBooleanInput('cache')) { | ||||
|                 yield cachePackages(); | ||||
|             } | ||||
|         } | ||||
|         catch (error) { | ||||
|             core.setFailed(error.message); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.run = run; | ||||
| const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const state = core.getState(constants_1.State.CacheMatchedKey); | ||||
|     const primaryKey = core.getState(constants_1.State.CachePrimaryKey); | ||||
|     if (!primaryKey) { | ||||
|         core.info('Primary key was not generated, not saving cache.'); | ||||
|         return; | ||||
|     } | ||||
|     const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); | ||||
|     if (!node_fs_1.default.existsSync(cachePath)) { | ||||
|         throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); | ||||
|     } | ||||
|     if (primaryKey === state) { | ||||
|         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); | ||||
|         return; | ||||
|     } | ||||
|     const cacheId = yield cache.saveCache([cachePath], primaryKey); | ||||
|     if (cacheId == -1) { | ||||
|         return; | ||||
|     } | ||||
|     core.info(`Cache saved with the key: ${primaryKey}`); | ||||
| }); | ||||
| run(); | ||||
| 
 | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||
|     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||
|       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||
|     } | ||||
|     Object.defineProperty(o, k2, desc); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||||
|     return (mod && mod.__esModule) ? mod : { "default": mod }; | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.run = void 0; | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const node_fs_1 = __importDefault(__nccwpck_require__(7561)); | ||||
| const cache_utils_1 = __nccwpck_require__(1678); | ||||
| const constants_1 = __nccwpck_require__(9042); | ||||
| // Catch and log any unhandled exceptions.  These exceptions can leak out of the uploadChunk method in
 | ||||
| // @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
 | ||||
| // throw an uncaught exception.  Instead of failing this action, just warn.
 | ||||
| process.on('uncaughtException', e => { | ||||
|     const warningPrefix = '[warning]'; | ||||
|     core.info(`${warningPrefix}${e.message}`); | ||||
| }); | ||||
| function run() { | ||||
|     return __awaiter(this, void 0, void 0, function* () { | ||||
|         try { | ||||
|             if (core.getBooleanInput('cache')) { | ||||
|                 yield cachePackages(); | ||||
|             } | ||||
|         } | ||||
|         catch (error) { | ||||
|             core.setFailed(error.message); | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| exports.run = run; | ||||
| const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const state = core.getState(constants_1.State.CacheMatchedKey); | ||||
|     const primaryKey = core.getState(constants_1.State.CachePrimaryKey); | ||||
|     if (!primaryKey) { | ||||
|         core.info('Primary key was not generated, not saving cache.'); | ||||
|         return; | ||||
|     } | ||||
|     const { 'global-packages': cachePath } = yield (0, cache_utils_1.getNuGetFolderPath)(); | ||||
|     if (!node_fs_1.default.existsSync(cachePath)) { | ||||
|         throw new Error(`Cache folder path is retrieved for .NET CLI but doesn't exist on disk: ${cachePath}`); | ||||
|     } | ||||
|     if (primaryKey === state) { | ||||
|         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`); | ||||
|         return; | ||||
|     } | ||||
|     const cacheId = yield cache.saveCache([cachePath], primaryKey); | ||||
|     if (cacheId == -1) { | ||||
|         return; | ||||
|     } | ||||
|     core.info(`Cache saved with the key: ${primaryKey}`); | ||||
| }); | ||||
| run(); | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| @ -58569,114 +58569,114 @@ run(); | ||||
| /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||
|     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||
|       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||
|     } | ||||
|     Object.defineProperty(o, k2, desc); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const exec = __importStar(__nccwpck_require__(1514)); | ||||
| const constants_1 = __nccwpck_require__(9042); | ||||
| /** | ||||
|  * Get NuGet global packages, cache, and temp folders from .NET CLI. | ||||
|  * @returns (Folder Name)-(Path) mappings | ||||
|  * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders
 | ||||
|  * @example | ||||
|  * Windows | ||||
|  * ```json
 | ||||
|  * { | ||||
|  *   "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", | ||||
|  *   "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", | ||||
|  *   "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", | ||||
|  *   "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" | ||||
|  * } | ||||
|  * ``` | ||||
|  * | ||||
|  * Mac/Linux | ||||
|  * ```json
 | ||||
|  * { | ||||
|  *   "http-cache": "/home/user1/.local/share/NuGet/v3-cache", | ||||
|  *   "global-packages": "/home/user1/.nuget/packages/", | ||||
|  *   "temp": "/tmp/NuGetScratch", | ||||
|  *   "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" | ||||
|  * } | ||||
|  * ``` | ||||
|  */ | ||||
| const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); | ||||
|     if (exitCode) { | ||||
|         throw new Error(!stderr.trim() | ||||
|             ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` | ||||
|             : stderr); | ||||
|     } | ||||
|     const result = { | ||||
|         'http-cache': '', | ||||
|         'global-packages': '', | ||||
|         temp: '', | ||||
|         'plugins-cache': '' | ||||
|     }; | ||||
|     const regex = /(?:^|\s)(?<key>[a-z-]+): (?<path>.+[/\\].+)$/gm; | ||||
|     let match; | ||||
|     while ((match = regex.exec(stdout)) !== null) { | ||||
|         const key = match.groups.key; | ||||
|         if (key in result) { | ||||
|             result[key] = match.groups.path; | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| }); | ||||
| exports.getNuGetFolderPath = getNuGetFolderPath; | ||||
| function isCacheFeatureAvailable() { | ||||
|     if (cache.isFeatureAvailable()) { | ||||
|         return true; | ||||
|     } | ||||
|     if (isGhes()) { | ||||
|         core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); | ||||
|         return false; | ||||
|     } | ||||
|     core.warning('The runner was not able to contact the cache service. Caching will be skipped'); | ||||
|     return false; | ||||
| } | ||||
| exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | ||||
| /** | ||||
|  * Returns this action runs on GitHub Enterprise Server or not. | ||||
|  * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134)
 | ||||
|  */ | ||||
| function isGhes() { | ||||
|     const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; | ||||
|     return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
| } | ||||
| 
 | ||||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     var desc = Object.getOwnPropertyDescriptor(m, k); | ||||
|     if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||||
|       desc = { enumerable: true, get: function() { return m[k]; } }; | ||||
|     } | ||||
|     Object.defineProperty(o, k2, desc); | ||||
| }) : (function(o, m, k, k2) { | ||||
|     if (k2 === undefined) k2 = k; | ||||
|     o[k2] = m[k]; | ||||
| })); | ||||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||||
|     Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||||
| }) : function(o, v) { | ||||
|     o["default"] = v; | ||||
| }); | ||||
| var __importStar = (this && this.__importStar) || function (mod) { | ||||
|     if (mod && mod.__esModule) return mod; | ||||
|     var result = {}; | ||||
|     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||||
|     __setModuleDefault(result, mod); | ||||
|     return result; | ||||
| }; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.isCacheFeatureAvailable = exports.getNuGetFolderPath = void 0; | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const exec = __importStar(__nccwpck_require__(1514)); | ||||
| const constants_1 = __nccwpck_require__(9042); | ||||
| /** | ||||
|  * Get NuGet global packages, cache, and temp folders from .NET CLI. | ||||
|  * @returns (Folder Name)-(Path) mappings | ||||
|  * @see https://docs.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders
 | ||||
|  * @example | ||||
|  * Windows | ||||
|  * ```json
 | ||||
|  * { | ||||
|  *   "http-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\v3-cache", | ||||
|  *   "global-packages": "C:\\Users\\user1\\.nuget\\packages\\", | ||||
|  *   "temp": "C:\\Users\\user1\\AppData\\Local\\Temp\\NuGetScratch", | ||||
|  *   "plugins-cache": "C:\\Users\\user1\\AppData\\Local\\NuGet\\plugins-cache" | ||||
|  * } | ||||
|  * ``` | ||||
|  * | ||||
|  * Mac/Linux | ||||
|  * ```json
 | ||||
|  * { | ||||
|  *   "http-cache": "/home/user1/.local/share/NuGet/v3-cache", | ||||
|  *   "global-packages": "/home/user1/.nuget/packages/", | ||||
|  *   "temp": "/tmp/NuGetScratch", | ||||
|  *   "plugins-cache": "/home/user1/.local/share/NuGet/plugins-cache" | ||||
|  * } | ||||
|  * ``` | ||||
|  */ | ||||
| const getNuGetFolderPath = () => __awaiter(void 0, void 0, void 0, function* () { | ||||
|     const { stdout, stderr, exitCode } = yield exec.getExecOutput(constants_1.cliCommand, undefined, { ignoreReturnCode: true, silent: true }); | ||||
|     if (exitCode) { | ||||
|         throw new Error(!stderr.trim() | ||||
|             ? `The '${constants_1.cliCommand}' command failed with exit code: ${exitCode}` | ||||
|             : stderr); | ||||
|     } | ||||
|     const result = { | ||||
|         'http-cache': '', | ||||
|         'global-packages': '', | ||||
|         temp: '', | ||||
|         'plugins-cache': '' | ||||
|     }; | ||||
|     const regex = /(?:^|\s)(?<key>[a-z-]+): (?<path>.+[/\\].+)$/gm; | ||||
|     let match; | ||||
|     while ((match = regex.exec(stdout)) !== null) { | ||||
|         const key = match.groups.key; | ||||
|         if (key in result) { | ||||
|             result[key] = match.groups.path; | ||||
|         } | ||||
|     } | ||||
|     return result; | ||||
| }); | ||||
| exports.getNuGetFolderPath = getNuGetFolderPath; | ||||
| function isCacheFeatureAvailable() { | ||||
|     if (cache.isFeatureAvailable()) { | ||||
|         return true; | ||||
|     } | ||||
|     if (isGhes()) { | ||||
|         core.warning('Cache action is only supported on GHES version >= 3.5. If you are on version >=3.5 Please check with GHES admin if Actions cache service is enabled or not.'); | ||||
|         return false; | ||||
|     } | ||||
|     core.warning('The runner was not able to contact the cache service. Caching will be skipped'); | ||||
|     return false; | ||||
| } | ||||
| exports.isCacheFeatureAvailable = isCacheFeatureAvailable; | ||||
| /** | ||||
|  * Returns this action runs on GitHub Enterprise Server or not. | ||||
|  * (port from https://github.com/actions/toolkit/blob/457303960f03375db6f033e214b9f90d79c3fe5c/packages/cache/src/internal/cacheUtils.ts#L134)
 | ||||
|  */ | ||||
| function isGhes() { | ||||
|     const url = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; | ||||
|     return new URL(url).hostname.toUpperCase() !== 'GITHUB.COM'; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| @ -58685,26 +58685,26 @@ function isGhes() { | ||||
| /***/ ((__unused_webpack_module, exports) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; | ||||
| /** NuGet lock file patterns */ | ||||
| exports.lockFilePatterns = ['packages.lock.json']; | ||||
| /** | ||||
|  * .NET CLI command to list local NuGet resources. | ||||
|  * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
 | ||||
|  */ | ||||
| exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; | ||||
| var State; | ||||
| (function (State) { | ||||
|     State["CachePrimaryKey"] = "CACHE_KEY"; | ||||
|     State["CacheMatchedKey"] = "CACHE_RESULT"; | ||||
| })(State = exports.State || (exports.State = {})); | ||||
| var Outputs; | ||||
| (function (Outputs) { | ||||
|     Outputs["CacheHit"] = "cache-hit"; | ||||
|     Outputs["DotnetVersion"] = "dotnet-version"; | ||||
| })(Outputs = exports.Outputs || (exports.Outputs = {})); | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.Outputs = exports.State = exports.cliCommand = exports.lockFilePatterns = void 0; | ||||
| /** NuGet lock file patterns */ | ||||
| exports.lockFilePatterns = ['packages.lock.json']; | ||||
| /** | ||||
|  * .NET CLI command to list local NuGet resources. | ||||
|  * @see https://docs.microsoft.com/dotnet/core/tools/dotnet-nuget-locals
 | ||||
|  */ | ||||
| exports.cliCommand = 'dotnet nuget locals all --list --force-english-output'; | ||||
| var State; | ||||
| (function (State) { | ||||
|     State["CachePrimaryKey"] = "CACHE_KEY"; | ||||
|     State["CacheMatchedKey"] = "CACHE_RESULT"; | ||||
| })(State = exports.State || (exports.State = {})); | ||||
| var Outputs; | ||||
| (function (Outputs) { | ||||
|     Outputs["CacheHit"] = "cache-hit"; | ||||
|     Outputs["DotnetVersion"] = "dotnet-version"; | ||||
| })(Outputs = exports.Outputs || (exports.Outputs = {})); | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
|  | ||||
							
								
								
									
										1469
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1469
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										5
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										5
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -17,6 +17,7 @@ | ||||
|         "@actions/http-client": "^2.0.1", | ||||
|         "@actions/io": "^1.0.2", | ||||
|         "fast-xml-parser": "^4.0.10", | ||||
|         "json5": "^2.2.3", | ||||
|         "semver": "^6.3.0" | ||||
|       }, | ||||
|       "devDependencies": { | ||||
| @ -4902,7 +4903,6 @@ | ||||
|       "version": "2.2.3", | ||||
|       "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", | ||||
|       "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", | ||||
|       "dev": true, | ||||
|       "bin": { | ||||
|         "json5": "lib/cli.js" | ||||
|       }, | ||||
| @ -10204,8 +10204,7 @@ | ||||
|     "json5": { | ||||
|       "version": "2.2.3", | ||||
|       "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", | ||||
|       "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", | ||||
|       "dev": true | ||||
|       "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" | ||||
|     }, | ||||
|     "kleur": { | ||||
|       "version": "3.0.3", | ||||
|  | ||||
| @ -34,6 +34,7 @@ | ||||
|     "@actions/http-client": "^2.0.1", | ||||
|     "@actions/io": "^1.0.2", | ||||
|     "fast-xml-parser": "^4.0.10", | ||||
|     "json5": "^2.2.3", | ||||
|     "semver": "^6.3.0" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|  | ||||
| @ -7,6 +7,7 @@ import * as auth from './authutil'; | ||||
| import {isCacheFeatureAvailable} from './cache-utils'; | ||||
| import {restoreCache} from './cache-restore'; | ||||
| import {Outputs} from './constants'; | ||||
| import JSON5 from 'json5'; | ||||
| 
 | ||||
| const qualityOptions = [ | ||||
|   'daily', | ||||
| @ -97,9 +98,14 @@ export async function run() { | ||||
| 
 | ||||
| function getVersionFromGlobalJson(globalJsonPath: string): string { | ||||
|   let version = ''; | ||||
|   const globalJson = JSON.parse( | ||||
|   const globalJson = JSON5.parse( | ||||
|     // .trim() is necessary to strip BOM https://github.com/nodejs/node/issues/20649
 | ||||
|     fs.readFileSync(globalJsonPath, {encoding: 'utf8'}).trim() | ||||
|     fs.readFileSync(globalJsonPath, {encoding: 'utf8'}).trim(), | ||||
|     // is necessary as JSON5 supports wider variety of options for numbers: https://www.npmjs.com/package/json5#numbers
 | ||||
|     (key, value) => { | ||||
|       if (key === 'version' || key === 'rollForward') return String(value); | ||||
|       return value; | ||||
|     } | ||||
|   ); | ||||
|   if (globalJson.sdk && globalJson.sdk.version) { | ||||
|     version = globalJson.sdk.version; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user