@scandipwa/magento-scripts 2.0.0-alpha.0 → 2.0.0-alpha.3

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.
Files changed (79) hide show
  1. package/lib/commands/cli.js +2 -2
  2. package/lib/commands/execute.js +1 -1
  3. package/lib/commands/import-db.js +1 -1
  4. package/lib/commands/logs.js +1 -1
  5. package/lib/commands/start.js +1 -5
  6. package/lib/config/docker.js +41 -46
  7. package/lib/config/index.js +1 -1
  8. package/lib/config/port-config.js +1 -1
  9. package/lib/config/services/elasticsearch/base-repo.js +3 -0
  10. package/lib/config/services/elasticsearch/default-es-env.js +6 -0
  11. package/lib/config/services/elasticsearch/versions/elasticsearch-6.8.js +19 -0
  12. package/lib/config/services/elasticsearch/versions/index.js +5 -0
  13. package/lib/config/templates/magentorc.template +2 -2
  14. package/lib/config/templates/mariadb.template.cnf +191 -0
  15. package/lib/config/versions/magento-2.3.0.js +2 -3
  16. package/lib/config/versions/magento-2.3.1.js +2 -3
  17. package/lib/config/versions/magento-2.3.2-p1.js +2 -3
  18. package/lib/config/versions/magento-2.3.2-p2.js +2 -3
  19. package/lib/config/versions/magento-2.3.2.js +2 -3
  20. package/lib/config/versions/magento-2.3.3-p1.js +2 -3
  21. package/lib/config/versions/magento-2.3.3.js +2 -3
  22. package/lib/config/versions/magento-2.3.4-p1.js +2 -3
  23. package/lib/config/versions/magento-2.3.4-p2.js +2 -3
  24. package/lib/config/versions/magento-2.3.4.js +2 -3
  25. package/lib/tasks/cleanup.js +1 -1
  26. package/lib/tasks/database/connect-to-database.js +117 -0
  27. package/lib/tasks/database/create-magento-database.js +18 -0
  28. package/lib/tasks/{mysql → database}/dump-theme-config.js +3 -3
  29. package/lib/tasks/{mysql → database}/fix-db.js +2 -2
  30. package/lib/tasks/{mysql/import-dump-to-mysql.js → database/import-dump-to-database.js} +20 -20
  31. package/lib/tasks/{mysql → database}/import-remote-db/index.js +0 -0
  32. package/lib/tasks/{mysql/import-remote-db/ssh/mysqldump-command.js → database/import-remote-db/ssh/database-dump-command.js} +2 -2
  33. package/lib/tasks/{mysql → database}/import-remote-db/ssh/index.js +0 -0
  34. package/lib/tasks/{mysql → database}/import-remote-db/ssh/readymage.js +4 -4
  35. package/lib/tasks/{mysql → database}/import-remote-db/ssh/regular-server.js +2 -2
  36. package/lib/tasks/{mysql → database}/index.js +2 -2
  37. package/lib/tasks/{mysql → database}/magento-tables.js +0 -0
  38. package/lib/tasks/{mysql → database}/restore-theme-config.js +4 -4
  39. package/lib/tasks/docker/convert-legacy-volumes.js +8 -7
  40. package/lib/tasks/docker/convert-mysql-to-mariadb.js +284 -0
  41. package/lib/tasks/docker/network/network-api.d.ts +1 -1
  42. package/lib/tasks/docker/project-image-builder.js +1 -1
  43. package/lib/tasks/docker/volume/index.js +8 -0
  44. package/lib/tasks/docker/{volumes.js → volume/tasks.js} +5 -19
  45. package/lib/tasks/docker/volume/volume-api.d.ts +39 -0
  46. package/lib/tasks/docker/volume/volume-api.js +66 -0
  47. package/lib/tasks/execute/index.js +5 -2
  48. package/lib/tasks/file-system/create-mariadb-config.js +23 -0
  49. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-workspace-project-configuration-config.js +1 -1
  50. package/lib/tasks/file-system/index.js +3 -1
  51. package/lib/tasks/import-dump.js +6 -6
  52. package/lib/tasks/link.js +4 -2
  53. package/lib/tasks/magento/install-magento-project.js +1 -1
  54. package/lib/tasks/magento/setup-magento/configure-elasticsearch.js +2 -2
  55. package/lib/tasks/magento/setup-magento/create-admin.js +1 -1
  56. package/lib/tasks/magento/setup-magento/delete-admin-users.js +2 -2
  57. package/lib/tasks/magento/setup-magento/delete-customers.js +4 -4
  58. package/lib/tasks/magento/setup-magento/delete-orders.js +4 -4
  59. package/lib/tasks/magento/setup-magento/increase-admin-session-lifetime.js +2 -2
  60. package/lib/tasks/magento/setup-magento/index.js +2 -0
  61. package/lib/tasks/magento/setup-magento/install-magento.js +12 -12
  62. package/lib/tasks/magento/setup-magento/migrate-database.js +5 -11
  63. package/lib/tasks/magento/setup-magento/set-base-url.js +2 -2
  64. package/lib/tasks/magento/setup-magento/set-url-rewrite.js +2 -2
  65. package/lib/tasks/magento/setup-magento/varnish-config.js +4 -4
  66. package/lib/tasks/php/update-env-php.js +5 -3
  67. package/lib/tasks/php/update-env.php +12 -12
  68. package/lib/tasks/start.js +5 -25
  69. package/lib/tasks/status/index.js +4 -2
  70. package/lib/tasks/theme/link-theme.js +2 -2
  71. package/lib/util/config-file-validator.js +27 -13
  72. package/lib/util/database.js +7 -7
  73. package/lib/util/prefix.js +1 -1
  74. package/package.json +2 -2
  75. package/typings/context.d.ts +5 -5
  76. package/typings/index.d.ts +31 -30
  77. package/yarn-error.log +9660 -0
  78. package/lib/tasks/mysql/connect-to-mysql.js +0 -127
  79. package/lib/tasks/mysql/create-magento-database.js +0 -18
@@ -1,127 +0,0 @@
1
- const mysql2 = require('mysql2/promise');
2
- const UnknownError = require('../../errors/unknown-error');
3
- const { execAsyncSpawn } = require('../../util/exec-async-command');
4
- const sleep = require('../../util/sleep');
5
- const { createMagentoDatabase } = require('./create-magento-database');
6
-
7
- /**
8
- * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
9
- */
10
- const waitForMySQLInitialization = () => ({
11
- title: 'Waiting for MySQL to initialize',
12
- task: async (ctx, task) => {
13
- const { mysql } = ctx.config.docker.getContainers();
14
-
15
- task.title = `Waiting for ${mysql._} to initialize`;
16
-
17
- let mysqlReadyForConnections = false;
18
-
19
- while (!mysqlReadyForConnections) {
20
- const mysqlOutput = await execAsyncSpawn(`docker logs ${mysql.name}`);
21
- if (mysqlOutput.includes('ready for connections')) {
22
- mysqlReadyForConnections = true;
23
- break;
24
- } else if (mysqlOutput.includes('Initializing database files')) {
25
- task.output = `MySQL is initializing database files!
26
- Please wait, this will take some time and do not restart the MySQL container until initialization is finished!`;
27
-
28
- let mysqlFinishedInitialization = false;
29
- while (!mysqlFinishedInitialization) {
30
- const mysqlOutput = await execAsyncSpawn(`docker logs ${mysql.name}`);
31
- if (mysqlOutput.includes('init process done.') && !mysqlFinishedInitialization) {
32
- mysqlFinishedInitialization = true;
33
- break;
34
- }
35
- await sleep(2000);
36
- }
37
- }
38
-
39
- await sleep(2000);
40
- }
41
- },
42
- options: {
43
- bottomBar: 10
44
- }
45
- });
46
-
47
- /**
48
- * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
49
- */
50
- const gettingMySQLConnection = () => ({
51
- title: 'Getting MySQL connection',
52
- task: async (ctx, task) => {
53
- const { config: { docker }, ports } = ctx;
54
- const { mysql } = docker.getContainers(ctx.ports);
55
- let tries = 0;
56
- const maxTries = 20;
57
- const errors = [];
58
-
59
- task.title = `Getting ${mysql._} connection`;
60
-
61
- while (tries < maxTries) {
62
- tries++;
63
- try {
64
- const connection = await mysql2.createConnection({
65
- host: '127.0.0.1',
66
- port: ports.mysql,
67
- user: mysql.env.MYSQL_USER,
68
- password: mysql.env.MYSQL_PASSWORD,
69
- database: mysql.env.MYSQL_DATABASE
70
- });
71
-
72
- ctx.mysqlConnection = connection;
73
- break;
74
- } catch (e) {
75
- errors.push(e);
76
- }
77
- await sleep(1000);
78
- }
79
-
80
- if (tries === maxTries) {
81
- throw new UnknownError(`Unable to connect to MySQL server. Check your server configuration!\n\n${ errors.join(' ') }`);
82
- }
83
-
84
- task.title = 'MySQL server connected!';
85
- }
86
- });
87
-
88
- /**
89
- * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
90
- */
91
- const terminatingExistingConnection = () => ({
92
- title: 'Terminating existing Database connection',
93
- skip: (ctx) => !ctx.mysqlConnection,
94
- task: (ctx) => {
95
- ctx.mysqlConnection.destroy();
96
- }
97
- });
98
-
99
- /**
100
- * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
101
- */
102
- const connectToMySQL = () => ({
103
- title: 'Connecting to MySQL server',
104
- skip: (ctx) => ctx.skipSetup,
105
- task: (ctx, task) => {
106
- const { mysql } = ctx.config.docker.getContainers();
107
-
108
- task.title = `Connecting to ${mysql._} server`;
109
-
110
- return task.newListr([
111
- waitForMySQLInitialization(),
112
- createMagentoDatabase(),
113
- terminatingExistingConnection(),
114
- gettingMySQLConnection()
115
- ], {
116
- concurrent: false,
117
- rendererOptions: {
118
- collapse: true
119
- }
120
- });
121
- },
122
- options: {
123
- bottomBar: 10
124
- }
125
- });
126
-
127
- module.exports = connectToMySQL;
@@ -1,18 +0,0 @@
1
- const { execAsyncSpawn } = require('../../util/exec-async-command');
2
-
3
- /**
4
- * Will create database 'magento' in MySQL if it does not exist for some reason
5
- * @returns {import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
6
- */
7
- const createMagentoDatabase = () => ({
8
- title: 'Creating Magento database in MySQL',
9
- task: async (ctx) => {
10
- const { mysql } = ctx.config.docker.getContainers();
11
-
12
- await execAsyncSpawn(`docker exec ${mysql.name} mysql -umagento -pmagento -h 127.0.0.1 -e "CREATE DATABASE IF NOT EXISTS magento;"`);
13
- }
14
- });
15
-
16
- module.exports = {
17
- createMagentoDatabase
18
- };