mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Update dependencies
Update to Jest 27 Set sourceMap to true in tsconfig.json
This commit is contained in:
parent
baab28a534
commit
32c1436247
@ -4,7 +4,9 @@ import * as install from '../src/install';
|
||||
* Mock install.ts
|
||||
*/
|
||||
jest.mock('../src/install', () => ({
|
||||
build: jest.fn().mockImplementation(
|
||||
build: jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
async (
|
||||
filename: string,
|
||||
version: string,
|
||||
@ -36,8 +38,7 @@ jest.mock('../src/install', () => ({
|
||||
return script;
|
||||
}
|
||||
),
|
||||
run: jest.fn().mockImplementation(
|
||||
async (): Promise<string> => {
|
||||
run: jest.fn().mockImplementation(async (): Promise<string> => {
|
||||
const os_version: string = process.env['RUNNER_OS'] || '';
|
||||
let version: string = process.env['php-version'] || '';
|
||||
version = version.length > 1 ? version.slice(0, 3) : version + '.0';
|
||||
@ -57,8 +58,7 @@ jest.mock('../src/install', () => ({
|
||||
}
|
||||
|
||||
return script;
|
||||
}
|
||||
)
|
||||
})
|
||||
}));
|
||||
|
||||
/**
|
||||
|
@ -163,9 +163,9 @@ describe('Tools tests', () => {
|
||||
'a',
|
||||
'b'
|
||||
]);
|
||||
expect(
|
||||
await tools.addComposer(['a', 'b', 'composer:1.2.3'])
|
||||
).toStrictEqual(['composer:1.2.3', 'a', 'b']);
|
||||
expect(await tools.addComposer(['a', 'b', 'composer:1.2.3'])).toStrictEqual(
|
||||
['composer:1.2.3', 'a', 'b']
|
||||
);
|
||||
expect(
|
||||
await tools.addComposer(['a', 'b', 'composer:v1.2.3'])
|
||||
).toStrictEqual(['composer:1.2.3', 'a', 'b']);
|
||||
|
@ -8,11 +8,9 @@ jest.mock('@actions/core', () => ({
|
||||
})
|
||||
}));
|
||||
|
||||
jest.spyOn(utils, 'fetch').mockImplementation(
|
||||
async (url): Promise<string> => {
|
||||
jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise<string> => {
|
||||
return `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
async function cleanup(path: string): Promise<void> {
|
||||
fs.unlink(path, error => {
|
||||
|
103
dist/index.js
vendored
103
dist/index.js
vendored
@ -76,7 +76,7 @@ async function addINIValues(ini_values_csv, os_version, no_step = false) {
|
||||
}
|
||||
}
|
||||
exports.addINIValues = addINIValues;
|
||||
|
||||
//# sourceMappingURL=config.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -180,7 +180,7 @@ async function addCoverage(coverage_driver, version, os_version) {
|
||||
}
|
||||
}
|
||||
exports.addCoverage = addCoverage;
|
||||
|
||||
//# sourceMappingURL=coverage.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -374,7 +374,7 @@ async function addExtension(extension_csv, version, os_version, no_step = false)
|
||||
}
|
||||
}
|
||||
exports.addExtension = addExtension;
|
||||
|
||||
//# sourceMappingURL=extensions.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -476,7 +476,7 @@ exports.run = run;
|
||||
})().catch(error => {
|
||||
core.setFailed(error.message);
|
||||
});
|
||||
|
||||
//# sourceMappingURL=install.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -786,7 +786,7 @@ async function addTools(tools_csv, php_version, os_version) {
|
||||
return script;
|
||||
}
|
||||
exports.addTools = addTools;
|
||||
|
||||
//# sourceMappingURL=tools.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -997,7 +997,7 @@ async function suppressOutput(os_version) {
|
||||
}
|
||||
}
|
||||
exports.suppressOutput = suppressOutput;
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -1005,14 +1005,27 @@ exports.suppressOutput = suppressOutput;
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.issue = exports.issueCommand = void 0;
|
||||
const os = __importStar(__nccwpck_require__(87));
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
/**
|
||||
@ -1090,6 +1103,25 @@ function escapeProperty(s) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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.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) {
|
||||
@ -1099,14 +1131,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
||||
const command_1 = __nccwpck_require__(241);
|
||||
const file_command_1 = __nccwpck_require__(717);
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
@ -1173,7 +1199,9 @@ function addPath(inputPath) {
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
* Gets the value of an input.
|
||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
||||
* Returns an empty string if the value is not defined.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
@ -1184,9 +1212,34 @@ function getInput(name, options) {
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
if (options && options.trimWhitespace === false) {
|
||||
return val;
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
* The return value is also in boolean type.
|
||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns boolean
|
||||
*/
|
||||
function getBooleanInput(name, options) {
|
||||
const trueValue = ['true', 'True', 'TRUE'];
|
||||
const falseValue = ['false', 'False', 'FALSE'];
|
||||
const val = getInput(name, options);
|
||||
if (trueValue.includes(val))
|
||||
return true;
|
||||
if (falseValue.includes(val))
|
||||
return false;
|
||||
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
}
|
||||
exports.getBooleanInput = getBooleanInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
@ -1336,14 +1389,27 @@ exports.getState = getState;
|
||||
|
||||
|
||||
// For internal use, subject to change.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.issueCommand = void 0;
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__nccwpck_require__(747));
|
||||
@ -1373,6 +1439,7 @@ exports.issueCommand = issueCommand;
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.toCommandValue = void 0;
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
|
8560
package-lock.json
generated
8560
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@ -24,28 +24,28 @@
|
||||
"author": "shivammathur",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.7",
|
||||
"@actions/core": "^1.3.0",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/io": "^1.1.0",
|
||||
"fs": "0.0.1-security"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.22",
|
||||
"@types/node": "^14.14.41",
|
||||
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
||||
"@typescript-eslint/parser": "^4.22.0",
|
||||
"@vercel/ncc": "^0.28.3",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-config-prettier": "^8.2.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jest": "^24.3.5",
|
||||
"@types/jest": "^26.0.23",
|
||||
"@types/node": "^15.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.25.0",
|
||||
"@typescript-eslint/parser": "^4.25.0",
|
||||
"@vercel/ncc": "^0.28.6",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"eslint-plugin-jest": "^24.3.6",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"husky": "^4.3.8",
|
||||
"jest": "^26.6.3",
|
||||
"jest-circus": "^26.6.3",
|
||||
"prettier": "^2.2.1",
|
||||
"ts-jest": "^26.5.5",
|
||||
"typescript": "^4.2.4"
|
||||
"jest": "^27.0.3",
|
||||
"jest-circus": "^27.0.3",
|
||||
"prettier": "^2.3.0",
|
||||
"ts-jest": "^27.0.1",
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
|
@ -32,7 +32,8 @@ export async function getCommand(
|
||||
*/
|
||||
export async function getToolVersion(version: string): Promise<string> {
|
||||
// semver_regex - https://semver.org/
|
||||
const semver_regex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
||||
const semver_regex =
|
||||
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
||||
const composer_regex = /^stable$|^preview$|^snapshot$|^v?[1|2]$/;
|
||||
version = version.replace(/[><=^]*/, '');
|
||||
switch (true) {
|
||||
@ -215,8 +216,10 @@ export async function getSymfonyUri(
|
||||
*/
|
||||
export async function addComposer(tools_list: string[]): Promise<string[]> {
|
||||
const regex_any = /^composer($|:.*)/;
|
||||
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
||||
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
|
||||
const regex_valid =
|
||||
/^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
|
||||
const regex_composer1_tools =
|
||||
/hirak|prestissimo|narrowspark|composer-prefetcher/;
|
||||
const matches: string[] = tools_list.filter(tool => regex_valid.test(tool));
|
||||
let composer = 'composer';
|
||||
tools_list = tools_list.filter(tool => !regex_any.test(tool));
|
||||
|
@ -10,7 +10,7 @@
|
||||
"outDir": "./lib",
|
||||
"removeComments": true,
|
||||
"rootDir": "./src",
|
||||
"sourceMap": false,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "ESNext"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user