@scandipwa/magento-scripts 1.14.1-alpha.4 → 1.14.1-alpha.5
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/config/docker.js +2 -1
- package/lib/config/versions/magento-2.3.0.js +1 -1
- package/lib/config/versions/magento-2.3.1.js +1 -1
- package/lib/config/versions/magento-2.3.2-p2.js +1 -1
- package/lib/config/versions/magento-2.3.2.js +1 -1
- package/lib/config/versions/magento-2.3.3-p1.js +1 -1
- package/lib/config/versions/magento-2.3.3.js +1 -1
- package/lib/config/versions/magento-2.3.4-p2.js +1 -1
- package/lib/config/versions/magento-2.3.4.js +1 -1
- package/lib/config/versions/magento-2.3.5-p1.js +1 -1
- package/lib/config/versions/magento-2.3.5-p2.js +1 -1
- package/lib/config/versions/magento-2.3.5.js +1 -1
- package/lib/config/versions/magento-2.3.6-p1.js +1 -1
- package/lib/config/versions/magento-2.3.6.js +1 -1
- package/lib/config/versions/magento-2.3.7-p1.js +1 -1
- package/lib/config/versions/magento-2.3.7-p2.js +1 -1
- package/lib/config/versions/magento-2.3.7-p3.js +1 -1
- package/lib/config/versions/magento-2.3.7.js +1 -1
- package/lib/config/versions/magento-2.4.0-p1.js +1 -1
- package/lib/config/versions/magento-2.4.0.js +1 -1
- package/lib/config/versions/magento-2.4.1-p1.js +1 -1
- package/lib/config/versions/magento-2.4.1.js +1 -1
- package/lib/config/versions/magento-2.4.2-p1.js +1 -1
- package/lib/config/versions/magento-2.4.2-p2.js +1 -1
- package/lib/config/versions/magento-2.4.2.js +1 -1
- package/lib/config/versions/magento-2.4.3-p1.js +1 -1
- package/lib/config/versions/magento-2.4.3-p2.js +1 -1
- package/lib/config/versions/magento-2.4.3.js +1 -1
- package/lib/tasks/magento/setup-magento/migrate-database.js +3 -5
- package/lib/tasks/magento/setup-magento/upgrade-magento.js +17 -3
- package/lib/tasks/start.js +3 -8
- package/lib/tasks/theme/build-theme.js +26 -8
- package/lib/tasks/theme/install-theme.js +16 -4
- package/lib/tasks/theme/setup-themes.js +1 -0
- package/lib/tasks/theme/symlink-theme.js +18 -3
- package/lib/util/match-filesystem.js +2 -1
- package/package.json +2 -2
- package/typings/context.d.ts +1 -0
package/lib/config/docker.js
CHANGED
|
@@ -79,7 +79,8 @@ module.exports = async ({ configuration, ssl, host }, config) => {
|
|
|
79
79
|
name: `${ prefix }_varnish-vcl-data`,
|
|
80
80
|
opts: {
|
|
81
81
|
type: 'nfs',
|
|
82
|
-
device: `${ path.join(cacheDir, 'varnish', 'default.vcl') }
|
|
82
|
+
device: `${ path.join(cacheDir, 'varnish', 'default.vcl') }`,
|
|
83
|
+
o: 'bind'
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
86
|
}
|
|
@@ -3,7 +3,6 @@ const runMagentoCommand = require('../../../util/run-magento');
|
|
|
3
3
|
const configureElasticsearch = require('./configure-elasticsearch');
|
|
4
4
|
const installMagento = require('./install-magento');
|
|
5
5
|
const upgradeMagento = require('./upgrade-magento');
|
|
6
|
-
const setupPersistedQuery = require('../../theme/setup-persisted-query');
|
|
7
6
|
const varnishConfigSetup = require('./varnish-config');
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -25,6 +24,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
25
24
|
|
|
26
25
|
if (tableCount === 0) {
|
|
27
26
|
if (options.onlyInstallMagento) {
|
|
27
|
+
ctx.isSetupUpgradeNeeded = false;
|
|
28
28
|
return task.newListr(
|
|
29
29
|
installMagento({ isDbEmpty: true })
|
|
30
30
|
);
|
|
@@ -32,7 +32,6 @@ const migrateDatabase = (options = {}) => ({
|
|
|
32
32
|
|
|
33
33
|
return task.newListr([
|
|
34
34
|
installMagento({ isDbEmpty: true }),
|
|
35
|
-
setupPersistedQuery(),
|
|
36
35
|
upgradeMagento(),
|
|
37
36
|
magentoTask('cache:enable'),
|
|
38
37
|
varnishConfigSetup(),
|
|
@@ -53,9 +52,9 @@ const migrateDatabase = (options = {}) => ({
|
|
|
53
52
|
|
|
54
53
|
switch (code) {
|
|
55
54
|
case 0: {
|
|
55
|
+
ctx.isSetupUpgradeNeeded = false;
|
|
56
56
|
// no setup is needed, but still to be sure configure ES
|
|
57
57
|
return task.newListr([
|
|
58
|
-
setupPersistedQuery(),
|
|
59
58
|
varnishConfigSetup(),
|
|
60
59
|
configureElasticsearch()
|
|
61
60
|
], {
|
|
@@ -69,6 +68,7 @@ const migrateDatabase = (options = {}) => ({
|
|
|
69
68
|
}
|
|
70
69
|
case 1: {
|
|
71
70
|
if (options.onlyInstallMagento) {
|
|
71
|
+
ctx.isSetupUpgradeNeeded = false;
|
|
72
72
|
return task.newListr(
|
|
73
73
|
installMagento()
|
|
74
74
|
);
|
|
@@ -76,7 +76,6 @@ const migrateDatabase = (options = {}) => ({
|
|
|
76
76
|
|
|
77
77
|
return task.newListr([
|
|
78
78
|
installMagento(),
|
|
79
|
-
setupPersistedQuery(),
|
|
80
79
|
upgradeMagento(),
|
|
81
80
|
magentoTask('cache:enable'),
|
|
82
81
|
varnishConfigSetup(),
|
|
@@ -92,7 +91,6 @@ const migrateDatabase = (options = {}) => ({
|
|
|
92
91
|
}
|
|
93
92
|
case 2: {
|
|
94
93
|
return task.newListr([
|
|
95
|
-
setupPersistedQuery(),
|
|
96
94
|
varnishConfigSetup(),
|
|
97
95
|
configureElasticsearch(),
|
|
98
96
|
upgradeMagento()
|
|
@@ -4,9 +4,23 @@ const magentoTask = require('../../../util/magento-task');
|
|
|
4
4
|
* @type {() => import('listr2').ListrTask<import('../../../../typings/context').ListrContext>}
|
|
5
5
|
*/
|
|
6
6
|
const upgradeMagento = () => ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
skip: (ctx) => {
|
|
8
|
+
if ('isSetupUpgradeNeeded' in ctx) {
|
|
9
|
+
return !ctx.isSetupUpgradeNeeded;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return false;
|
|
13
|
+
},
|
|
14
|
+
task: (_ctx, task) => task.newListr([
|
|
15
|
+
magentoTask('setup:upgrade --no-interaction'),
|
|
16
|
+
{
|
|
17
|
+
task: (ctx) => {
|
|
18
|
+
ctx.isSetupUpgradeNeeded = false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
], {
|
|
22
|
+
concurrent: false
|
|
23
|
+
})
|
|
10
24
|
});
|
|
11
25
|
|
|
12
26
|
module.exports = upgradeMagento;
|
package/lib/tasks/start.js
CHANGED
|
@@ -126,6 +126,7 @@ const configureProject = () => ({
|
|
|
126
126
|
*/
|
|
127
127
|
const finishProjectConfiguration = () => ({
|
|
128
128
|
title: 'Finishing project configuration',
|
|
129
|
+
skip: ({ skipSetup }) => skipSetup,
|
|
129
130
|
task: (ctx, task) => task.newListr([
|
|
130
131
|
{
|
|
131
132
|
skip: (ctx) => !ctx.importDb,
|
|
@@ -143,16 +144,10 @@ const finishProjectConfiguration = () => ({
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
},
|
|
146
|
-
|
|
147
|
-
title: 'Setting up themes',
|
|
148
|
-
skip: (ctx) => !ctx.magentoFirstInstall,
|
|
149
|
-
task: (subCtx, subTask) => subTask.newListr(
|
|
150
|
-
setupThemes()
|
|
151
|
-
)
|
|
152
|
-
}
|
|
147
|
+
setupThemes()
|
|
153
148
|
], {
|
|
154
149
|
rendererOptions: {
|
|
155
|
-
collapse:
|
|
150
|
+
collapse: false
|
|
156
151
|
}
|
|
157
152
|
})
|
|
158
153
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const pathExists = require('../../util/path-exists');
|
|
3
3
|
const { execAsyncSpawn } = require('../../util/exec-async-command');
|
|
4
|
-
const
|
|
4
|
+
const logger = require('@scandipwa/scandipwa-dev-utils/logger');
|
|
5
|
+
const matchFilesystem = require('../../util/match-filesystem');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @type {(theme: import('../../../typings/theme').Theme) => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
@@ -13,15 +14,32 @@ const buildTheme = ({ themePath }) => ({
|
|
|
13
14
|
|
|
14
15
|
if (!await pathExists(path.join(themePath, 'node_modules'))) {
|
|
15
16
|
task.output = 'Installing theme dependencies';
|
|
16
|
-
await
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const commandToInstallDependencies = await pathExists(path.join(themePath, 'package-lock.json'))
|
|
18
|
+
? 'npm ci'
|
|
19
|
+
: 'npm i';
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
await execAsyncSpawn(commandToInstallDependencies, {
|
|
23
|
+
cwd: path.join(process.cwd(), themePath),
|
|
24
|
+
callback: !verbose ? undefined : (t) => {
|
|
25
|
+
task.output = t;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw new Error(`We were unable to install theme dependencies in ${themePath} using ${logger.style.code(commandToInstallDependencies)} command!
|
|
30
|
+
If you have ${logger.style.file('package-lock.json')} in theme directory make sure it's up to date with ${logger.style.file('package.json')} file content.`);
|
|
31
|
+
}
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
const magentoThemeDirPath = path.join(themePath, 'magento', 'Magento_Theme');
|
|
35
|
+
const isMagentoThemeDirMatching = await matchFilesystem(magentoThemeDirPath, {
|
|
36
|
+
templates: true,
|
|
37
|
+
web: [
|
|
38
|
+
'static'
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (isMagentoThemeDirMatching) {
|
|
25
43
|
task.skip();
|
|
26
44
|
return;
|
|
27
45
|
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const getJsonfileData = require('../../util/get-jsonfile-data');
|
|
1
3
|
const runComposerCommand = require('../../util/run-composer');
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* @type {(theme: import('../../../typings/theme').Theme) => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
5
7
|
*/
|
|
6
|
-
const installTheme = (
|
|
8
|
+
const installTheme = (theme) => ({
|
|
7
9
|
title: 'Installing theme in composer.json',
|
|
8
|
-
task: async (
|
|
10
|
+
task: async (ctx, task) => {
|
|
11
|
+
const { magentoVersion, verbose = false } = ctx;
|
|
12
|
+
const composerJsonData = await getJsonfileData(path.join(process.cwd(), 'composer.json'));
|
|
13
|
+
|
|
14
|
+
if (composerJsonData.require[theme.composerData.name]) {
|
|
15
|
+
task.skip();
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
try {
|
|
10
|
-
await runComposerCommand(`require ${composerData.name}`, {
|
|
20
|
+
await runComposerCommand(`require ${theme.composerData.name}`, {
|
|
11
21
|
magentoVersion,
|
|
12
22
|
callback: !verbose ? undefined : (t) => {
|
|
13
23
|
task.output = t;
|
|
@@ -16,9 +26,11 @@ const installTheme = ({ composerData }) => ({
|
|
|
16
26
|
} catch (e) {
|
|
17
27
|
throw new Error(
|
|
18
28
|
`Unexpected error while installing theme.
|
|
19
|
-
|
|
29
|
+
See ERROR log below.\n\n${e}`
|
|
20
30
|
);
|
|
21
31
|
}
|
|
32
|
+
|
|
33
|
+
ctx.isSetupUpgradeNeeded = true;
|
|
22
34
|
},
|
|
23
35
|
options: {
|
|
24
36
|
bottomBar: 10
|
|
@@ -12,6 +12,7 @@ const buildTheme = require('./build-theme');
|
|
|
12
12
|
* @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
13
13
|
*/
|
|
14
14
|
const setupThemes = () => ({
|
|
15
|
+
title: 'Setting up themes',
|
|
15
16
|
task: async (ctx, task) => {
|
|
16
17
|
const { config: { baseConfig } } = ctx;
|
|
17
18
|
const composerData = await getJsonfileData(path.join(baseConfig.magentoDir, 'composer.json'));
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const getJsonfileData = require('../../util/get-jsonfile-data');
|
|
1
3
|
const runComposerCommand = require('../../util/run-composer');
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* @type {(theme: import('../../../typings/theme').Theme) => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
|
|
5
7
|
*/
|
|
6
|
-
const symlinkTheme = (
|
|
8
|
+
const symlinkTheme = (theme) => ({
|
|
7
9
|
title: 'Setting symbolic link for theme in composer.json',
|
|
8
|
-
task: async (
|
|
10
|
+
task: async (ctx, task) => {
|
|
11
|
+
const { magentoVersion, verbose = false } = ctx;
|
|
12
|
+
const composerJsonData = await getJsonfileData(path.join(process.cwd(), 'composer.json'));
|
|
13
|
+
const repositories = Array.isArray(composerJsonData.repositories)
|
|
14
|
+
? composerJsonData.repositories.reduce((acc, repo, index) => ({ ...acc, [`${index}`]: repo }), {})
|
|
15
|
+
: composerJsonData.repositories;
|
|
16
|
+
|
|
17
|
+
if (Object.values(repositories).some((value) => value.url === theme.themePath)) {
|
|
18
|
+
task.skip();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
try {
|
|
10
|
-
await runComposerCommand(`config repo.scandipwa path ${absoluteThemePath}`, {
|
|
23
|
+
await runComposerCommand(`config repo.scandipwa path ${theme.absoluteThemePath}`, {
|
|
11
24
|
magentoVersion,
|
|
12
25
|
callback: !verbose ? undefined : (t) => {
|
|
13
26
|
task.output = t;
|
|
@@ -19,6 +32,8 @@ const symlinkTheme = ({ absoluteThemePath }) => ({
|
|
|
19
32
|
See ERROR log above.\n\n${e}`
|
|
20
33
|
);
|
|
21
34
|
}
|
|
35
|
+
|
|
36
|
+
ctx.isSetupUpgradeNeeded = true;
|
|
22
37
|
}
|
|
23
38
|
});
|
|
24
39
|
|
|
@@ -13,7 +13,8 @@ const matchFilesystem = async (cwd, structure) => {
|
|
|
13
13
|
.every((value) => value === true);
|
|
14
14
|
|
|
15
15
|
return ok;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
|
+
if (typeof structure === 'object') {
|
|
17
18
|
const ok = (await Promise.all(Object.entries(structure).map(([key, value]) => {
|
|
18
19
|
if (typeof value === 'boolean') {
|
|
19
20
|
return pathExists(path.join(cwd, key));
|
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.14.1-alpha.
|
|
6
|
+
"version": "1.14.1-alpha.5",
|
|
7
7
|
"main": "./index.js",
|
|
8
8
|
"types": "./typings/index.d.ts",
|
|
9
9
|
"license": "OSL-3.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"mysql",
|
|
52
52
|
"scandipwa"
|
|
53
53
|
],
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "91adc2e400b0b00e9160680d04d8c1588d41fae7"
|
|
55
55
|
}
|