@@ -60441,6 +60441,7 @@ const cache = __importStar(__nccwpck_require__(7799));
60441
60441
const glob = __importStar(__nccwpck_require__(8090));
60442
60442
const path_1 = __importDefault(__nccwpck_require__(1017));
60443
60443
const fs_1 = __importDefault(__nccwpck_require__(7147));
60444
+ const util_1 = __nccwpck_require__(2629);
60444
60445
exports.supportedPackageManagers = {
60445
60446
npm: {
60446
60447
name: 'npm',
@@ -60526,11 +60527,7 @@ const getProjectDirectoriesFromCacheDependencyPath = (cacheDependencyPath) => __
60526
60527
cacheDependenciesPaths = (yield globber.glob()) || [''];
60527
60528
exports.memoizedCacheDependencies[cacheDependencyPath] = cacheDependenciesPaths;
60528
60529
}
60529
- const existingDirectories = cacheDependenciesPaths
60530
- .map(path_1.default.dirname)
60531
- // uniq in order to do not traverse the same directories during the further processing
60532
- .filter((item, i, src) => item != null && src.indexOf(item) === i)
60533
- .filter(directory => fs_1.default.existsSync(directory) && fs_1.default.lstatSync(directory).isDirectory());
60530
+ const existingDirectories = util_1.arrayUniqNotNull(cacheDependenciesPaths.map(path_1.default.dirname)).filter(directory => fs_1.default.existsSync(directory) && fs_1.default.lstatSync(directory).isDirectory());
60534
60531
// if user explicitly pointed out some file, but it does not exist it is definitely
60535
60532
// not he wanted, thus we should throw an error not trying to workaround with unexpected
60536
60533
// result to the whole build
@@ -60554,7 +60551,7 @@ const getCacheDirectoriesFromCacheDependencyPath = (packageManagerInfo, cacheDep
60554
60551
return cacheFolderPath;
60555
60552
})));
60556
60553
// uniq in order to do not cache the same directories twice
60557
- return cacheFoldersPaths.filter((item, i, src) => src.indexOf(item) === i );
60554
+ return util_1.arrayUniq(cacheFoldersPaths );
60558
60555
});
60559
60556
/**
60560
60557
* Finds the cache directories configured for the repo ignoring cache-dependency-path
@@ -60627,6 +60624,117 @@ var Outputs;
60627
60624
})(Outputs = exports.Outputs || (exports.Outputs = {}));
60628
60625
60629
60626
60627
+ /***/ }),
60628
+
60629
+ /***/ 2629:
60630
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
60631
+
60632
+ "use strict";
60633
+
60634
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
60635
+ if (k2 === undefined) k2 = k;
60636
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
60637
+ }) : (function(o, m, k, k2) {
60638
+ if (k2 === undefined) k2 = k;
60639
+ o[k2] = m[k];
60640
+ }));
60641
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
60642
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
60643
+ }) : function(o, v) {
60644
+ o["default"] = v;
60645
+ });
60646
+ var __importStar = (this && this.__importStar) || function (mod) {
60647
+ if (mod && mod.__esModule) return mod;
60648
+ var result = {};
60649
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
60650
+ __setModuleDefault(result, mod);
60651
+ return result;
60652
+ };
60653
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
60654
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60655
+ return new (P || (P = Promise))(function (resolve, reject) {
60656
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
60657
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
60658
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
60659
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
60660
+ });
60661
+ };
60662
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
60663
+ exports.arrayUniqNotNull = exports.arrayUniq = exports.printEnvDetailsAndSetOutput = exports.parseNodeVersionFile = void 0;
60664
+ const core = __importStar(__nccwpck_require__(2186));
60665
+ const exec = __importStar(__nccwpck_require__(1514));
60666
+ function parseNodeVersionFile(contents) {
60667
+ var _a, _b, _c;
60668
+ let nodeVersion;
60669
+ // Try parsing the file as an NPM `package.json` file.
60670
+ try {
60671
+ nodeVersion = (_a = JSON.parse(contents).volta) === null || _a === void 0 ? void 0 : _a.node;
60672
+ if (!nodeVersion)
60673
+ nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
60674
+ }
60675
+ catch (_d) {
60676
+ core.info('Node version file is not JSON file');
60677
+ }
60678
+ if (!nodeVersion) {
60679
+ const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
60680
+ nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
60681
+ }
60682
+ // In the case of an unknown format,
60683
+ // return as is and evaluate the version separately.
60684
+ if (!nodeVersion)
60685
+ nodeVersion = contents.trim();
60686
+ return nodeVersion;
60687
+ }
60688
+ exports.parseNodeVersionFile = parseNodeVersionFile;
60689
+ function printEnvDetailsAndSetOutput() {
60690
+ return __awaiter(this, void 0, void 0, function* () {
60691
+ core.startGroup('Environment details');
60692
+ const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
60693
+ const output = yield getToolVersion(tool, ['--version']);
60694
+ return { tool, output };
60695
+ }));
60696
+ const tools = yield Promise.all(promises);
60697
+ tools.forEach(({ tool, output }) => {
60698
+ if (tool === 'node') {
60699
+ core.setOutput(`${tool}-version`, output);
60700
+ }
60701
+ core.info(`${tool}: ${output}`);
60702
+ });
60703
+ core.endGroup();
60704
+ });
60705
+ }
60706
+ exports.printEnvDetailsAndSetOutput = printEnvDetailsAndSetOutput;
60707
+ function getToolVersion(tool, options) {
60708
+ return __awaiter(this, void 0, void 0, function* () {
60709
+ try {
60710
+ const { stdout, stderr, exitCode } = yield exec.getExecOutput(tool, options, {
60711
+ ignoreReturnCode: true,
60712
+ silent: true
60713
+ });
60714
+ if (exitCode > 0) {
60715
+ core.info(`[warning]${stderr}`);
60716
+ return '';
60717
+ }
60718
+ return stdout.trim();
60719
+ }
60720
+ catch (err) {
60721
+ return '';
60722
+ }
60723
+ });
60724
+ }
60725
+ const arrayUniq = (src) => [...new Set(src)];
60726
+ exports.arrayUniq = arrayUniq;
60727
+ const arrayUniqNotNull = (src) => {
60728
+ const set = new Set();
60729
+ src.forEach(item => {
60730
+ if (item !== null)
60731
+ set.add(item);
60732
+ });
60733
+ return [...set];
60734
+ };
60735
+ exports.arrayUniqNotNull = arrayUniqNotNull;
60736
+
60737
+
60630
60738
/***/ }),
60631
60739
60632
60740
/***/ 2877:
0 commit comments