@scandipwa/magento-scripts 1.15.1 → 1.15.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.
@@ -27,13 +27,13 @@ const adjustComposerJson = async ({
27
27
  const composerData = await getJsonFileData(path.join(baseConfig.magentoDir, 'composer.json'));
28
28
 
29
29
  // fix composer magento repository
30
- if (!composerData.repositories
30
+ if (composerData && (!composerData.repositories
31
31
  || (Array.isArray(composerData.repositories)
32
32
  && !composerData.repositories.some((repo) => repo.type === 'composer' && repo.url.includes('repo.magento.com'))
33
33
  )
34
34
  || (typeof composerData.repositories === 'object'
35
35
  && !Object.values(composerData.repositories).some((repo) => repo.type === 'composer' && repo.url.includes('repo.magento.com')))
36
- ) {
36
+ )) {
37
37
  task.output = 'No Magento repository is set in composer.json! Setting up...';
38
38
  await runComposerCommand('config repo.0 composer https://repo.magento.com', {
39
39
  magentoVersion,
@@ -44,7 +44,7 @@ const adjustComposerJson = async ({
44
44
  }
45
45
 
46
46
  // if composer-root-update-plugin is not installed in composer, install it.
47
- if (!composerData.require['magento/composer-root-update-plugin']) {
47
+ if (composerData && !composerData.require['magento/composer-root-update-plugin']) {
48
48
  task.output = 'Installing magento/composer-root-update-plugin!';
49
49
  await runComposerCommand('require magento/composer-root-update-plugin:^1',
50
50
  {
@@ -56,8 +56,8 @@ const adjustComposerJson = async ({
56
56
  }
57
57
 
58
58
  // if for some reason both editions are installed, throw an error
59
- if (
60
- composerData.require[magentoProductCommunityEdition]
59
+ if (composerData
60
+ && composerData.require[magentoProductCommunityEdition]
61
61
  && composerData.require[magentoProductEnterpriseEdition]
62
62
  ) {
63
63
  throw new KnownError('Somehow, both Magento editions are installed!\nPlease choose only one edition an modify your composer.json manually!');
@@ -67,7 +67,7 @@ const adjustComposerJson = async ({
67
67
  .find((edition) => edition !== magentoProductSelectedEdition);
68
68
 
69
69
  // if opposite edition is installed than selected in config file, throw an error
70
- if (composerData.require[oppositeEdition]) {
70
+ if (composerData && composerData.require[oppositeEdition]) {
71
71
  throw new KnownError(`You have installed ${oppositeEdition} but selected magento.edition as ${magentoEdition} in config file!
72
72
 
73
73
  Change magento edition in config file or manually reinstall correct magento edition!`);
@@ -75,7 +75,7 @@ Change magento edition in config file or manually reinstall correct magento edit
75
75
 
76
76
  // if magento package is not installed in composer, require it.
77
77
 
78
- if (!composerData.require[magentoProductSelectedEdition]) {
78
+ if (composerData && !composerData.require[magentoProductSelectedEdition]) {
79
79
  task.output = `Installing ${magentoProductSelectedEdition}=${magentoPackageVersion}!`;
80
80
  await runComposerCommand(`require ${magentoProductSelectedEdition}:${magentoPackageVersion}`,
81
81
  {
@@ -170,7 +170,7 @@ const installMagento = () => ({
170
170
  task.title = `Installing Magento ${magentoPackageVersion}`;
171
171
  task.output = 'Creating Magento project';
172
172
 
173
- if (!await pathExists(path.join(baseConfig.magentoDir, 'composer.json'))) {
173
+ if (!await pathExists(path.join(process.cwd(), 'composer.json'))) {
174
174
  await createMagentoProject({
175
175
  magentoProject,
176
176
  magentoPackageVersion,
@@ -6,7 +6,7 @@ const getCSAThemes = async ({ cwd = process.cwd() } = {}) => {
6
6
  path.join(cwd, 'composer.json')
7
7
  );
8
8
 
9
- if (!composerData.repositories) {
9
+ if (!composerData || !composerData.repositories) {
10
10
  return [];
11
11
  }
12
12
 
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.15.1",
6
+ "version": "1.15.2",
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": "ba6f9e613e4448cf449c6e82f8d95ff546de2294"
56
+ "gitHead": "6ddbd68e15d1868386f559f7edd6610dbc80a8e4"
57
57
  }