@scandipwa/magento-scripts 1.16.1 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/cli.js +4 -6
- package/lib/commands/execute.js +29 -4
- package/lib/commands/import-db.js +1 -1
- package/lib/commands/logs.js +1 -1
- package/lib/commands/start.js +38 -20
- package/lib/commands/status.js +2 -0
- package/lib/config/docker.js +102 -84
- package/lib/config/get-project-configuration.js +3 -1
- package/lib/config/index.js +10 -7
- package/lib/config/magento/required-php-extensions/index.js +29 -0
- package/lib/config/magento/required-php-extensions/magento-2.3.js +19 -0
- package/lib/config/magento/required-php-extensions/magento-2.4.js +29 -0
- package/lib/config/php/base-repo.js +3 -0
- package/lib/config/php/extensions/apcu.js +12 -0
- package/lib/config/php/extensions/bcmath.js +7 -0
- package/lib/config/php/extensions/curl.js +11 -0
- package/lib/config/php/extensions/gd.js +14 -0
- package/lib/config/php/extensions/index.js +18 -2
- package/lib/config/php/extensions/intl.js +10 -0
- package/lib/config/php/extensions/opcache.js +10 -0
- package/lib/config/php/extensions/pdo_mysql.js +7 -0
- package/lib/config/php/extensions/soap.js +10 -0
- package/lib/config/php/extensions/sodium.js +10 -0
- package/lib/config/php/extensions/xdebug.js +8 -5
- package/lib/config/php/extensions/xsl.js +10 -0
- package/lib/config/php/extensions/zip.js +10 -0
- package/lib/config/php/{releases → versions}/index.js +0 -0
- package/lib/config/php/versions/php-7.2.js +23 -0
- package/lib/config/php/versions/php-7.3.js +23 -0
- package/lib/config/php/versions/php-7.4.js +23 -0
- package/lib/config/php/versions/php-8.1.js +23 -0
- package/lib/config/php-config.js +8 -12
- package/lib/config/port-config.js +2 -6
- package/lib/config/services/elasticsearch/base-repo.js +3 -0
- package/lib/config/services/elasticsearch/default-es-env.js +6 -0
- package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
- package/lib/config/services/elasticsearch/versions/index.js +5 -0
- package/lib/config/templates/magentorc.template +5 -5
- package/lib/config/templates/mariadb.template.cnf +191 -0
- package/lib/config/templates/php-fpm.template.conf +3 -3
- package/lib/config/templates/php.template.ini +12 -6
- package/lib/config/templates/ssl-terminator.template.conf +1 -1
- package/lib/config/templates/vscode-launch.template.json +3 -1
- package/lib/config/versions/magento-2.3.0.js +10 -5
- package/lib/config/versions/magento-2.3.1.js +10 -5
- package/lib/config/versions/magento-2.3.2-p1.js +43 -0
- package/lib/config/versions/magento-2.3.2-p2.js +10 -5
- package/lib/config/versions/magento-2.3.2.js +10 -5
- package/lib/config/versions/magento-2.3.3-p1.js +10 -5
- package/lib/config/versions/magento-2.3.3.js +10 -5
- package/lib/config/versions/magento-2.3.4-p1.js +43 -0
- package/lib/config/versions/magento-2.3.4-p2.js +10 -5
- package/lib/config/versions/magento-2.3.4.js +10 -5
- package/lib/config/versions/magento-2.3.5-p1.js +8 -2
- package/lib/config/versions/magento-2.3.5-p2.js +8 -2
- package/lib/config/versions/magento-2.3.5.js +8 -2
- package/lib/config/versions/magento-2.3.6-p1.js +8 -2
- package/lib/config/versions/magento-2.3.6.js +8 -2
- package/lib/config/versions/magento-2.3.7-p1.js +8 -2
- package/lib/config/versions/magento-2.3.7-p2.js +8 -2
- package/lib/config/versions/magento-2.3.7-p3.js +8 -2
- package/lib/config/versions/magento-2.3.7.js +8 -2
- package/lib/config/versions/magento-2.4.0-p1.js +9 -3
- package/lib/config/versions/magento-2.4.0.js +9 -3
- package/lib/config/versions/magento-2.4.1-p1.js +6 -5
- package/lib/config/versions/magento-2.4.1.js +9 -2
- package/lib/config/versions/magento-2.4.2-p1.js +6 -5
- package/lib/config/versions/magento-2.4.2-p2.js +6 -6
- package/lib/config/versions/magento-2.4.2.js +6 -6
- package/lib/config/versions/magento-2.4.3-p1.js +7 -7
- package/lib/config/versions/magento-2.4.3-p2.js +7 -7
- package/lib/config/versions/magento-2.4.3.js +7 -7
- package/lib/config/versions/magento-2.4.4.js +9 -2
- package/lib/tasks/cleanup.js +3 -3
- package/lib/tasks/composer/index.js +14 -104
- package/lib/tasks/database/connect-to-database.js +117 -0
- package/lib/tasks/database/create-magento-database.js +18 -0
- package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
- package/lib/tasks/{mysql → database}/fix-db.js +2 -2
- package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +65 -22
- package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
- package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
- package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
- package/lib/tasks/{mysql → database}/index.js +2 -2
- package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
- package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
- package/lib/tasks/docker/api.d.ts +71 -0
- package/lib/tasks/docker/api.js +30 -0
- package/lib/tasks/docker/containers/container-api.d.ts +128 -0
- package/lib/tasks/docker/containers/container-api.js +153 -0
- package/lib/tasks/docker/containers/index.js +19 -0
- package/lib/tasks/docker/containers/tasks.js +215 -0
- package/lib/tasks/docker/convert-legacy-volumes.js +15 -10
- package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
- package/lib/tasks/docker/image/image-api.d.ts +34 -0
- package/lib/tasks/docker/image/image-api.js +49 -0
- package/lib/tasks/docker/image/index.js +5 -0
- package/lib/tasks/docker/index.js +1 -13
- package/lib/tasks/docker/network/index.js +7 -0
- package/lib/tasks/docker/network/network-api.d.ts +103 -0
- package/lib/tasks/docker/network/network-api.js +99 -0
- package/lib/tasks/docker/{network.js → network/tasks.js} +17 -10
- package/lib/tasks/docker/project-image-builder.js +167 -0
- package/lib/tasks/docker/volume/index.js +8 -0
- package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
- package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
- package/lib/tasks/docker/volume/volume-api.js +66 -0
- package/lib/tasks/execute/index.js +5 -2
- package/lib/tasks/file-system/create-mariadb-config.js +23 -0
- package/lib/tasks/file-system/create-nginx-config.js +2 -3
- package/lib/tasks/file-system/create-php-config.js +20 -5
- package/lib/tasks/file-system/create-php-fpm-config.js +8 -4
- package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +41 -29
- package/lib/tasks/file-system/create-phpstorm-config/index.js +2 -0
- package/lib/tasks/file-system/create-phpstorm-config/keys.js +15 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +4 -1
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-config.js +3 -3
- package/lib/tasks/file-system/create-phpstorm-config/php-config/php-interpreters-config.js +81 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/index.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/php-docker-settings-config.js +9 -0
- package/lib/tasks/file-system/create-phpstorm-config/php-docker-settings-config/setup-php-docker-container-settings-config.js +66 -0
- package/lib/tasks/file-system/create-phpstorm-config/setup-xml-structure.js +11 -9
- package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +2 -1
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +15 -30
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +24 -5
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/mess-detector-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-code-sniffer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-cs-fixer-project-configuration-config.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +15 -15
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +29 -3
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-stan-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +42 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/psalm-project-configuration-config.js.js +50 -0
- package/lib/tasks/file-system/create-phpstorm-config/workspace-config/workspace-config.js +0 -2
- package/lib/tasks/file-system/create-ssl-terminator-config.js +4 -2
- package/lib/tasks/file-system/create-vscode-config.js +57 -42
- package/lib/tasks/file-system/index.js +5 -2
- package/lib/tasks/import-dump.js +6 -6
- package/lib/tasks/link.js +5 -4
- package/lib/tasks/magento/install-magento-project.js +31 -63
- package/lib/tasks/magento/setup-magento/adjust-full-page-cache.js +4 -4
- package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +7 -3
- package/lib/tasks/magento/setup-magento/create-admin.js +5 -6
- package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
- package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
- package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
- package/lib/tasks/magento/setup-magento/disable-2fa.js +3 -5
- package/lib/tasks/magento/setup-magento/disable-maintenance-mode.js +3 -4
- package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
- package/lib/tasks/magento/setup-magento/index.js +2 -0
- package/lib/tasks/magento/setup-magento/install-magento.js +21 -20
- package/lib/tasks/magento/setup-magento/migrate-database.js +7 -14
- package/lib/tasks/magento/setup-magento/set-base-url.js +2 -2
- package/lib/tasks/magento/setup-magento/set-deployment-mode.js +4 -4
- package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
- package/lib/tasks/magento/setup-magento/varnish-config.js +10 -8
- package/lib/tasks/magento/setup-magento/waiting-for-varnish.js +128 -3
- package/lib/tasks/php/php-container.js +108 -0
- package/lib/tasks/php/update-env-php.js +39 -21
- package/lib/tasks/php/update-env.php +66 -61
- package/lib/tasks/php/working_health_check.php +85 -0
- package/lib/tasks/requirements/{composer.js → composer-credentials.js} +3 -1
- package/lib/tasks/requirements/docker/index.js +15 -12
- package/lib/tasks/requirements/docker/performance.js +54 -0
- package/lib/tasks/requirements/docker/version.js +8 -8
- package/lib/tasks/requirements/index.js +5 -8
- package/lib/tasks/requirements/php-version.js +8 -116
- package/lib/tasks/requirements/platform.js +12 -25
- package/lib/tasks/start.js +21 -50
- package/lib/tasks/status/index.js +8 -12
- package/lib/tasks/stop.js +0 -2
- package/lib/tasks/theme/install-theme.js +1 -1
- package/lib/tasks/theme/link-theme.js +2 -2
- package/lib/tasks/theme/symlink-theme.js +2 -3
- package/lib/util/config-file-validator.js +27 -13
- package/lib/util/config-php-json.js +13 -4
- package/lib/util/database.js +7 -7
- package/lib/util/dockerfile-builder/build-instructions.js +197 -0
- package/lib/util/dockerfile-builder/index.js +276 -0
- package/lib/util/dockerfile-builder/types.d.ts +123 -0
- package/lib/util/env-php-json.js +10 -6
- package/lib/util/exec-async-command.js +3 -9
- package/lib/util/macos-version.js +20 -0
- package/lib/util/magento-task.js +3 -4
- package/lib/util/nginx-logs-parser.js +122 -0
- package/lib/util/php-task.js +3 -6
- package/lib/util/run-composer.js +6 -14
- package/lib/util/run-container-image.js +17 -0
- package/lib/util/run-magento.js +6 -14
- package/lib/util/run-php.js +6 -17
- package/package.json +9 -9
- package/typings/context.d.ts +7 -13
- package/typings/index.d.ts +67 -85
- package/yarn-error.log +9660 -0
- package/lib/config/composer.js +0 -11
- package/lib/config/php/extensions/libsodium.js +0 -36
- package/lib/config/php/releases/php-7.2.js +0 -25
- package/lib/config/php/releases/php-7.3.js +0 -25
- package/lib/config/php/releases/php-7.4.js +0 -23
- package/lib/config/php/releases/php-8.1.js +0 -25
- package/lib/config/phpbrew.js +0 -12
- package/lib/tasks/composer/install-prestissimo.js +0 -103
- package/lib/tasks/docker/containers.js +0 -231
- package/lib/tasks/mysql/connect-to-mysql.js +0 -114
- package/lib/tasks/mysql/create-magento-database.js +0 -18
- package/lib/tasks/php/bundled-extensions.js +0 -27
- package/lib/tasks/php/compile-options.js +0 -56
- package/lib/tasks/php/compile.js +0 -55
- package/lib/tasks/php/configure.js +0 -89
- package/lib/tasks/php/extensions/disable.js +0 -49
- package/lib/tasks/php/extensions/enable.js +0 -52
- package/lib/tasks/php/extensions/index.js +0 -80
- package/lib/tasks/php/extensions/install.js +0 -54
- package/lib/tasks/php/index.js +0 -79
- package/lib/tasks/php/install-sodium.js +0 -93
- package/lib/tasks/php/update-phpbrew.js +0 -45
- package/lib/tasks/php/validate-php.js +0 -67
- package/lib/tasks/php-fpm/get-process-id.js +0 -14
- package/lib/tasks/php-fpm/index.js +0 -4
- package/lib/tasks/php-fpm/start-php-fpm.js +0 -49
- package/lib/tasks/php-fpm/stop-php-fpm.js +0 -48
- package/lib/tasks/requirements/phpbrew/index.js +0 -61
- package/lib/tasks/requirements/phpbrew/install.js +0 -159
- package/lib/tasks/requirements/phpbrew/version.js +0 -28
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const { getBrewCommandSync, getBrewBinPathSync } = require('../../util/get-brew-bin-path');
|
|
3
|
-
const { bundledExtensions } = require('./bundled-extensions');
|
|
4
|
-
|
|
5
|
-
const darwinVariants = [
|
|
6
|
-
`openssl=$(${getBrewCommandSync()} --prefix openssl@1.1)`, // ="$(brew --prefix openssl@1.1)"
|
|
7
|
-
`curl=$(${getBrewCommandSync()} --prefix curl)`,
|
|
8
|
-
`intl=$(${getBrewCommandSync()} --prefix icu4c)`,
|
|
9
|
-
`bz2="$(${getBrewCommandSync()} --prefix bzip2)"`
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
const compileOptions = {
|
|
13
|
-
linux: {
|
|
14
|
-
cpuCount: '$(nproc)',
|
|
15
|
-
variants: bundledExtensions.map((ext) => `+${ext}`),
|
|
16
|
-
extraOptions: [
|
|
17
|
-
'--with-freetype-dir=/usr/include/freetype2',
|
|
18
|
-
'--with-openssl=/usr/',
|
|
19
|
-
'--with-gd=shared',
|
|
20
|
-
'--with-jpeg-dir=/usr/',
|
|
21
|
-
'--with-png-dir=/usr/'
|
|
22
|
-
],
|
|
23
|
-
env: {
|
|
24
|
-
CXX: 'g++ -DTRUE=1 -DFALSE=0',
|
|
25
|
-
CC: 'gcc -DTRUE=1 -DFALSE=0'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
darwin: {
|
|
29
|
-
cpuCount: '$(sysctl -n hw.ncpu)',
|
|
30
|
-
variants: bundledExtensions.map((ext) => {
|
|
31
|
-
const darwinVariant = darwinVariants.find((dv) => dv.startsWith(ext));
|
|
32
|
-
if (darwinVariant) {
|
|
33
|
-
return `+${darwinVariant}`;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return `+${ext}`;
|
|
37
|
-
}),
|
|
38
|
-
extraOptions: [
|
|
39
|
-
`--with-zlib-dir=$(${getBrewCommandSync()} --prefix zlib)`,
|
|
40
|
-
`--with-iconv=$(${getBrewCommandSync()} --prefix libiconv)`,
|
|
41
|
-
'--with-gd=shared'
|
|
42
|
-
],
|
|
43
|
-
env: {
|
|
44
|
-
// eslint-disable-next-line max-len
|
|
45
|
-
PKG_CONFIG_PATH: `$PKG_CONFIG_PATH:$(${getBrewCommandSync()} --prefix libxml2)/lib/pkgconfig:$(${getBrewCommandSync()} --prefix icu4c)/lib/pkgconfig:$(${getBrewCommandSync()} --prefix openssl@1.1)/lib/pkgconfig:$(${getBrewCommandSync()} --prefix curl)/lib/pkgconfig:$(${getBrewCommandSync()} --prefix zlib)/lib/pkgconfig`,
|
|
46
|
-
CPATH: `$CPATH:$(${getBrewCommandSync()} --prefix openssl@1.1)/include`,
|
|
47
|
-
CXX: 'g++ -DTRUE=1 -DFALSE=0',
|
|
48
|
-
CC: 'gcc -DTRUE=1 -DFALSE=0',
|
|
49
|
-
LDFLAGS: `$(${getBrewCommandSync()} --prefix openssl@1.1)/lib/libssl.dylib $(${getBrewCommandSync()} --prefix openssl@1.1)/lib/libcrypto.dylib`,
|
|
50
|
-
CFLAGS: '-Wno-implicit-function-declaration', // https://github.com/phpbrew/phpbrew/issues/1222
|
|
51
|
-
PATH: `${getBrewBinPathSync().replace('/brew', '')}:${process.env.PATH}`
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
module.exports = compileOptions;
|
package/lib/tasks/php/compile.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const systeminformation = require('systeminformation');
|
|
2
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
3
|
-
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
4
|
-
const compileOptions = require('./compile-options');
|
|
5
|
-
const UnknownError = require('../../errors/unknown-error');
|
|
6
|
-
const { getPHPForPHPBrewBin } = require('../../util/get-php-for-phpbrew');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const compilePHP = () => ({
|
|
12
|
-
title: 'Compiling PHP',
|
|
13
|
-
task: async ({ config: { php } }, task) => {
|
|
14
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
15
|
-
const platformCompileOptions = compileOptions[process.platform];
|
|
16
|
-
if (process.platform === 'linux') {
|
|
17
|
-
const { distro } = await systeminformation.osInfo();
|
|
18
|
-
if (['Fedora', 'Manjaro'].some((d) => distro.includes(d))) {
|
|
19
|
-
platformCompileOptions.extraOptions.push('--with-libdir=lib64');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
const commandEnv = Object.entries(platformCompileOptions.env || {}).map(([key, value]) => `export ${key}="${value}"`).join(' && ');
|
|
23
|
-
const phpCompileCommand = `${commandEnv ? `${commandEnv} && ` : ''} \
|
|
24
|
-
phpbrew install -j ${platformCompileOptions.cpuCount} ${php.version} ${platformCompileOptions.variants.join(' ')} \
|
|
25
|
-
-- ${platformCompileOptions.extraOptions.join(' ')}`;
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
await execAsyncSpawn(
|
|
29
|
-
phpCompileCommand,
|
|
30
|
-
{
|
|
31
|
-
callback: (t) => {
|
|
32
|
-
task.output = t;
|
|
33
|
-
},
|
|
34
|
-
useRosetta2: true,
|
|
35
|
-
env: phpBinForPHPBrew ? {
|
|
36
|
-
...process.env,
|
|
37
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
38
|
-
} : process.env
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
throw new UnknownError(
|
|
43
|
-
`Failed to compile the required PHP version.
|
|
44
|
-
Tried compiling the PHP version ${ logger.style.misc(php.version) }.
|
|
45
|
-
Use your favorite search engine to resolve the issue.
|
|
46
|
-
See error details in the output below.\n\n${e}`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
options: {
|
|
51
|
-
bottomBar: 10
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
module.exports = compilePHP;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const enableExtension = require('./extensions/enable');
|
|
3
|
-
const installExtension = require('./extensions/install');
|
|
4
|
-
const disableExtension = require('./extensions/disable');
|
|
5
|
-
const {
|
|
6
|
-
getEnabledExtensions,
|
|
7
|
-
getInstalledExtensions,
|
|
8
|
-
getDisabledExtensions
|
|
9
|
-
} = require('./extensions');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
13
|
-
*/
|
|
14
|
-
const configurePHP = () => ({
|
|
15
|
-
title: 'Configuring PHP extensions',
|
|
16
|
-
task: async ({ config, debug }, task) => {
|
|
17
|
-
const { php, php: { disabledExtensions = [] } } = config;
|
|
18
|
-
const enabledExtensions = await getEnabledExtensions(config);
|
|
19
|
-
const installedExtensions = await getInstalledExtensions(config);
|
|
20
|
-
const disabledExtensionsInPHP = await getDisabledExtensions(config);
|
|
21
|
-
|
|
22
|
-
if (!debug && enabledExtensions.xdebug && !disabledExtensions.includes('xdebug')) {
|
|
23
|
-
disabledExtensions.push('xdebug');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** @type {[string, import('../../../typings/index').PHPExtension][]} */
|
|
27
|
-
const missingExtensions = Object.entries(php.extensions)
|
|
28
|
-
.filter(([name, options]) => {
|
|
29
|
-
const extensionName = options.extensionName || name;
|
|
30
|
-
|
|
31
|
-
return !disabledExtensions.includes(extensionName);
|
|
32
|
-
})
|
|
33
|
-
// check if module is not loaded and if it is loaded check installed version
|
|
34
|
-
.filter(([name, options]) => {
|
|
35
|
-
const extensionName = options.extensionName || name;
|
|
36
|
-
if (extensionName === 'xdebug' && !debug) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
if (!enabledExtensions[extensionName]) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (options && options.version && enabledExtensions[extensionName] !== options.version) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return false;
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
/** @type {import('listr2').ListrTask[]} */
|
|
51
|
-
const extensionTasks = [];
|
|
52
|
-
|
|
53
|
-
if (missingExtensions.length > 0) {
|
|
54
|
-
missingExtensions.forEach(([extensionName, extensionOptions]) => {
|
|
55
|
-
if (installedExtensions.includes(extensionName) && disabledExtensionsInPHP.includes(extensionName)) {
|
|
56
|
-
extensionTasks.push(enableExtension(extensionName, extensionOptions));
|
|
57
|
-
} else {
|
|
58
|
-
extensionTasks.push(installExtension(extensionName, extensionOptions));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (disabledExtensions.length > 0) {
|
|
64
|
-
disabledExtensions.forEach((extensionName) => {
|
|
65
|
-
extensionTasks.push(disableExtension(extensionName));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (extensionTasks.length === 0) {
|
|
70
|
-
task.skip();
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return task.newListr(
|
|
75
|
-
extensionTasks,
|
|
76
|
-
{
|
|
77
|
-
concurrent: false,
|
|
78
|
-
rendererOptions: {
|
|
79
|
-
collapse: false
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
},
|
|
84
|
-
options: {
|
|
85
|
-
bottomBar: 10
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
module.exports = configurePHP;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const phpbrewConfig = require('../../../config/phpbrew');
|
|
3
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
4
|
-
const { getPHPForPHPBrewBin } = require('../../../util/get-php-for-phpbrew');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param {String} extensionName
|
|
8
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
9
|
-
*/
|
|
10
|
-
const disableExtension = (extensionName) => ({
|
|
11
|
-
title: `Disabling ${extensionName} extension`,
|
|
12
|
-
task: async (ctx, task) => {
|
|
13
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
14
|
-
const {
|
|
15
|
-
config,
|
|
16
|
-
config: { php }
|
|
17
|
-
} = ctx;
|
|
18
|
-
const extensionOptions = php.extensions[extensionName] || {};
|
|
19
|
-
const { hooks } = extensionOptions;
|
|
20
|
-
if (extensionOptions.disable) {
|
|
21
|
-
await Promise.resolve(extensionOptions.disable(ctx, task));
|
|
22
|
-
} else {
|
|
23
|
-
if (hooks && hooks.preDisable) {
|
|
24
|
-
await Promise.resolve(hooks.preDisable(config));
|
|
25
|
-
}
|
|
26
|
-
await execAsyncSpawn(`source ${phpbrewConfig.bashrcPath} && \
|
|
27
|
-
phpbrew use ${ php.version } && \
|
|
28
|
-
phpbrew ext disable ${ extensionName }`,
|
|
29
|
-
{
|
|
30
|
-
callback: (t) => {
|
|
31
|
-
task.output = t;
|
|
32
|
-
},
|
|
33
|
-
useRosetta2: true,
|
|
34
|
-
env: phpBinForPHPBrew ? {
|
|
35
|
-
...process.env,
|
|
36
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
37
|
-
} : process.env
|
|
38
|
-
});
|
|
39
|
-
if (hooks && hooks.postDisable) {
|
|
40
|
-
await Promise.resolve(hooks.postDisable(config));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
options: {
|
|
45
|
-
bottomBar: 10
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
module.exports = disableExtension;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const phpbrewConfig = require('../../../config/phpbrew');
|
|
3
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
4
|
-
const { getPHPForPHPBrewBin } = require('../../../util/get-php-for-phpbrew');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param {String} extensionName
|
|
8
|
-
* @param {import('../../../../typings/index').PHPExtension} extensionOptions
|
|
9
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const enableExtension = (extensionName, extensionOptions) => ({
|
|
12
|
-
title: `Enabling ${extensionName} extension`,
|
|
13
|
-
task: async (ctx, task) => {
|
|
14
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
15
|
-
const {
|
|
16
|
-
config,
|
|
17
|
-
config: { php }
|
|
18
|
-
} = ctx;
|
|
19
|
-
const { hooks } = extensionOptions;
|
|
20
|
-
|
|
21
|
-
if (extensionOptions.enable) {
|
|
22
|
-
await Promise.resolve(extensionOptions.enable(ctx, task));
|
|
23
|
-
} else {
|
|
24
|
-
if (hooks && hooks.postEnable) {
|
|
25
|
-
await Promise.resolve(hooks.postEnable(config));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
await execAsyncSpawn(`source ${phpbrewConfig.bashrcPath} && \
|
|
29
|
-
phpbrew use ${ php.version } && \
|
|
30
|
-
phpbrew ext enable ${ extensionName }`,
|
|
31
|
-
{
|
|
32
|
-
callback: (t) => {
|
|
33
|
-
task.output = t;
|
|
34
|
-
},
|
|
35
|
-
useRosetta2: true,
|
|
36
|
-
env: phpBinForPHPBrew ? {
|
|
37
|
-
...process.env,
|
|
38
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
39
|
-
} : process.env
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (hooks && hooks.postEnable) {
|
|
43
|
-
await Promise.resolve(hooks.postEnable(config));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
options: {
|
|
48
|
-
bottomBar: 10
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
module.exports = enableExtension;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
5
|
-
const pathExists = require('../../../util/path-exists');
|
|
6
|
-
const phpbrewConfig = require('../../../config/phpbrew');
|
|
7
|
-
const { getPHPForPHPBrewBin } = require('../../../util/get-php-for-phpbrew');
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Get enabled extensions list with versions
|
|
11
|
-
* @param {import('../../../../typings/context').ListrContext['config']} param0
|
|
12
|
-
* @returns {Promise<{[key: string]: string}}>}
|
|
13
|
-
*/
|
|
14
|
-
const getEnabledExtensions = async ({ php }) => {
|
|
15
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
16
|
-
const output = await execAsyncSpawn(
|
|
17
|
-
`${ php.binPath } -c ${php.iniPath} -r 'foreach (get_loaded_extensions() as $extension) echo "$extension:" . phpversion($extension) . "\n";'`,
|
|
18
|
-
{
|
|
19
|
-
useRosetta2: true,
|
|
20
|
-
env: phpBinForPHPBrew ? {
|
|
21
|
-
...process.env,
|
|
22
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
23
|
-
} : process.env
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return output
|
|
28
|
-
.split('\n')
|
|
29
|
-
.map((m) => {
|
|
30
|
-
// eslint-disable-next-line no-unused-vars
|
|
31
|
-
const [_, moduleName, moduleVersion] = m.match(/(.+):(.+)/i);
|
|
32
|
-
|
|
33
|
-
return [moduleName, moduleVersion];
|
|
34
|
-
})
|
|
35
|
-
.reduce((acc, [name, version]) => ({ ...acc, [name]: version }), {});
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get disabled extensions list
|
|
40
|
-
* @param {import('../../../../typings/context').ListrContext['config']} param0
|
|
41
|
-
* @returns {Promise<string[]>}
|
|
42
|
-
*/
|
|
43
|
-
const getDisabledExtensions = async ({ php }) => {
|
|
44
|
-
const extensionsIniDirectory = path.join(phpbrewConfig.phpPath, `php-${php.version}`, 'var', 'db');
|
|
45
|
-
|
|
46
|
-
if (!await pathExists(extensionsIniDirectory)) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const extensionIniList = await fs.promises.readdir(
|
|
51
|
-
extensionsIniDirectory,
|
|
52
|
-
{
|
|
53
|
-
encoding: 'utf-8',
|
|
54
|
-
withFileTypes: true
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return extensionIniList.filter((f) => f.isFile() && f.name.endsWith('.disabled')).map((f) => f.name.replace('.ini.disabled', ''));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Get installed extensions
|
|
63
|
-
* @param {import('../../../../typings/context').ListrContext['config']} param0
|
|
64
|
-
* @returns {Promise<string[]>}
|
|
65
|
-
*/
|
|
66
|
-
const getInstalledExtensions = async ({ php }) => {
|
|
67
|
-
const extensionDirectory = path.join(phpbrewConfig.buildPath, `php-${php.version}`, 'ext');
|
|
68
|
-
|
|
69
|
-
const availableExtensions = await fs.promises.readdir(extensionDirectory, {
|
|
70
|
-
encoding: 'utf-8'
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return availableExtensions;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
module.exports = {
|
|
77
|
-
getEnabledExtensions,
|
|
78
|
-
getDisabledExtensions,
|
|
79
|
-
getInstalledExtensions
|
|
80
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
const phpbrewConfig = require('../../../config/phpbrew');
|
|
3
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
4
|
-
const { getPHPForPHPBrewBin } = require('../../../util/get-php-for-phpbrew');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @param {String} extensionName
|
|
8
|
-
* @param {import('../../../../typings/index').PHPExtension} extensionOptions
|
|
9
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const installExtension = (extensionName, extensionOptions) => ({
|
|
12
|
-
title: `Installing ${extensionName} extension`,
|
|
13
|
-
task: async (ctx, task) => {
|
|
14
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
15
|
-
const {
|
|
16
|
-
config,
|
|
17
|
-
config: { php }
|
|
18
|
-
} = ctx;
|
|
19
|
-
const { hooks } = extensionOptions;
|
|
20
|
-
|
|
21
|
-
if (extensionOptions.install) {
|
|
22
|
-
await Promise.resolve(extensionOptions.install(ctx, task));
|
|
23
|
-
} else {
|
|
24
|
-
const options = ctx.platform === 'darwin' ? extensionOptions.macosOptions : extensionOptions.linuxOptions;
|
|
25
|
-
|
|
26
|
-
if (hooks && hooks.preInstall) {
|
|
27
|
-
await Promise.resolve(hooks.preInstall(config));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await execAsyncSpawn(`source ${phpbrewConfig.bashrcPath} && \
|
|
31
|
-
phpbrew use ${ php.version } && \
|
|
32
|
-
phpbrew ext install ${ extensionName }${ extensionOptions.version ? ` ${extensionOptions.version}` : ''}${ options ? ` -- ${ options }` : ''}`,
|
|
33
|
-
{
|
|
34
|
-
callback: (t) => {
|
|
35
|
-
task.output = t;
|
|
36
|
-
},
|
|
37
|
-
useRosetta2: true,
|
|
38
|
-
env: phpBinForPHPBrew ? {
|
|
39
|
-
...process.env,
|
|
40
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
41
|
-
} : process.env
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
if (hooks && hooks.postInstall) {
|
|
45
|
-
await Promise.resolve(hooks.postInstall(config));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
options: {
|
|
50
|
-
bottomBar: 10
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
module.exports = installExtension;
|
package/lib/tasks/php/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
4
|
-
const pathExists = require('../../util/path-exists');
|
|
5
|
-
const compilePhp = require('./compile');
|
|
6
|
-
const configurePhp = require('./configure');
|
|
7
|
-
const updatePhpBrew = require('./update-phpbrew');
|
|
8
|
-
const phpbrewConfig = require('../../config/phpbrew');
|
|
9
|
-
const UnknownError = require('../../errors/unknown-error');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
13
|
-
*/
|
|
14
|
-
const installPhp = () => ({
|
|
15
|
-
title: 'Installing PHP',
|
|
16
|
-
task: async (ctx, task) => {
|
|
17
|
-
const { config: { php }, recompilePhp } = ctx;
|
|
18
|
-
const phpBinExists = await pathExists(php.binPath);
|
|
19
|
-
|
|
20
|
-
if (phpBinExists && !recompilePhp) {
|
|
21
|
-
task.title = `Using PHP version ${php.version} in project`;
|
|
22
|
-
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
task.title = `Installing PHP ${php.version}`;
|
|
27
|
-
|
|
28
|
-
try {
|
|
29
|
-
const hasPHPVersionDirectory = (
|
|
30
|
-
await Promise.all(
|
|
31
|
-
(
|
|
32
|
-
await fs.promises.readdir(phpbrewConfig.phpPath, {
|
|
33
|
-
encoding: 'utf-8',
|
|
34
|
-
withFileTypes: true
|
|
35
|
-
})
|
|
36
|
-
).map(async (f) => {
|
|
37
|
-
if (!f.isDirectory()) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (f.name !== `php-${php.version}`) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return pathExists(path.join(phpbrewConfig.phpPath, f.name, 'bin', 'php'));
|
|
46
|
-
})
|
|
47
|
-
))
|
|
48
|
-
.includes(true);
|
|
49
|
-
|
|
50
|
-
if (hasPHPVersionDirectory && !recompilePhp) {
|
|
51
|
-
task.skip();
|
|
52
|
-
// eslint-disable-next-line consistent-return
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
} catch (e) {
|
|
56
|
-
throw new UnknownError(
|
|
57
|
-
`Failed to extract the list of installed PHP versions.
|
|
58
|
-
Possibly, you forgot to setup PHPBrew?
|
|
59
|
-
Follow these instruction: ${ logger.style.link('https://phpbrew.github.io/phpbrew/#setting-up') }
|
|
60
|
-
Otherwise, See error details in the output below.\n\n${e}`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line consistent-return
|
|
65
|
-
return task.newListr([
|
|
66
|
-
updatePhpBrew(),
|
|
67
|
-
compilePhp()
|
|
68
|
-
], {
|
|
69
|
-
concurrent: false,
|
|
70
|
-
exitOnError: true
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
module.exports = {
|
|
76
|
-
installPhp,
|
|
77
|
-
compilePhp,
|
|
78
|
-
configurePhp
|
|
79
|
-
};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
4
|
-
const { cmaGlobalConfig } = require('../../config/cma-config');
|
|
5
|
-
const downloadFile = require('../../util/download-file');
|
|
6
|
-
const { execCommandTask } = require('../../util/exec-async-command');
|
|
7
|
-
const { getEnabledExtensions } = require('./extensions');
|
|
8
|
-
|
|
9
|
-
const libsodiumArchiveUrl = 'https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz';
|
|
10
|
-
|
|
11
|
-
const HAS_LIBSODIUM_BEEN_INSTALLED = 'hasLibsodiumBeenInstalled';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
15
|
-
*/
|
|
16
|
-
const installSodiumExtension = () => ({
|
|
17
|
-
skip: async (ctx) => {
|
|
18
|
-
if (ctx.isArmMac) {
|
|
19
|
-
if (cmaGlobalConfig.has(HAS_LIBSODIUM_BEEN_INSTALLED)) {
|
|
20
|
-
const hasLibsodiumBeenInstalled = cmaGlobalConfig.get(HAS_LIBSODIUM_BEEN_INSTALLED);
|
|
21
|
-
return hasLibsodiumBeenInstalled;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return true;
|
|
28
|
-
},
|
|
29
|
-
task: async (ctx, task) => {
|
|
30
|
-
task.title = 'Preparing libsodium to installation';
|
|
31
|
-
const tempDir = os.tmpdir();
|
|
32
|
-
const destination = path.join(tempDir, path.parse(libsodiumArchiveUrl).base);
|
|
33
|
-
const extractedArchivePath = path.join(tempDir, 'libsodium-stable');
|
|
34
|
-
const enabledExtensions = await getEnabledExtensions(ctx.config);
|
|
35
|
-
|
|
36
|
-
if (enabledExtensions.sodium !== undefined) {
|
|
37
|
-
cmaGlobalConfig.set(HAS_LIBSODIUM_BEEN_INSTALLED, true);
|
|
38
|
-
task.skip();
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return task.newListr([
|
|
43
|
-
{
|
|
44
|
-
title: 'Downloading archive',
|
|
45
|
-
task: async () => {
|
|
46
|
-
await downloadFile(libsodiumArchiveUrl, { destination });
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
...execCommandTask(`tar -zxf ${destination}`, {
|
|
51
|
-
cwd: tempDir
|
|
52
|
-
}),
|
|
53
|
-
title: 'Extracting archive'
|
|
54
|
-
},
|
|
55
|
-
execCommandTask('./configure', {
|
|
56
|
-
cwd: extractedArchivePath
|
|
57
|
-
}),
|
|
58
|
-
execCommandTask('make && make check', {
|
|
59
|
-
cwd: extractedArchivePath
|
|
60
|
-
}),
|
|
61
|
-
{
|
|
62
|
-
title: 'Installing...',
|
|
63
|
-
task: async (ctx, task) => {
|
|
64
|
-
task.output = 'Enter your sudo password!';
|
|
65
|
-
task.output = logger.style.command(`>[sudo] password for ${ os.userInfo().username }:`);
|
|
66
|
-
|
|
67
|
-
return task.newListr(
|
|
68
|
-
execCommandTask('sudo make install', {
|
|
69
|
-
callback: (t) => {
|
|
70
|
-
task.output = t;
|
|
71
|
-
},
|
|
72
|
-
pipeInput: true,
|
|
73
|
-
cwd: extractedArchivePath
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
},
|
|
77
|
-
options: {
|
|
78
|
-
bottomBar: 10
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
task: () => {
|
|
83
|
-
cmaGlobalConfig.set(HAS_LIBSODIUM_BEEN_INSTALLED, true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]);
|
|
87
|
-
},
|
|
88
|
-
options: {
|
|
89
|
-
bottomBar: 10
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
module.exports = installSodiumExtension;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const UnknownError = require('../../errors/unknown-error');
|
|
2
|
-
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
3
|
-
const { getPHPForPHPBrewBin } = require('../../util/get-php-for-phpbrew');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
7
|
-
*/
|
|
8
|
-
const updatePhpBrew = () => ({
|
|
9
|
-
title: 'Updating PHPBrew PHP versions',
|
|
10
|
-
task: async ({ config: { php } }, task) => {
|
|
11
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
12
|
-
try {
|
|
13
|
-
const knownPhpVersions = await execAsyncSpawn('phpbrew known', {
|
|
14
|
-
useRosetta2: true,
|
|
15
|
-
env: phpBinForPHPBrew ? {
|
|
16
|
-
...process.env,
|
|
17
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
18
|
-
} : process.env
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (knownPhpVersions.includes(`${php.version}`)) {
|
|
22
|
-
task.skip();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
await execAsyncSpawn('phpbrew known --update', {
|
|
27
|
-
callback: (t) => {
|
|
28
|
-
task.output = t;
|
|
29
|
-
},
|
|
30
|
-
useRosetta2: true,
|
|
31
|
-
env: phpBinForPHPBrew ? {
|
|
32
|
-
...process.env,
|
|
33
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
34
|
-
} : process.env
|
|
35
|
-
});
|
|
36
|
-
} catch (e) {
|
|
37
|
-
throw new UnknownError(`Unexpected error while updating phpbrew known php versions\n\n${e}`);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
options: {
|
|
41
|
-
bottomBar: 10
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
module.exports = updatePhpBrew;
|