@scandipwa/magento-scripts 1.13.3 → 1.13.4
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/start.js +4 -1
- package/lib/tasks/magento/enable-magento-composer-plugins.js +3 -3
- package/lib/tasks/magento/setup-magento/install-magento.js +6 -3
- package/lib/tasks/magento/setup-magento/migrate-database.js +2 -4
- package/lib/tasks/mysql/connect-to-mysql.js +1 -0
- package/lib/tasks/start.js +17 -1
- package/lib/util/open-browser.js +2 -1
- package/lib/util/xdg-open-exists.js +27 -0
- package/package.json +2 -2
package/lib/commands/start.js
CHANGED
|
@@ -132,7 +132,10 @@ module.exports = (yargs) => {
|
|
|
132
132
|
|
|
133
133
|
block.log();
|
|
134
134
|
|
|
135
|
-
logger.note(
|
|
135
|
+
logger.note(
|
|
136
|
+
`MySQL credentials, containers status and project information available in ${logger.style.code('npm run status')} command.
|
|
137
|
+
To access Magento CLI, Composer and PHP for this project use ${logger.style.code('npm run cli')} command.`
|
|
138
|
+
);
|
|
136
139
|
logger.log('');
|
|
137
140
|
|
|
138
141
|
if (!analytics) {
|
|
@@ -81,7 +81,7 @@ const enableMagentoComposerPlugins = () => ({
|
|
|
81
81
|
const {
|
|
82
82
|
config: {
|
|
83
83
|
'allow-plugins': allowPlugins = {}
|
|
84
|
-
}
|
|
84
|
+
} = {}
|
|
85
85
|
} = composerJsonData;
|
|
86
86
|
const allowPluginsKeys = Object.keys(allowPlugins);
|
|
87
87
|
|
|
@@ -110,7 +110,7 @@ Do you want to enable them all or disable some of them?`,
|
|
|
110
110
|
|
|
111
111
|
if (userConfirmation) {
|
|
112
112
|
composerJsonData.config = {
|
|
113
|
-
...composerJsonData.config,
|
|
113
|
+
...(composerJsonData.config || {}),
|
|
114
114
|
'allow-plugins': {
|
|
115
115
|
...allowPlugins,
|
|
116
116
|
...missingPlugins.reduce((acc, val) => ({ ...acc, [val]: true }), {})
|
|
@@ -141,7 +141,7 @@ Do you want to enable them all or disable some of them?`,
|
|
|
141
141
|
const disabledPlugins = composerPlugins.filter((p) => !userEnabledPlugins.includes(p));
|
|
142
142
|
|
|
143
143
|
composerJsonData.config = {
|
|
144
|
-
...composerJsonData.config,
|
|
144
|
+
...(composerJsonData.config || {}),
|
|
145
145
|
'allow-plugins': {
|
|
146
146
|
...allowPlugins,
|
|
147
147
|
...disabledPlugins.reduce((acc, val) => ({ ...acc, [val]: false }), {}),
|
|
@@ -2,11 +2,14 @@ const semver = require('semver');
|
|
|
2
2
|
const runMagentoCommand = require('../../../util/run-magento');
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
|
+
* @type {({ isDbEmpty }: { isDbEmpty: boolean }) => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
6
6
|
*/
|
|
7
|
-
const installMagento = () => ({
|
|
8
|
-
title: 'Installing magento
|
|
7
|
+
const installMagento = ({ isDbEmpty = false } = {}) => ({
|
|
8
|
+
title: 'Installing magento',
|
|
9
9
|
task: async (ctx, task) => {
|
|
10
|
+
if (isDbEmpty) {
|
|
11
|
+
task.output = 'No Magento is installed in DB!\nInstalling...';
|
|
12
|
+
}
|
|
10
13
|
const {
|
|
11
14
|
magentoVersion,
|
|
12
15
|
config: {
|
|
@@ -24,16 +24,14 @@ const migrateDatabase = (options = {}) => ({
|
|
|
24
24
|
`);
|
|
25
25
|
|
|
26
26
|
if (tableCount === 0) {
|
|
27
|
-
task.output = 'No Magento is installed in DB!\nInstalling...';
|
|
28
|
-
|
|
29
27
|
if (options.onlyInstallMagento) {
|
|
30
28
|
return task.newListr(
|
|
31
|
-
installMagento()
|
|
29
|
+
installMagento({ isDbEmpty: true })
|
|
32
30
|
);
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
return task.newListr([
|
|
36
|
-
installMagento(),
|
|
34
|
+
installMagento({ isDbEmpty: true }),
|
|
37
35
|
setupPersistedQuery(),
|
|
38
36
|
upgradeMagento(),
|
|
39
37
|
magentoTask('cache:enable'),
|
|
@@ -7,6 +7,7 @@ const sleep = require('../../util/sleep');
|
|
|
7
7
|
*/
|
|
8
8
|
const connectToMySQL = () => ({
|
|
9
9
|
title: 'Connecting to MySQL server...',
|
|
10
|
+
skip: (ctx) => ctx.skipSetup,
|
|
10
11
|
task: async (ctx, task) => {
|
|
11
12
|
const { config: { docker }, ports } = ctx;
|
|
12
13
|
const { mysql: { env, name } } = docker.getContainers();
|
package/lib/tasks/start.js
CHANGED
|
@@ -27,6 +27,8 @@ const pkg = require('../../package.json');
|
|
|
27
27
|
const checkConfigurationFile = require('../config/check-configuration-file');
|
|
28
28
|
const convertLegacyVolumes = require('./docker/convert-legacy-volumes');
|
|
29
29
|
const enableMagentoComposerPlugins = require('./magento/enable-magento-composer-plugins');
|
|
30
|
+
const getIsWsl = require('../util/is-wsl');
|
|
31
|
+
const checkForXDGOpen = require('../util/xdg-open-exists');
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
|
|
@@ -172,7 +174,21 @@ const start = () => ({
|
|
|
172
174
|
finishProjectConfiguration(),
|
|
173
175
|
{
|
|
174
176
|
title: 'Opening browser',
|
|
175
|
-
skip: (ctx) =>
|
|
177
|
+
skip: async (ctx) => {
|
|
178
|
+
if (ctx.noOpen) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (await getIsWsl()) {
|
|
183
|
+
const canOpenBrowser = await checkForXDGOpen();
|
|
184
|
+
|
|
185
|
+
if (!canOpenBrowser) {
|
|
186
|
+
return 'Cannot open the browser, xdg-open is not available.';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return false;
|
|
191
|
+
},
|
|
176
192
|
task: ({ ports, config: { overridenConfiguration: { host, ssl } } }) => {
|
|
177
193
|
openBrowser(`${ssl.enabled ? 'https' : 'http'}://${host}${ssl.enabled || ports.app === 80 ? '' : `:${ports.app}`}/`);
|
|
178
194
|
},
|
package/lib/util/open-browser.js
CHANGED
|
@@ -2,7 +2,8 @@ const { execAsync } = require('./exec-async-command');
|
|
|
2
2
|
|
|
3
3
|
const openBrowser = async (url) => {
|
|
4
4
|
const start = process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
await execAsync(`${ start } ${ url }`);
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
module.exports = openBrowser;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const pathExists = require('./path-exists');
|
|
3
|
+
|
|
4
|
+
const checkForXDGOpen = async () => {
|
|
5
|
+
const pathParts = process.env.PATH.split(':');
|
|
6
|
+
|
|
7
|
+
const results = await Promise.all(
|
|
8
|
+
pathParts.map(
|
|
9
|
+
async (pathPart) => {
|
|
10
|
+
if (!await pathExists(pathPart)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const files = await fs.promises.readdir(pathPart, {
|
|
15
|
+
encoding: 'utf-8',
|
|
16
|
+
withFileTypes: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return files.some((file) => file.isFile() && file.name === 'xdg-open');
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return results.includes(true);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
module.exports = checkForXDGOpen;
|
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.13.
|
|
6
|
+
"version": "1.13.4",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "fa0d2c77e7d3a8c639cbebeef05b1322b20895f4"
|
|
46
46
|
}
|