diff --git a/__tests__/extensions.test.ts b/__tests__/extensions.test.ts index fbb0c4f9..390dbca9 100644 --- a/__tests__/extensions.test.ts +++ b/__tests__/extensions.test.ts @@ -3,7 +3,7 @@ import * as extensions from '../src/extensions'; describe('Extension tests', () => { it('checking addExtensionOnWindows', async () => { let win32: string = await extensions.addExtension( - 'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2', + 'Xdebug, pcov, sqlite, :intl, phalcon4, ioncube, oci8, pdo_oci, ast-beta, grpc-1.2.3, inotify-1.2.3alpha2, sqlsrv-1.2.3preview1', '7.4', 'win32' ); @@ -18,6 +18,7 @@ describe('Extension tests', () => { expect(win32).toContain('Add-Extension ast beta'); expect(win32).toContain('Add-Extension grpc stable 1.2.3'); expect(win32).toContain('Add-Extension inotify alpha 1.2.3'); + expect(win32).toContain('Add-Extension sqlsrv devel 1.2.3'); win32 = await extensions.addExtension('pcov', '5.6', 'win32'); expect(win32).toContain( diff --git a/dist/index.js b/dist/index.js index 8cc3b12d..162ad27a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2974,9 +2974,9 @@ async function addExtensionWindows(extension_csv, version) { add_script += await utils.joins('\nAdd-Extension', ext_name, 'stable', ext_version); break; // match semver with state - case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test(version_extension): - matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec(version_extension); - add_script += await utils.joins('\nAdd-Extension', ext_name, matches[2], matches[1]); + case /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.test(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]); break; // match 5.3pcov to 7.0pcov case /(5\.[3-6]|7\.0)pcov/.test(version_extension): diff --git a/src/extensions.ts b/src/extensions.ts index 6a346b27..d208e1a1 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -164,16 +164,14 @@ export async function addExtensionWindows( ); break; // match semver with state - case /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.test( - version_extension - ): - matches = /.*-(\d+\.\d+\.\d)(beta|alpha|devel|snapshot)\d*/.exec( + case /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.test(version_extension): + matches = /.*-(\d+\.\d+\.\d)([a-zA-Z+]+)\d*/.exec( version_extension ) as RegExpExecArray; add_script += await utils.joins( '\nAdd-Extension', ext_name, - matches[2], + matches[2].replace('preview', 'devel'), matches[1] ); break; diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 8af59034..36c42773 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -71,7 +71,7 @@ check_extension() { # Function to get the PECL version. get_pecl_version() { extension=$1 - stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")" + stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")" pecl_rest='https://pecl.php.net/rest/r/' response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml) pecl_version=$(echo "$response" | grep -m 1 -Eio "(\d*\.\d*\.\d*$stability\d*)") @@ -92,7 +92,7 @@ add_pecl_extension() { extension=$1 pecl_version=$2 prefix=$3 - if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then + if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then pecl_version=$(get_pecl_version "$extension" "$pecl_version") fi if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index e29a431d..389e806f 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -92,7 +92,7 @@ configure_pecl() { # Function to get the PECL version of an extension. get_pecl_version() { extension=$1 - stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot)")" + stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")" pecl_rest='https://pecl.php.net/rest/r/' response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml) pecl_version=$(echo "$response" | grep -m 1 -Pio "(\d*\.\d*\.\d*$stability\d*)") @@ -202,7 +202,7 @@ add_pecl_extension() { extension=$1 pecl_version=$2 prefix=$3 - if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot).* ]]; then + if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then pecl_version=$(get_pecl_version "$extension" "$pecl_version") fi if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then