@scandipwa/magento-scripts 2.0.0-alpha.19 → 2.0.0-alpha.20

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.
@@ -70,7 +70,7 @@ const executeTask = async (argv) => {
70
70
  const result = await executeInContainer({
71
71
  containerName: container.name,
72
72
  commands: argv.commands,
73
- isDockerDesktop: ctx.isDockerDesktop
73
+ user: container.user
74
74
  });
75
75
 
76
76
  return result;
@@ -26,11 +26,21 @@ const mustBeIncludedPaths = [
26
26
  /**
27
27
  * Will retrieve project config file path from module.xml
28
28
  *
29
- * @returns {Promise<String>}
29
+ * @returns {Promise<String | null>}
30
30
  */
31
31
  const getProjectConfigFilePath = async () => {
32
32
  const modulesConfigData = await loadXmlFile(pathToModulesConfig);
33
- return modulesConfigData.project.component.modules.module['@_filepath'].replace('$PROJECT_DIR$', process.cwd());
33
+ const {
34
+ project: {
35
+ component: {
36
+ modules: {
37
+ module
38
+ } = {}
39
+ } = {}
40
+ } = {}
41
+ } = modulesConfigData || {};
42
+ const filePath = module && module['@_filepath'];
43
+ return filePath ? filePath.replace('$PROJECT_DIR$', process.cwd()) : null;
34
44
  };
35
45
 
36
46
  const setupDefaultsForExcludedFoldersConfig = (projectConfigData) => {
@@ -138,7 +148,7 @@ const setupExcludedFoldersConfig = () => ({
138
148
  task: async (ctx, task) => {
139
149
  if (await pathExists(pathToModulesConfig)) {
140
150
  const projectFilePath = await getProjectConfigFilePath();
141
- if (await pathExists(projectFilePath)) {
151
+ if (projectFilePath && await pathExists(projectFilePath)) {
142
152
  const projectConfigData = await loadXmlFile(projectFilePath);
143
153
  setupDefaultsForExcludedFoldersConfig(projectConfigData);
144
154
  const hasChanges = setupExcludedFolders(projectConfigData);
@@ -1,3 +1,4 @@
1
+ const logger = require('@scandipwa/scandipwa-dev-utils/logger');
1
2
  const path = require('path');
2
3
  const KnownError = require('../../errors/known-error');
3
4
  const getJsonfileData = require('../../util/get-jsonfile-data');
@@ -11,10 +12,19 @@ const retrieveThemeData = (themePath) => ({
11
12
  task: async (ctx) => {
12
13
  let absoluteThemePath = path.join(process.cwd(), themePath);
13
14
 
15
+ // validate if theme is located inside magento directory
16
+ if (!absoluteThemePath.includes(process.cwd())) {
17
+ throw new KnownError(`You are trying to link the theme from outside of your Magento project!
18
+
19
+ This is not supported in ${ logger.style.command('magento-scripts') } version 2.
20
+
21
+ Move your theme inside Magento project!`);
22
+ }
23
+
14
24
  // check if path not relative
15
25
  if (!(await pathExists(path.join(absoluteThemePath, 'composer.json')))) {
16
26
  // if composer.json is not found, then it's not correct path
17
- // and we need to test if it's alsolute one
27
+ // and we need to test if it's absolute one
18
28
  if (await pathExists(path.join(themePath, 'composer.json'))) {
19
29
  // if so, use it as absolute path
20
30
  absoluteThemePath = themePath;
@@ -140,7 +140,8 @@ const configurationSchema = Joi.object({
140
140
  redis: serviceConfigurationSchema.optional(),
141
141
  composer: composerConfigurationSchema.optional(),
142
142
  varnish: varnishConfigurationSchema.optional(),
143
- sslTerminator: nginxConfigurationSchema.optional()
143
+ sslTerminator: nginxConfigurationSchema.optional(),
144
+ maildev: serviceConfigurationSchema.optional()
144
145
  });
145
146
 
146
147
  /**
@@ -1,17 +1,18 @@
1
- const os = require('os');
2
1
  const { spawn } = require('child_process');
3
2
  const { runCommand } = require('../tasks/docker/containers/container-api');
4
3
 
5
4
  /**
6
- * @param {{ containerName: string, commands: string[], isDockerDesktop: boolean }} param0
5
+ * @param {{ containerName: string, commands: string[], user?: string }} param0
7
6
  */
8
- const executeInContainer = ({ containerName, commands, isDockerDesktop }) => {
7
+ const executeInContainer = ({
8
+ containerName, commands, user
9
+ }) => {
9
10
  if (!process.stdin.isTTY) {
10
11
  process.stderr.write('This app works only in TTY mode');
11
12
  process.exit(1);
12
13
  }
13
14
 
14
- const userArg = ((os.platform() === 'linux' && isDockerDesktop) || !isDockerDesktop) && `--user=${os.userInfo().uid}:${os.userInfo().gid}`;
15
+ const userArg = user && `--user=${user}`;
15
16
 
16
17
  spawn('docker', [
17
18
  'exec',
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": "2.0.0-alpha.19",
6
+ "version": "2.0.0-alpha.20",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -54,5 +54,5 @@
54
54
  "mysql",
55
55
  "scandipwa"
56
56
  ],
57
- "gitHead": "2d7e861d1eaf008fab03679406ff5ee2abedba35"
57
+ "gitHead": "6c6e5821a2da7ca52685724a56c72770004f3a5a"
58
58
  }