mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Add new file-container for package-managers
File package-managers.ts was added.
This commit is contained in:
parent
30f08b7b11
commit
f7d54db843
5 changed files with 58 additions and 41 deletions
30
dist/cache-save/index.js
vendored
30
dist/cache-save/index.js
vendored
|
@ -3927,14 +3927,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0;
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
exports.supportedPackageManagers = {
|
const package_managers_1 = __webpack_require__(813);
|
||||||
default: {
|
|
||||||
dependencyFilePattern: 'go.sum',
|
|
||||||
getCacheFolderCommand: 'go env GOMODCACHE'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
|
@ -3946,10 +3941,10 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
|
||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (!exports.supportedPackageManagers[packageManager]) {
|
if (!package_managers_1.supportedPackageManagers[packageManager]) {
|
||||||
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
|
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
|
||||||
}
|
}
|
||||||
return exports.supportedPackageManagers[packageManager];
|
return package_managers_1.supportedPackageManagers[packageManager];
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdout = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const stdout = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||||
|
@ -46484,7 +46479,22 @@ run();
|
||||||
/* 810 */,
|
/* 810 */,
|
||||||
/* 811 */,
|
/* 811 */,
|
||||||
/* 812 */,
|
/* 812 */,
|
||||||
/* 813 */,
|
/* 813 */
|
||||||
|
/***/ (function(__unusedmodule, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.supportedPackageManagers = void 0;
|
||||||
|
exports.supportedPackageManagers = {
|
||||||
|
default: {
|
||||||
|
dependencyFilePattern: 'go.sum',
|
||||||
|
getCacheFolderCommand: 'go env GOMODCACHE'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/* 814 */,
|
/* 814 */,
|
||||||
/* 815 */
|
/* 815 */
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
30
dist/setup/index.js
vendored
30
dist/setup/index.js
vendored
|
@ -4171,14 +4171,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = exports.supportedPackageManagers = void 0;
|
exports.getCacheDirectoryPath = exports.getPackageManagerInfo = exports.getCommandOutput = void 0;
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
exports.supportedPackageManagers = {
|
const package_managers_1 = __webpack_require__(813);
|
||||||
default: {
|
|
||||||
dependencyFilePattern: 'go.sum',
|
|
||||||
getCacheFolderCommand: 'go env GOMODCACHE'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
let { stdout, stderr, exitCode } = yield exec.getExecOutput(toolCommand, undefined, { ignoreReturnCode: true });
|
||||||
if (exitCode) {
|
if (exitCode) {
|
||||||
|
@ -4190,10 +4185,10 @@ exports.getCommandOutput = (toolCommand) => __awaiter(void 0, void 0, void 0, fu
|
||||||
return stdout.trim();
|
return stdout.trim();
|
||||||
});
|
});
|
||||||
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (!exports.supportedPackageManagers[packageManager]) {
|
if (!package_managers_1.supportedPackageManagers[packageManager]) {
|
||||||
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
|
throw new Error(`It's not possible to use ${packageManager}, please, check correctness of the package manager name spelling.`);
|
||||||
}
|
}
|
||||||
return exports.supportedPackageManagers[packageManager];
|
return package_managers_1.supportedPackageManagers[packageManager];
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const stdout = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
const stdout = yield exports.getCommandOutput(packageManagerInfo.getCacheFolderCommand);
|
||||||
|
@ -49856,7 +49851,22 @@ module.exports = require("stream");
|
||||||
/* 810 */,
|
/* 810 */,
|
||||||
/* 811 */,
|
/* 811 */,
|
||||||
/* 812 */,
|
/* 812 */,
|
||||||
/* 813 */,
|
/* 813 */
|
||||||
|
/***/ (function(__unusedmodule, exports) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.supportedPackageManagers = void 0;
|
||||||
|
exports.supportedPackageManagers = {
|
||||||
|
default: {
|
||||||
|
dependencyFilePattern: 'go.sum',
|
||||||
|
getCacheFolderCommand: 'go env GOMODCACHE'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/* 814 */,
|
/* 814 */,
|
||||||
/* 815 */
|
/* 815 */
|
||||||
/***/ (function(module) {
|
/***/ (function(module) {
|
||||||
|
|
|
@ -5,11 +5,8 @@ import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import {State, Outputs} from './constants';
|
import {State, Outputs} from './constants';
|
||||||
import {
|
import {PackageManagerInfo} from './package-managers';
|
||||||
getCacheDirectoryPath,
|
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
||||||
getPackageManagerInfo,
|
|
||||||
PackageManagerInfo
|
|
||||||
} from './cache-utils';
|
|
||||||
|
|
||||||
export const restoreCache = async (
|
export const restoreCache = async (
|
||||||
packageManager: string,
|
packageManager: string,
|
||||||
|
|
|
@ -1,20 +1,5 @@
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
||||||
type SupportedPackageManagers = {
|
|
||||||
[prop: string]: PackageManagerInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface PackageManagerInfo {
|
|
||||||
dependencyFilePattern: string;
|
|
||||||
getCacheFolderCommand: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const supportedPackageManagers: SupportedPackageManagers = {
|
|
||||||
default: {
|
|
||||||
dependencyFilePattern: 'go.sum',
|
|
||||||
getCacheFolderCommand: 'go env GOMODCACHE'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getCommandOutput = async (toolCommand: string) => {
|
export const getCommandOutput = async (toolCommand: string) => {
|
||||||
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
let {stdout, stderr, exitCode} = await exec.getExecOutput(
|
||||||
|
|
15
src/package-managers.ts
Normal file
15
src/package-managers.ts
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
type SupportedPackageManagers = {
|
||||||
|
[prop: string]: PackageManagerInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface PackageManagerInfo {
|
||||||
|
dependencyFilePattern: string;
|
||||||
|
getCacheFolderCommand: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const supportedPackageManagers: SupportedPackageManagers = {
|
||||||
|
default: {
|
||||||
|
dependencyFilePattern: 'go.sum',
|
||||||
|
getCacheFolderCommand: 'go env GOMODCACHE'
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue