@scandipwa/magento-scripts 1.16.0 → 1.16.1

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.
@@ -10,7 +10,6 @@ const setUrlRewrite = require('./set-url-rewrite');
10
10
  const increaseAdminSessionLifetime = require('./increase-admin-session-lifetime');
11
11
  const magentoTask = require('../../../util/magento-task');
12
12
  const urnHighlighter = require('./urn-highlighter');
13
- const waitingForVarnish = require('./waiting-for-varnish');
14
13
  const adjustFullPageCache = require('./adjust-full-page-cache');
15
14
 
16
15
  /**
@@ -50,8 +49,7 @@ const setupMagento = (options = {}) => ({
50
49
  disable2fa(),
51
50
  urnHighlighter(),
52
51
  adjustFullPageCache(),
53
- magentoTask('cache:flush'),
54
- waitingForVarnish()
52
+ magentoTask('cache:flush')
55
53
  ], {
56
54
  concurrent: false,
57
55
  exitOnError: true,
@@ -27,41 +27,47 @@ const installMagento = ({ isDbEmpty = false } = {}) => ({
27
27
  mysqlConnection
28
28
  } = ctx;
29
29
 
30
- const response = await mysqlConnection.query(
31
- 'select * from admin_user where username=\'admin\';'
30
+ const [tableResponse] = await mysqlConnection.query(
31
+ 'SELECT * FROM information_schema.tables WHERE table_schema = \'magento\' AND table_name = \'admin_user\' LIMIT 1;'
32
32
  );
33
33
 
34
- const usersWithUsernameAdmin = response && response.length > 0 && response[0];
35
-
36
- if (usersWithUsernameAdmin && usersWithUsernameAdmin.length > 0) {
37
- const confirmDeleteAdminUsers = await task.prompt({
38
- type: 'Select',
39
- message: `In order to install Magento in database you will need to delete admin user with username ${logger.style.command('admin')}`,
40
- choices: [
41
- {
42
- name: 'delete-all',
43
- message: `Delete all admin users (${logger.style.code('Recommended')})`
44
- },
45
- {
46
- name: 'delete-only-admin',
47
- message: `Delete only admin user with ${logger.style.command('admin')} username`
48
- }
49
- ]
50
- });
34
+ if (tableResponse.length > 0) {
35
+ const response = await mysqlConnection.query(
36
+ 'select * from admin_user where username=\'admin\';'
37
+ );
38
+
39
+ const usersWithUsernameAdmin = response && response.length > 0 && response[0];
40
+
41
+ if (usersWithUsernameAdmin && usersWithUsernameAdmin.length > 0) {
42
+ const confirmDeleteAdminUsers = await task.prompt({
43
+ type: 'Select',
44
+ message: `In order to install Magento in database you will need to delete admin user with username ${logger.style.command('admin')}`,
45
+ choices: [
46
+ {
47
+ name: 'delete-all',
48
+ message: `Delete all admin users (${logger.style.code('Recommended')})`
49
+ },
50
+ {
51
+ name: 'delete-only-admin',
52
+ message: `Delete only admin user with ${logger.style.command('admin')} username`
53
+ }
54
+ ]
55
+ });
51
56
 
52
- await mysqlConnection.query('SET FOREIGN_KEY_CHECKS = 0;');
57
+ await mysqlConnection.query('SET FOREIGN_KEY_CHECKS = 0;');
53
58
 
54
- if (confirmDeleteAdminUsers === 'delete-all') {
55
- await mysqlConnection.query(`
59
+ if (confirmDeleteAdminUsers === 'delete-all') {
60
+ await mysqlConnection.query(`
56
61
  TRUNCATE TABLE admin_user;
57
62
  `);
58
- } else {
59
- await mysqlConnection.query(`
63
+ } else {
64
+ await mysqlConnection.query(`
60
65
  DELETE FROM admin_user WHERE username='admin';
61
66
  `);
62
- }
67
+ }
63
68
 
64
- await mysqlConnection.query('SET FOREIGN_KEY_CHECKS = 1;');
69
+ await mysqlConnection.query('SET FOREIGN_KEY_CHECKS = 1;');
70
+ }
65
71
  }
66
72
 
67
73
  const { mysql: { env } } = docker.getContainers(ports);
@@ -6,7 +6,7 @@ const getIsWsl = require('../../../util/is-wsl');
6
6
  * @returns {import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
7
7
  */
8
8
  const varnishConfigSetup = () => ({
9
- title: 'Varnish setup',
9
+ title: 'Varnish Database setup',
10
10
  task: async (ctx, task) => {
11
11
  const {
12
12
  config: {
@@ -32,6 +32,7 @@ const checkForXDGOpen = require('../util/xdg-open-exists');
32
32
  const { getInstanceMetadata, constants: { WEB_LOCATION_TITLE } } = require('../util/instance-metadata');
33
33
  const validatePHPInstallation = require('./php/validate-php');
34
34
  const installSodiumExtension = require('./php/install-sodium');
35
+ const waitingForVarnish = require('./magento/setup-magento/waiting-for-varnish');
35
36
 
36
37
  /**
37
38
  * @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
@@ -149,7 +150,8 @@ const finishProjectConfiguration = () => ({
149
150
  });
150
151
  }
151
152
  },
152
- setupThemes()
153
+ setupThemes(),
154
+ waitingForVarnish()
153
155
  ], {
154
156
  rendererOptions: {
155
157
  collapse: false
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Scripts and configuration used by CMA.",
4
4
  "homepage": "https://docs.create-magento-app.com/",
5
5
  "repository": "github:scandipwa/create-magento-app",
6
- "version": "1.16.0",
6
+ "version": "1.16.1",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -53,5 +53,5 @@
53
53
  "mysql",
54
54
  "scandipwa"
55
55
  ],
56
- "gitHead": "c070162301e655d6b768449d641736fbaf0ebe4b"
56
+ "gitHead": "ced1b75c1b448ef198a658edf010f53179aaaeb0"
57
57
  }