@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,67 +0,0 @@
|
|
|
1
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
-
const { bundledExtensions } = require('./bundled-extensions');
|
|
3
|
-
const configurePHP = require('./configure');
|
|
4
|
-
const { getEnabledExtensions } = require('./extensions');
|
|
5
|
-
const { installPhp } = require('./index');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
9
|
-
*/
|
|
10
|
-
const validatePHPInstallation = () => ({
|
|
11
|
-
title: 'Validating PHP installation',
|
|
12
|
-
task: async (ctx, task) => {
|
|
13
|
-
const enabledExtensions = await getEnabledExtensions(ctx.config);
|
|
14
|
-
const enabledExtensionsKeys = Object.keys(enabledExtensions);
|
|
15
|
-
|
|
16
|
-
enabledExtensionsKeys.push('fpm');
|
|
17
|
-
|
|
18
|
-
if (enabledExtensionsKeys.some((ext) => ext.includes('mysql'))) {
|
|
19
|
-
enabledExtensionsKeys.push('mysql');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const missingBundledExtensions = bundledExtensions.filter(
|
|
23
|
-
(ext) => !enabledExtensionsKeys.some(
|
|
24
|
-
(ex) => ex.toLowerCase() === ext.toLowerCase()
|
|
25
|
-
)
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
if (missingBundledExtensions.length > 0) {
|
|
29
|
-
const selectedOption = await task.prompt({
|
|
30
|
-
type: 'Select',
|
|
31
|
-
message: `Your PHP version compiled by PHPBrew is missing important extensions that are bundled by default by ${logger.style.misc('magento-scripts')}
|
|
32
|
-
Maybe you ran PHPBrew by yourself?
|
|
33
|
-
|
|
34
|
-
Please, consider recompiling PHP using ${logger.style.misc('magento-scripts')}.
|
|
35
|
-
|
|
36
|
-
${logger.style.command('npm start -- --recompile-php')}
|
|
37
|
-
`,
|
|
38
|
-
choices: [
|
|
39
|
-
{
|
|
40
|
-
name: 'recompile-php',
|
|
41
|
-
message: `I want ${logger.style.misc('magento-scripts')} to recompile PHP`
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'skip',
|
|
45
|
-
message: 'I am sure that it is okay and want to continue with this setup'
|
|
46
|
-
}
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
if (selectedOption === 'skip') {
|
|
51
|
-
task.skip('User skipped PHP recompilation');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
ctx.recompilePhp = true;
|
|
56
|
-
|
|
57
|
-
return task.newListr([
|
|
58
|
-
installPhp(),
|
|
59
|
-
configurePHP()
|
|
60
|
-
], {
|
|
61
|
-
concurrent: false
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
module.exports = validatePHPInstallation;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const pathExists = require('../../util/path-exists');
|
|
3
|
-
|
|
4
|
-
const getProcessId = async (fpmPidFilePath) => {
|
|
5
|
-
const pidExists = await pathExists(fpmPidFilePath);
|
|
6
|
-
|
|
7
|
-
if (pidExists) {
|
|
8
|
-
return fs.promises.readFile(fpmPidFilePath, 'utf-8');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return null;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
module.exports = getProcessId;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
2
|
-
const getPhpConfig = require('../../config/php-config');
|
|
3
|
-
const { getBaseConfig } = require('../../config/index');
|
|
4
|
-
const getProcessId = require('./get-process-id');
|
|
5
|
-
const UnknownError = require('../../errors/unknown-error');
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
9
|
-
*/
|
|
10
|
-
const startPhpFpm = () => ({
|
|
11
|
-
title: 'Starting PHP-FPM',
|
|
12
|
-
task: async ({ config: { overridenConfiguration }, projectPath }, task) => {
|
|
13
|
-
const php = getPhpConfig(overridenConfiguration.configuration, getBaseConfig(projectPath));
|
|
14
|
-
const processId = await getProcessId(php.fpmPidFilePath);
|
|
15
|
-
if (processId) {
|
|
16
|
-
task.skip();
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const phpIniPathArg = `--php-ini ${php.iniPath}`;
|
|
20
|
-
const phpFpmConfPathArg = `--fpm-config ${php.fpmConfPath}`;
|
|
21
|
-
const phpFpmPidFilePathArg = `--pid ${php.fpmPidFilePath}`;
|
|
22
|
-
|
|
23
|
-
const command = [
|
|
24
|
-
phpIniPathArg,
|
|
25
|
-
phpFpmConfPathArg,
|
|
26
|
-
phpFpmPidFilePathArg
|
|
27
|
-
].filter(Boolean);
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
await execAsyncSpawn(
|
|
31
|
-
`${php.fpmBinPath} ${command.join(' ')} "$@"`,
|
|
32
|
-
{
|
|
33
|
-
callback: (t) => {
|
|
34
|
-
task.output = t;
|
|
35
|
-
},
|
|
36
|
-
useRosetta2: true
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
throw new UnknownError(`Error during PHP-FPM start\n\n${e}`);
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
options: {
|
|
44
|
-
bottomBar: 5,
|
|
45
|
-
showTimer: false
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
module.exports = startPhpFpm;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
3
|
-
const pathExists = require('../../util/path-exists');
|
|
4
|
-
const getPhpConfig = require('../../config/php-config');
|
|
5
|
-
const { getBaseConfig } = require('../../config/index');
|
|
6
|
-
const getProcessId = require('./get-process-id');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const stopPhpFpmTask = () => ({
|
|
12
|
-
title: 'Stopping PHP-FPM',
|
|
13
|
-
task: async ({ config: { overridenConfiguration }, projectPath }, task) => {
|
|
14
|
-
const php = getPhpConfig(overridenConfiguration.configuration, getBaseConfig(projectPath));
|
|
15
|
-
const processId = await getProcessId(php.fpmPidFilePath);
|
|
16
|
-
if (!processId) {
|
|
17
|
-
task.skip();
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
await execAsyncSpawn(`kill ${processId}`);
|
|
22
|
-
} catch (e) {
|
|
23
|
-
if (e.toLowerCase().includes('no such process')) {
|
|
24
|
-
try {
|
|
25
|
-
await fs.promises.unlink(php.fpmPidFilePath);
|
|
26
|
-
} catch (e) {
|
|
27
|
-
//
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (await pathExists(php.fpmPidFilePath)) {
|
|
35
|
-
try {
|
|
36
|
-
await fs.promises.unlink(php.fpmPidFilePath);
|
|
37
|
-
} catch (e) {
|
|
38
|
-
//
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
options: {
|
|
43
|
-
bottomBar: 10,
|
|
44
|
-
showTimer: false
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
module.exports = stopPhpFpmTask;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
2
|
-
const KnownError = require('../../../errors/known-error');
|
|
3
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
4
|
-
const { getPHPForPHPBrewBin } = require('../../../util/get-php-for-phpbrew');
|
|
5
|
-
const installPHPBrew = require('./install');
|
|
6
|
-
const getPHPBrewVersion = require('./version');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const checkPHPBrew = () => ({
|
|
12
|
-
title: 'Checking phpbrew',
|
|
13
|
-
task: async (ctx, task) => {
|
|
14
|
-
const phpBinForPHPBrew = await getPHPForPHPBrewBin();
|
|
15
|
-
const { code } = await execAsyncSpawn('phpbrew --version', {
|
|
16
|
-
withCode: true,
|
|
17
|
-
env: phpBinForPHPBrew ? {
|
|
18
|
-
...process.env,
|
|
19
|
-
PATH: `${phpBinForPHPBrew}:${process.env.PATH}`
|
|
20
|
-
} : process.env
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (code !== 0) {
|
|
24
|
-
const automaticallyInstallPHPBrew = await task.prompt({
|
|
25
|
-
type: 'Confirm',
|
|
26
|
-
message: `You don't have PHPBrew installed!
|
|
27
|
-
Do you want to install it automatically?`
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
if (automaticallyInstallPHPBrew) {
|
|
31
|
-
return task.newListr([
|
|
32
|
-
installPHPBrew(),
|
|
33
|
-
getPHPBrewVersion(),
|
|
34
|
-
{
|
|
35
|
-
task: (ctx) => {
|
|
36
|
-
task.title = `Using PHPBrew version ${ctx.PHPBrewVersion}`;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
throw new KnownError(
|
|
43
|
-
`To install PHPBrew, you must first make sure the requirements are met.
|
|
44
|
-
The requirements are available here: ${ logger.style.link('https://github.com/phpbrew/phpbrew/wiki/Requirement') }.
|
|
45
|
-
Then, you can follow the installation instruction, here: ${ logger.style.link('https://phpbrew.github.io/phpbrew/#installation') }.
|
|
46
|
-
When completed, try running this script again.`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return task.newListr([
|
|
51
|
-
getPHPBrewVersion(),
|
|
52
|
-
{
|
|
53
|
-
task: (ctx) => {
|
|
54
|
-
task.title = `Using PHPBrew version ${ctx.PHPBrewVersion}`;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
module.exports = checkPHPBrew;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
const os = require('os');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
5
|
-
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
6
|
-
const KnownError = require('../../../errors/known-error');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
10
|
-
*/
|
|
11
|
-
const installXcode = () => ({
|
|
12
|
-
title: 'Installing XCode',
|
|
13
|
-
task: async (ctx, task) => {
|
|
14
|
-
const { code: XCODEInstallCode } = await execAsyncSpawn('xcode-select -p 1>/dev/null;echo $?', {
|
|
15
|
-
throwNonZeroCode: false,
|
|
16
|
-
withCode: true
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
if (XCODEInstallCode !== 0) {
|
|
20
|
-
return task.newListr({
|
|
21
|
-
task: async (subCtx, subTask) => {
|
|
22
|
-
await execAsyncSpawn('xcode-select --install', {
|
|
23
|
-
pipeInput: true,
|
|
24
|
-
callback: (t) => {
|
|
25
|
-
subTask.output = t;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
options: {
|
|
30
|
-
bottomBar: 10
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
task.skip();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
41
|
-
*/
|
|
42
|
-
const installPHPBrewBinary = () => ({
|
|
43
|
-
title: 'Installing PHPBrew binary',
|
|
44
|
-
task: async (ctx, task) => {
|
|
45
|
-
task.output = 'Downloading PHPbrew binary...';
|
|
46
|
-
await execAsyncSpawn('curl -L -O https://github.com/phpbrew/phpbrew/releases/latest/download/phpbrew.phar', {
|
|
47
|
-
throwNonZeroCode: true
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
task.output = 'Making PHPbrew binary executable...';
|
|
51
|
-
await execAsyncSpawn('chmod +x phpbrew.phar', {
|
|
52
|
-
throwNonZeroCode: true
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
task.output = 'Moving PHPbrew binary to /url/local/bin directory...';
|
|
56
|
-
task.output = 'Enter your sudo password:';
|
|
57
|
-
await execAsyncSpawn('sudo mv phpbrew.phar /usr/local/bin/phpbrew', {
|
|
58
|
-
throwNonZeroCode: true,
|
|
59
|
-
pipeInput: true
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
task.output = 'Initializing PHPbrew...';
|
|
63
|
-
await execAsyncSpawn('phpbrew init', {
|
|
64
|
-
throwNonZeroCode: true
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
options: {
|
|
68
|
-
bottomBar: 10
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
/**
|
|
72
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
73
|
-
*/
|
|
74
|
-
const addPHPBrewInitiatorLineToConfigFile = () => ({
|
|
75
|
-
task: async (ctx, task) => {
|
|
76
|
-
const shellName = process.env.SHELL.split('/').pop();
|
|
77
|
-
|
|
78
|
-
const shellConfigFileName = `.${shellName}rc`;
|
|
79
|
-
|
|
80
|
-
const addLineToShellConfigFIle = await task.prompt({
|
|
81
|
-
type: 'Select',
|
|
82
|
-
message: `To finish configuring PHPBrew we need to add ${logger.style.code('[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc')} line to your ${ shellConfigFileName } file.
|
|
83
|
-
Do you want to do it now?`,
|
|
84
|
-
choices: [{
|
|
85
|
-
name: 'yes',
|
|
86
|
-
message: 'Yeah, thanks'
|
|
87
|
-
}, {
|
|
88
|
-
name: 'no',
|
|
89
|
-
message: 'No, I will deal with this myself'
|
|
90
|
-
}]
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (addLineToShellConfigFIle === 'no') {
|
|
94
|
-
task.skip();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (shellName === 'zsh') {
|
|
99
|
-
await fs.promises.appendFile(
|
|
100
|
-
path.join(os.homedir(), '.zshrc'),
|
|
101
|
-
'\n[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc\n'
|
|
102
|
-
);
|
|
103
|
-
} else if (shellName === 'bash') {
|
|
104
|
-
await fs.promises.appendFile(
|
|
105
|
-
path.join(os.homedir(), '.bashrc'),
|
|
106
|
-
'\n[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc\n'
|
|
107
|
-
);
|
|
108
|
-
} else {
|
|
109
|
-
const continueInstall = await task.prompt({
|
|
110
|
-
type: 'Select',
|
|
111
|
-
message: `Unfortunately we cannot automatically add necessary configuration for your shell ${process.env.SHELL}!
|
|
112
|
-
You will need to that manually!
|
|
113
|
-
|
|
114
|
-
Add following string to your shells configuration file: ${logger.style.code('[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc')}
|
|
115
|
-
|
|
116
|
-
When you ready, press Enter and installation will continue.`,
|
|
117
|
-
choices: [
|
|
118
|
-
{
|
|
119
|
-
name: 'yes',
|
|
120
|
-
message: 'YES'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
name: 'no',
|
|
124
|
-
message: 'Exit installation'
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
if (continueInstall === 'no') {
|
|
130
|
-
throw new KnownError(`Add following string to your shells configuration file: ${logger.style.code('[[ -e ~/.phpbrew/bashrc ]] && source ~/.phpbrew/bashrc')}
|
|
131
|
-
|
|
132
|
-
Then you can continue installation.`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
140
|
-
*/
|
|
141
|
-
const installPHPBrew = () => ({
|
|
142
|
-
title: 'Installing PHPBrew',
|
|
143
|
-
task: async (ctx, task) => {
|
|
144
|
-
if (process.platform === 'darwin') {
|
|
145
|
-
return task.newListr([
|
|
146
|
-
installXcode(),
|
|
147
|
-
installPHPBrewBinary(),
|
|
148
|
-
addPHPBrewInitiatorLineToConfigFile()
|
|
149
|
-
]);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return task.newListr([
|
|
153
|
-
installPHPBrewBinary(),
|
|
154
|
-
addPHPBrewInitiatorLineToConfigFile()
|
|
155
|
-
]);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
module.exports = installPHPBrew;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const UnknownError = require('../../../errors/unknown-error');
|
|
2
|
-
const { execAsyncSpawn } = require('../../../util/exec-async-command');
|
|
3
|
-
const safeRegexExtract = require('../../../util/safe-regex-extract');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
7
|
-
*/
|
|
8
|
-
const getPHPBrewVersion = () => ({
|
|
9
|
-
task: async (ctx) => {
|
|
10
|
-
const { result, code } = await execAsyncSpawn('phpbrew --version', {
|
|
11
|
-
withCode: true
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
if (code === 0) {
|
|
15
|
-
const PHPBrewVersion = safeRegexExtract({
|
|
16
|
-
string: result,
|
|
17
|
-
regex: /phpbrew - ([\d.]+)/i,
|
|
18
|
-
onNoMatch: () => {
|
|
19
|
-
throw new UnknownError(`No phpbrew version found in phpbrew version output!\n\n${result}`);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
ctx.PHPBrewVersion = PHPBrewVersion;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
module.exports = getPHPBrewVersion;
|