mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-23 04:11:06 +07:00
Improve regexes in extensions.ts
This commit is contained in:
parent
f66ac5d5a6
commit
17349dafc1
42
dist/index.js
vendored
42
dist/index.js
vendored
@ -2921,22 +2921,17 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'darwin');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
matches = /.*-(.*)\/(.*)@(.*)/.exec(extension);
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension);
|
||||||
if (matches == null) {
|
|
||||||
// Shouldn't happen
|
|
||||||
add_script += await utils.getUnsupportedLog(extension, version, 'darwin');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_script += await utils.joins('\nadd_extension_from_github', ext_name, matches[1], matches[2], matches[3], ext_prefix);
|
add_script += await utils.joins('\nadd_extension_from_github', ext_name, matches[1], matches[2], matches[3], ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
@ -2950,7 +2945,7 @@ async function addExtensionDarwin(extension_csv, version) {
|
|||||||
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
add_script += await utils.joins('\nadd_brew_extension', ext_name, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /^5\.6redis$/.test(version_extension):
|
||||||
extension = 'redis-2.2.8';
|
extension = 'redis-2.2.8';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -2996,21 +2991,21 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'win32');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
add_script += await utils.joins('\nAdd-Extension', ext_name, ext_version.replace('stable', ''));
|
||||||
break;
|
break;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.getUnsupportedLog(extension, version, 'win32');
|
add_script += await utils.getUnsupportedLog(extension, version, 'win32');
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+$/.test(extension):
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version);
|
||||||
break;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
|
||||||
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(version_extension);
|
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(version_extension);
|
||||||
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
|
add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2].replace('preview', 'devel'), matches[1]);
|
||||||
break;
|
break;
|
||||||
// match 7.2xdebug2 to 7.4xdebug2
|
// match 7.2xdebug2 to 7.4xdebug2
|
||||||
@ -3031,7 +3026,7 @@ async function addExtensionWindows(extension_csv, version) {
|
|||||||
// match 7.0mysql..8.9mysql
|
// match 7.0mysql..8.9mysql
|
||||||
// match 7.0mysqli..8.9mysqli
|
// match 7.0mysqli..8.9mysqli
|
||||||
// match 7.0mysqlnd..8.9mysqlnd
|
// match 7.0mysqlnd..8.9mysqlnd
|
||||||
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
case /[7-8]\.\d+(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -3084,22 +3079,17 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
add_script += await utils.customPackage(ext_name, 'ext', extension, 'linux');
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(version_extension):
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_unstable_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
matches = /.*-(.*)\/(.*)@(.*)/.exec(extension);
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension);
|
||||||
if (matches == null) {
|
|
||||||
// Shouldn't happen
|
|
||||||
add_script += await utils.getUnsupportedLog(extension, version, 'linux');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
add_script += await utils.joins('\nadd_extension_from_github', ext_name, matches[1], matches[2], matches[3], ext_prefix);
|
add_script += await utils.joins('\nadd_extension_from_github', ext_name, matches[1], matches[2], matches[3], ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
// match semver versions
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
add_script += await utils.joins('\nadd_pecl_extension', ext_name, ext_version, ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match 5.3pcov to 7.0pcov
|
// match 5.3pcov to 7.0pcov
|
||||||
@ -3111,7 +3101,7 @@ async function addExtensionLinux(extension_csv, version) {
|
|||||||
add_script += await utils.joins('\nadd_pecl_extension', 'xdebug', '2.9.8', ext_prefix);
|
add_script += await utils.joins('\nadd_pecl_extension', 'xdebug', '2.9.8', ext_prefix);
|
||||||
return;
|
return;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /^pdo[_-].+/.test(extension):
|
||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
|
@ -45,9 +45,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -57,8 +55,8 @@ export async function addExtensionDarwin(
|
|||||||
return;
|
return;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
matches = /.*-(.*)\/(.*)@(.*)/.exec(extension) as RegExpExecArray;
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension) as RegExpExecArray;
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_extension_from_github',
|
'\nadd_extension_from_github',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -69,7 +67,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match semver
|
// match semver
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_pecl_extension',
|
'\nadd_pecl_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -94,7 +92,7 @@ export async function addExtensionDarwin(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match 5.6redis
|
// match 5.6redis
|
||||||
case /5\.6redis/.test(version_extension):
|
case /^5\.6redis$/.test(version_extension):
|
||||||
extension = 'redis-2.2.8';
|
extension = 'redis-2.2.8';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -150,7 +148,7 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot)/.test(version_extension):
|
case /.+-(stable|beta|alpha|devel|snapshot)/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension',
|
'\nAdd-Extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -159,7 +157,7 @@ export async function addExtensionWindows(
|
|||||||
break;
|
break;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
add_script += await utils.getUnsupportedLog(
|
add_script += await utils.getUnsupportedLog(
|
||||||
extension,
|
extension,
|
||||||
version,
|
version,
|
||||||
@ -167,7 +165,7 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match semver without state
|
// match semver without state
|
||||||
case /.*-\d+\.\d+\.\d+$/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+$/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nAdd-Extension',
|
'\nAdd-Extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -176,8 +174,8 @@ export async function addExtensionWindows(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
// match semver with state
|
// match semver with state
|
||||||
case /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+[a-zA-Z]+\d*/.test(extension):
|
||||||
matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec(
|
matches = /.+-(\d+\.\d+\.\d+)([a-zA-Z]+)\d*/.exec(
|
||||||
version_extension
|
version_extension
|
||||||
) as RegExpExecArray;
|
) as RegExpExecArray;
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
@ -205,7 +203,7 @@ export async function addExtensionWindows(
|
|||||||
// match 7.0mysql..8.9mysql
|
// match 7.0mysql..8.9mysql
|
||||||
// match 7.0mysqli..8.9mysqli
|
// match 7.0mysqli..8.9mysqli
|
||||||
// match 7.0mysqlnd..8.9mysqlnd
|
// match 7.0mysqlnd..8.9mysqlnd
|
||||||
case /[7-8]\.\d(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
case /[7-8]\.\d+(mysql|mysqli|mysqlnd)$/.test(version_extension):
|
||||||
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
add_script += '\nAdd-Extension mysqli\nAdd-Extension mysqlnd';
|
||||||
break;
|
break;
|
||||||
// match sqlite
|
// match sqlite
|
||||||
@ -271,9 +269,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pre-release versions. For example - xdebug-beta
|
// match pre-release versions. For example - xdebug-beta
|
||||||
case /.*-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(
|
case /.+-(stable|beta|alpha|devel|snapshot|rc|preview)/.test(extension):
|
||||||
version_extension
|
|
||||||
):
|
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_unstable_extension',
|
'\nadd_unstable_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -283,8 +279,8 @@ export async function addExtensionLinux(
|
|||||||
return;
|
return;
|
||||||
// match extensions from GitHub. Do this before checking for semver as
|
// match extensions from GitHub. Do this before checking for semver as
|
||||||
// the version may match that as well
|
// the version may match that as well
|
||||||
case /.*-(.*)\/(.*)@(.*)/.test(extension):
|
case /.+-.+\/.+@.+/.test(extension):
|
||||||
matches = /.*-(.*)\/(.*)@(.*)/.exec(extension) as RegExpExecArray;
|
matches = /.+-(.+)\/(.+)@(.+)/.exec(extension) as RegExpExecArray;
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_extension_from_github',
|
'\nadd_extension_from_github',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -295,7 +291,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match semver versions
|
// match semver versions
|
||||||
case /.*-\d+\.\d+\.\d+.*/.test(version_extension):
|
case /.+-\d+\.\d+\.\d+.*/.test(extension):
|
||||||
add_script += await utils.joins(
|
add_script += await utils.joins(
|
||||||
'\nadd_pecl_extension',
|
'\nadd_pecl_extension',
|
||||||
ext_name,
|
ext_name,
|
||||||
@ -317,7 +313,7 @@ export async function addExtensionLinux(
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
// match pdo extensions
|
// match pdo extensions
|
||||||
case /.*pdo[_-].*/.test(version_extension):
|
case /^pdo[_-].+/.test(extension):
|
||||||
extension = extension.replace(/pdo[_-]|3/, '');
|
extension = extension.replace(/pdo[_-]|3/, '');
|
||||||
add_script += '\nadd_pdo_extension ' + extension;
|
add_script += '\nadd_pdo_extension ' + extension;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user