@scandipwa/magento-scripts 1.13.5-alpha.1 → 1.14.1-alpha.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.
Files changed (63) hide show
  1. package/lib/config/templates/php-fpm.template.conf +1 -0
  2. package/lib/config/versions/magento-2.3.0.js +3 -1
  3. package/lib/config/versions/magento-2.3.1.js +3 -1
  4. package/lib/config/versions/magento-2.3.2-p2.js +3 -1
  5. package/lib/config/versions/magento-2.3.2.js +3 -1
  6. package/lib/config/versions/magento-2.3.3-p1.js +3 -1
  7. package/lib/config/versions/magento-2.3.3.js +3 -1
  8. package/lib/config/versions/magento-2.3.4-p2.js +3 -1
  9. package/lib/config/versions/magento-2.3.4.js +3 -1
  10. package/lib/config/versions/magento-2.3.5-p1.js +3 -1
  11. package/lib/config/versions/magento-2.3.5-p2.js +3 -1
  12. package/lib/config/versions/magento-2.3.5.js +3 -1
  13. package/lib/config/versions/magento-2.3.6-p1.js +3 -1
  14. package/lib/config/versions/magento-2.3.6.js +3 -1
  15. package/lib/config/versions/magento-2.3.7-p2.js +47 -0
  16. package/lib/config/versions/magento-2.3.7-p3.js +47 -0
  17. package/lib/config/versions/magento-2.4.3-p2.js +51 -0
  18. package/lib/config/versions/magento-2.4.4.js +51 -0
  19. package/lib/config/xml-parser.js +61 -0
  20. package/lib/tasks/composer/index.js +1 -1
  21. package/lib/tasks/file-system/create-phpstorm-config/database-config.js +248 -0
  22. package/lib/tasks/file-system/create-phpstorm-config/eslint-config.js +83 -0
  23. package/lib/tasks/file-system/create-phpstorm-config/exclude-folder-config.js +154 -0
  24. package/lib/tasks/file-system/create-phpstorm-config/index.js +27 -0
  25. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/coding-standard-config.js +29 -0
  26. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/config.js +54 -0
  27. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/custom-ruleset-path-config.js +31 -0
  28. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/default-properties-config.js +42 -0
  29. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/eslint-inspection-config.js +37 -0
  30. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/index.js +80 -0
  31. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/magento-coding-standard-config.js +29 -0
  32. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/mess-detector-validation-inspection-config.js +145 -0
  33. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/paths.js +20 -0
  34. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-fixer-validation-inspection-config.js +60 -0
  35. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/php-cs-validation-inspection-config.js +119 -0
  36. package/lib/tasks/file-system/create-phpstorm-config/inspection-tools-config/stylelint-inspection-config.js +37 -0
  37. package/lib/tasks/file-system/create-phpstorm-config/keys.js +14 -0
  38. package/lib/tasks/file-system/create-phpstorm-config/php-config/index.js +67 -0
  39. package/lib/tasks/file-system/create-phpstorm-config/php-config/mess-detector-config.js +57 -0
  40. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-code-sniffer-config.js +76 -0
  41. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-cs-fixer-config.js +63 -0
  42. package/lib/tasks/file-system/create-phpstorm-config/php-config/php-project-shared-configuration-config.js +69 -0
  43. package/lib/tasks/file-system/create-phpstorm-config/stylelint-config.js +77 -0
  44. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/composer-settings-config.js +98 -0
  45. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/format-setting-config.js +57 -0
  46. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/index.js +66 -0
  47. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-debug-general-config.js +64 -0
  48. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/php-server-config.js +60 -0
  49. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/properties-component-config.js +51 -0
  50. package/lib/tasks/file-system/create-phpstorm-config/workspace-config/run-manager-config.js +74 -0
  51. package/lib/tasks/file-system/create-phpstorm-config/xml-utils.js +5 -0
  52. package/lib/tasks/file-system/index.js +1 -1
  53. package/lib/tasks/php/compile-options.js +2 -1
  54. package/lib/tasks/php/compile.js +1 -1
  55. package/lib/tasks/requirements/composer.js +211 -19
  56. package/lib/tasks/requirements/index.js +1 -2
  57. package/lib/tasks/start.js +6 -2
  58. package/lib/util/instance-metadata.js +7 -1
  59. package/package.json +13 -2
  60. package/readme.md +54 -124
  61. package/typings/context.d.ts +2 -0
  62. package/typings/phpstorm.d.ts +33 -0
  63. package/lib/tasks/file-system/create-php-storm-config.js +0 -82
@@ -1,36 +1,228 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const os = require('os');
1
4
  const logger = require('@scandipwa/scandipwa-dev-utils/logger');
5
+ const pathExists = require('../../util/path-exists');
6
+
7
+ const authJsonPath = path.join(process.cwd(), 'auth.json');
8
+ const shellName = process.env.SHELL.split('/').pop();
9
+ const shellConfigFileName = `.${shellName}rc`;
10
+ const shellConfigFilePath = path.join(os.homedir(), shellConfigFileName);
11
+
12
+ const pasteKeybinding = process.platform === 'darwin' ? 'CMD + V' : 'CTRL + SHIFT + V';
13
+
14
+ const MISSING_COMPOSER_AUTH_ENV = 'missing composer auth environment variable';
15
+ const MISSING_AUTH_JSON = 'missing auth.json file';
2
16
 
3
17
  /**
4
18
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
5
19
  */
6
- const checkComposer = () => ({
7
- title: 'Checking Composer environmental variables',
8
- task: () => {
9
- try {
10
- if (!process.env.COMPOSER_AUTH) {
11
- throw new Error(`Environmental variable ${ logger.style.misc('COMPOSER_AUTH') } is not set.`);
20
+ const configureComposerCredentials = () => ({
21
+ title: 'Configuring Composer Credentials',
22
+ task: async (ctx, task) => {
23
+ const configureLocation = await task.prompt({
24
+ type: 'Select',
25
+ message: `We didn't find Composer credentials in your ${ logger.style.misc('$COMPOSER_AUTH') } environment variable or in your ${ logger.style.file('./auth.json') } file.
26
+
27
+ Those credentials are required to install Magento.
28
+
29
+ Where do you want to store them?`,
30
+ choices: [
31
+ {
32
+ message: `Inside my projects directory in ${ logger.style.file('auth.json') } file [${ logger.style.misc('Recommended') }]`,
33
+ name: 'auth.json'
34
+ },
35
+ {
36
+ message: `Inside my shells configuration file located in users home directory ${ logger.style.file(shellConfigFileName) } [${ logger.style.misc('Shared credentials, not recommended') }] `,
37
+ name: 'shell'
38
+ }
39
+ ]
40
+ });
41
+
42
+ const usernameCredentials = await task.prompt({
43
+ type: 'Input',
44
+ message: `Please enter your username key.
45
+
46
+ You can obtain this key from Magento Marketplace
47
+
48
+ 1. Go to ${ logger.style.link('https://marketplace.magento.com/customer/accessKeys/') }
49
+ 2. Use created Access Keypair or click ${ logger.style.misc('Generate Access Keypair') } to generate new Access Keypair
50
+ 3. Click ${ logger.style.misc('Copy') } on ${ logger.style.misc('Public key') } and paste it here (${logger.style.misc(pasteKeybinding)})
51
+
52
+ ${ logger.style.misc('Username') } (${ logger.style.misc('Public key') }):`,
53
+ required: true,
54
+ validate: (value) => {
55
+ if (value.trim() === '') {
56
+ return 'Username must not be empty';
57
+ }
58
+
59
+ return true;
12
60
  }
61
+ });
13
62
 
14
- let magento;
63
+ const passwordCredentials = await task.prompt({
64
+ type: 'Input',
65
+ message: `Please enter your password key.
15
66
 
16
- try {
17
- magento = JSON.parse(process.env.COMPOSER_AUTH);
18
- } catch (e) {
19
- throw new Error(`Environmental variable ${ logger.style.misc('COMPOSER_AUTH') } is not valid JSON.`);
67
+ You can obtain this key from Magento Marketplace
68
+
69
+ 1. Go to ${ logger.style.link('https://marketplace.magento.com/customer/accessKeys/') }
70
+ 2. Use created Access Keypair or click ${ logger.style.misc('Generate Access Keypair') } to generate new Access Keypair
71
+ 3. Click ${ logger.style.misc('Copy') } on ${ logger.style.misc('Private key') } and paste it here (${logger.style.misc(pasteKeybinding)})
72
+
73
+ ${ logger.style.comment('Make sure to use Private key from the same Keypair as your Public key!')}
74
+
75
+ ${ logger.style.misc('Password') } (${ logger.style.misc('Private key') }):`,
76
+ required: true,
77
+ validate: (value) => {
78
+ if (value.trim() === '') {
79
+ return 'Password must not be empty';
80
+ }
81
+
82
+ return true;
20
83
  }
84
+ });
21
85
 
22
- if (!magento || !magento['http-basic'] || !magento['http-basic']['repo.magento.com']) {
23
- throw new Error(`Environmental variable ${ logger.style.misc('COMPOSER_AUTH') } does not contain the ${ logger.style.misc('repo.magento.com') } field.`);
86
+ const authContent = {
87
+ 'http-basic': {
88
+ 'repo.magento.com': {
89
+ username: usernameCredentials,
90
+ password: passwordCredentials
91
+ }
24
92
  }
25
- } catch (e) {
93
+ };
94
+
95
+ const authJsonContent = JSON.stringify(authContent, null, 4);
96
+ const authEnvContent = `export COMPOSER_AUTH='${JSON.stringify(authContent)}'`;
97
+
98
+ process.env.COMPOSER_AUTH = authJsonContent;
99
+
100
+ if (configureLocation === 'auth.json') {
101
+ await fs.promises.writeFile(authJsonPath, authJsonContent, 'utf-8');
102
+ return;
103
+ }
104
+
105
+ switch (shellName) {
106
+ case 'bash':
107
+ case 'zsh': {
108
+ await fs.promises.appendFile(
109
+ path.join(os.homedir(), shellConfigFileName),
110
+ `\n${authEnvContent}\n`
111
+ );
112
+ break;
113
+ }
114
+ default: {
26
115
  throw new Error(
27
- `To generate Composer credentials login into Magento Marketplace and follow the official guide.
28
- The guide is found here: ${ logger.style.link('https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html') }
29
- Then, insert obtained credentials into this command, and execute:
30
- ${logger.style.code('export COMPOSER_AUTH=\'{"http-basic":{"repo.magento.com": {"username": "<PUBLIC KEY FROM MAGENTO MARKETPLACE>", "password": "<PRIVATE KEY FROM MAGENTO MARKETPLACE>"}}}\'')}\n\n${e}`
116
+ `Unfortunately we cannot automatically add credentials for your shell ${process.env.SHELL}!
117
+
118
+ You will need to that manually!
119
+
120
+ Add following string to your shell configuration file: ${ logger.style.code()}`
31
121
  );
32
122
  }
123
+ }
124
+
125
+ await task.prompt({
126
+ type: 'Confirm',
127
+ message: `Before we continue with installation...
128
+
129
+ You selected to add your Magento credentials to your shell environment, you should know that shell configuration does not update automatically.
130
+
131
+ To update it you can either restart your existing shell or run the following command to update the configuration temporarily: ${ logger.style.code('source <path/to/config/file>')}
132
+
133
+ Press ${ logger.style.misc('Y') } to continue`
134
+ });
135
+ }
136
+ });
137
+
138
+ /**
139
+ * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
140
+ */
141
+ const checkComposerCredentials = () => ({
142
+ title: 'Checking Composer credentials',
143
+ task: async (ctx, task) => {
144
+ const problems = new Map();
145
+ if (!process.env.COMPOSER_AUTH) {
146
+ problems.set(MISSING_COMPOSER_AUTH_ENV, true);
147
+ }
148
+
149
+ if (!await pathExists(authJsonPath)) {
150
+ problems.set(MISSING_AUTH_JSON, true);
151
+ }
152
+
153
+ if (problems.has(MISSING_COMPOSER_AUTH_ENV) && problems.has(MISSING_AUTH_JSON)) {
154
+ let doConfigure = true;
155
+ if (await pathExists(shellConfigFilePath)) {
156
+ const rcFileContent = await fs.promises.readFile(shellConfigFilePath, 'utf-8');
157
+
158
+ const lines = rcFileContent.split('\n');
159
+ const composerAuthInRcFile = lines.some((line) => line.startsWith('export COMPOSER_AUTH='));
160
+
161
+ if (composerAuthInRcFile) {
162
+ doConfigure = false;
163
+ const loadCredentialsFrom = await task.prompt({
164
+ type: 'Confirm',
165
+ message: `We detected that you have ${ logger.style.misc('COMPOSER_AUTH') } environment variable set in ${ logger.style.file(shellConfigFilePath) } file,
166
+ but we do not see this variable inside ${ logger.style.code('magento-scripts') } process.
167
+
168
+ ${ logger.style.misc('! Don\'t forget to reload your shell after process is finished !') }
169
+
170
+ Would you like to load them now?`
171
+ });
172
+
173
+ if (loadCredentialsFrom) {
174
+ const credentialsLine = lines.find((line) => line.startsWith('export COMPOSER_AUTH='));
175
+ process.env.COMPOSER_AUTH = credentialsLine.replace('export COMPOSER_AUTH=', '').replace(/'/ig, '').trim();
176
+ problems.delete(MISSING_COMPOSER_AUTH_ENV);
177
+ }
178
+ }
179
+ }
180
+
181
+ if (doConfigure) {
182
+ return task.newListr(
183
+ configureComposerCredentials()
184
+ );
185
+ }
186
+ }
187
+
188
+ let composerAuthContent;
189
+
190
+ if (!problems.has(MISSING_AUTH_JSON)) {
191
+ try {
192
+ const composerAuthFileContent = await fs.promises.readFile(authJsonPath, 'utf-8');
193
+
194
+ composerAuthContent = JSON.parse(composerAuthFileContent);
195
+
196
+ process.env.COMPOSER_AUTH = composerAuthFileContent;
197
+ } catch (e) {
198
+ throw new Error(
199
+ `We found an error in your ${ logger.style.file('./auth.json') } file.
200
+
201
+ Make sure that this file contains a valid JSON!
202
+
203
+ You can try linting your file here: ${ logger.style.link('https://jsonformatter.curiousconcept.com/') }
204
+
205
+ Error message that we got: ${e}`
206
+ );
207
+ }
208
+ }
209
+
210
+ if (!problems.has(MISSING_COMPOSER_AUTH_ENV) && !composerAuthContent) {
211
+ try {
212
+ composerAuthContent = JSON.parse(process.env.COMPOSER_AUTH);
213
+ } catch (e) {
214
+ throw new Error(
215
+ `We found an error in your ${ logger.style.misc('$COMPOSER_AUTH') } environment variable.
216
+
217
+ Make sure that this variable contains a valid JSON!
218
+
219
+ You can try linting your variable here: ${ logger.style.link('https://jsonformatter.curiousconcept.com/') }
220
+
221
+ Error message that we got: ${e}`
222
+ );
223
+ }
224
+ }
33
225
  }
34
226
  });
35
227
 
36
- module.exports = checkComposer;
228
+ module.exports = checkComposerCredentials;
@@ -4,7 +4,6 @@ const checkComposer = require('./composer');
4
4
  const checkDocker = require('./docker');
5
5
  const checkNodeVersion = require('./node-version');
6
6
  const checkPHPVersion = require('./php-version');
7
- const localAuthJson = require('../composer/local-auth-json');
8
7
 
9
8
  /**
10
9
  * @type {() => import('listr2').ListrTask<import('../../../typings/context').ListrContext>}
@@ -21,7 +20,7 @@ const checkRequirements = () => ({
21
20
  // check the Docker installation
22
21
  checkDocker(),
23
22
  // check for COMPOSER_AUTH or auth.json
24
- localAuthJson(),
23
+ // localAuthJson(),
25
24
  checkComposer(),
26
25
  // check for Node.js version
27
26
  checkNodeVersion()
@@ -29,6 +29,7 @@ const convertLegacyVolumes = require('./docker/convert-legacy-volumes');
29
29
  const enableMagentoComposerPlugins = require('./magento/enable-magento-composer-plugins');
30
30
  const getIsWsl = require('../util/is-wsl');
31
31
  const checkForXDGOpen = require('../util/xdg-open-exists');
32
+ const { getInstanceMetadata, constants: { WEB_LOCATION_TITLE } } = require('../util/instance-metadata');
32
33
 
33
34
  /**
34
35
  * @type {() => import('listr2').ListrTask<import('../../typings/context').ListrContext>}
@@ -189,8 +190,11 @@ const start = () => ({
189
190
 
190
191
  return false;
191
192
  },
192
- task: ({ ports, config: { overridenConfiguration: { host, ssl } } }) => {
193
- openBrowser(`${ssl.enabled ? 'https' : 'http'}://${host}${ssl.enabled || ports.app === 80 ? '' : `:${ports.app}`}/`);
193
+ task: (ctx) => {
194
+ const instanceMetadata = getInstanceMetadata(ctx);
195
+ const locationOnTheWeb = instanceMetadata.frontend.find(({ title }) => title === WEB_LOCATION_TITLE);
196
+
197
+ openBrowser(locationOnTheWeb.text);
194
198
  },
195
199
  options: {
196
200
  showTimer: false
@@ -70,5 +70,11 @@ const getInstanceMetadata = (ctx) => {
70
70
  };
71
71
 
72
72
  module.exports = {
73
- getInstanceMetadata
73
+ getInstanceMetadata,
74
+ constants: {
75
+ WEB_LOCAL_LOCATION_TITLE,
76
+ WEB_LOCATION_TITLE,
77
+ WEB_ADMIN_LOCATION_TITLE,
78
+ WEB_ADMIN_CREDENTIALS_TITLE
79
+ }
74
80
  };
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.5-alpha.1",
6
+ "version": "1.14.1-alpha.1",
7
7
  "main": "./index.js",
8
8
  "types": "./typings/index.d.ts",
9
9
  "license": "OSL-3.0",
@@ -26,6 +26,7 @@
26
26
  "conf": "10.1.1",
27
27
  "enquirer": "2.3.6",
28
28
  "eta": "1.12.3",
29
+ "fast-xml-parser": "^4.0.7",
29
30
  "hjson": "^3.2.2",
30
31
  "is-installed-globally": "0.4.0",
31
32
  "joi": "17.6.0",
@@ -41,5 +42,15 @@
41
42
  "publishConfig": {
42
43
  "access": "public"
43
44
  },
44
- "gitHead": "e00e8d06964b4a7fc5a0095ea510fc26a06520a8"
45
+ "keywords": [
46
+ "magento",
47
+ "docker",
48
+ "php",
49
+ "nginx",
50
+ "redis",
51
+ "elasticsearch",
52
+ "mysql",
53
+ "scandipwa"
54
+ ],
55
+ "gitHead": "cc46e60ca1d44d6e00b151e03af5cc7f56a5e54a"
45
56
  }
package/readme.md CHANGED
@@ -1,150 +1,80 @@
1
1
  # magento-scripts
2
2
 
3
- This package contains scripts and configuration used by Create Magento App by [Create Magento App](https://github.com/scandipwa/create-magento-app).
3
+ This package contains scripts and configuration used by [Create Magento App](https://github.com/scandipwa/create-magento-app).
4
4
 
5
5
  ## Overview
6
6
 
7
7
  What this package does:
8
- - Compiles correct php with all necessary extensions to run Magento on your system.
9
- - Organize services required to run Magento on your system, such as Nginx, Redis, MySQL and Elasticsearch, in docker containers with forwarded ports to host system.
8
+ - Compiles correct PHP version with all necessary extensions to run Magento on your system.
9
+ - Organize services required to run Magento on your system, such as Nginx, Redis, MySQL and Elasticsearch in Docker containers with forwarded ports to host system.
10
10
  - Allows you to run multiple M2 projects simultaneously on the same machine without ports/files/context overlapping.
11
11
 
12
+ ## Requirements
13
+
14
+ ### Linux Requirements
15
+
16
+ Dependency list and installation guide is available in our [documentation for installation on Linux](https://docs.create-magento-app.com/getting-started/prerequisites/installation-on-linux)!
17
+
18
+ ### MacOS Requirements
19
+
20
+ Dependency list and installation guide is available in our [documentation for installation on Mac](https://docs.create-magento-app.com/getting-started/prerequisites/installation-on-macos)!
21
+
22
+ ### Windows Requirements
23
+
24
+ Dependency list and installation guide is available in our [documentation for installation on Windows](https://docs.create-magento-app.com/getting-started/prerequisites/windows-requirements)!
25
+
26
+ > If you miss a requirement CMA will tell you and will give instructions or even provide a one click fix!
27
+
12
28
  ## Usage
13
29
 
14
- ```bash
15
- > npx create-magento-app <folder name>
16
- > cd <folder name>
17
- > yarn/npm run start
18
- ```
30
+ ### Start the App
19
31
 
20
- To use commands such as `composer`, `magento` and `php` with correct version run command:
21
32
  ```bash
22
- > yarn/npm cli
23
- ```
24
- This will open bash with correct aliases to `php`, `magento` and `composer`.
33
+ # Create an App
34
+ npx create-magento-app <folder name>
25
35
 
26
- To open logs use command `logs` with one of the scopes: `redis`, `mysql`, `elasticsearch`, `nginx` or `magento`.
27
- ```bash
28
- > yarn/npm run logs nginx
29
- > // nginx logs
36
+ cd <folder name>
37
+
38
+ # Run it with yarn
39
+ yarn start
40
+
41
+ # Or with npm
42
+ npm run start
30
43
  ```
31
44
 
32
- > NOTE: you can use shortcuts for logs! Like `yarn logs m` will show `mysql` logs, `yarn logs ma` will show `magento` logs and e.t.c.
45
+ > Documentation for `start` command is available [here](https://docs.create-magento-app.com/getting-started/available-commands/start).
33
46
 
34
- ## Requirements
47
+ ### Access Application CLI
35
48
 
36
- - [Docker](https://docs.docker.com/get-docker/) ^19
37
- - [phpbrew](https://github.com/phpbrew/phpbrew) ^1.25
38
-
39
- For Mac
40
- - MacOS 10.5 and newer
41
- - Xcode 11 and newer You can find it.
42
- - [Homebrew](https://brew.sh/)
43
-
44
- ## Dependencies
45
-
46
- ### Ubuntu
47
-
48
- ```sh
49
- apt-get install \
50
- libcurl4-openssl-dev \
51
- libonig-dev \
52
- libjpeg-dev \
53
- libjpeg8-dev \
54
- libjpeg-turbo8-dev \
55
- libpng-dev \
56
- libicu-dev \
57
- libfreetype6-dev \
58
- libzip-dev \
59
- libssl-dev \
60
- build-essential \
61
- libbz2-dev \
62
- libreadline-dev \
63
- libsqlite3-dev \
64
- libssl-dev \
65
- libxml2-dev \
66
- libxslt-dev \
67
- libonig-dev \
68
- php-cli \
69
- php-bz2 \
70
- pkg-config \
71
- autoconf
49
+ To access Magento CLI, Composer and PHP use `cli` command:
50
+ ```bash
51
+ # With yarn
52
+ yarn cli
53
+
54
+ # Or npm
55
+ npm run cli
72
56
  ```
73
57
 
74
- ### Mint Linux
58
+ This will a new instance of Bash with aliases for PHP, Composer and Magento used in Create Magento App project.
75
59
 
76
- ```
77
- apt-get install \
78
- libjpeg-dev \
79
- libjpeg8-dev \
80
- libjpeg-turbo8-dev \
81
- libpng-dev \
82
- libicu-dev \
83
- libfreetype6-dev \
84
- libzip-dev \
85
- libssl-dev \
86
- build-essential \
87
- libbz2-dev \
88
- libreadline-dev \
89
- libsqlite3-dev \
90
- libssl-dev \
91
- libxml2-dev \
92
- libxslt-dev \
93
- libonig-dev \
94
- php-cli \
95
- php-bz2 \
96
- pkg-config \
97
- autoconf \
98
- libcurl4-openssl-dev
99
- ```
60
+ > Documentation for `cli` command is available [here](https://docs.create-magento-app.com/getting-started/available-commands/cli).
100
61
 
101
- ### CentsOS / Fedora
102
- ```sh
103
- yum install --enablerepo=PowerTools openssl-devel \
104
- libjpeg-turbo-devel \
105
- libpng-devel \
106
- gd-devel \
107
- libicu libicu-devel \
108
- libzip-devel \
109
- libtool-ltdl-devel \
110
- oniguruma-devel
111
- ```
62
+ ### Access Application Logs
112
63
 
113
- ### Arch
114
- ```sh
115
- pamac install freetype2 \
116
- openssl \
117
- oniguruma \
118
- libxslt \
119
- bzip2 \
120
- libjpeg-turbo \
121
- libpng \
122
- icu \
123
- libxml2 \
124
- autoconf \
125
- libzip \
126
- sqlite \
127
- readline \
128
- perl
129
- ```
64
+ To open logs use command `logs` with one of the scopes: `redis`, `mysql`, `elasticsearch`, `nginx` or `magento`.
65
+ ```bash
66
+ # With yarn
67
+ yarn logs nginx
130
68
 
131
- ### MacOS
69
+ # Or npm
70
+ npm run logs nginx
132
71
 
133
- ```sh
134
- sudo xcode-select -switch /Applications/Xcode.app
135
- ```
136
- ```sh
137
- brew install zlib \
138
- bzip2 \
139
- libiconv \
140
- curl \
141
- libpng \
142
- gd \
143
- freetype \
144
- oniguruma \
145
- icu4c \
146
- libzip
72
+ > ... nginx logs
147
73
  ```
148
74
 
149
- Additional libraries:
150
- - Installed PHP with json extension.
75
+ > NOTE: you can also use name matching for logs! Like `yarn logs m` will show `mysql` logs, `yarn logs ma` will show `magento` logs and e.t.c.
76
+ Read more about this [here](https://docs.create-magento-app.com/getting-started/available-commands/logs#usage-example).
77
+
78
+ ---
79
+
80
+ CMA contains even more useful commands like [checking application status](https://docs.create-magento-app.com/getting-started/available-commands/status), [executing commands in Docker containers](https://docs.create-magento-app.com/getting-started/available-commands/exec), [linking a theme](https://docs.create-magento-app.com/getting-started/available-commands/link) and [importing database](https://docs.create-magento-app.com/getting-started/available-commands/import-db)!
@@ -1,6 +1,7 @@
1
1
  import mysql2 from 'mysql2';
2
2
 
3
3
  import { CMAConfiguration, PHPExtensions } from './index';
4
+ import { PHPStormConfig } from './phpstorm';
4
5
 
5
6
  export interface ListrContext {
6
7
  magentoVersion: string
@@ -82,6 +83,7 @@ export interface ListrContext {
82
83
  overridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
83
84
  userConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
84
85
  nonOverridenConfiguration: Omit<CMAConfiguration, 'prefix' | 'useNonOverlappingPorts'>
86
+ phpStorm: PHPStormConfig
85
87
  }
86
88
  systemConfiguration: {
87
89
  analytics: boolean
@@ -0,0 +1,33 @@
1
+ export interface PHPStormConfig {
2
+ xdebug: {
3
+ v2Port: string;
4
+ v3Port: string;
5
+ debugServerAddress: string;
6
+ serverName: string;
7
+ runManagerName: string;
8
+ sessionId: string;
9
+ path: string;
10
+ templatePath: string;
11
+ }
12
+ php: {
13
+ phpLanguageLevel: string;
14
+ path: string;
15
+ templatePath: string;
16
+ }
17
+ database: {
18
+ driver: string;
19
+ dataSourceManagerName: string;
20
+ dataSourcesLocal: {
21
+ path: string;
22
+ templatePath: string;
23
+ }
24
+ dataSources: {
25
+ path: string;
26
+ templatePath: string;
27
+ }
28
+ }
29
+ inspectionTools: {
30
+ path: string;
31
+ templatePath: string;
32
+ }
33
+ }
@@ -1,82 +0,0 @@
1
- const setConfigFile = require('../../util/set-config');
2
- const pathExists = require('../../util/path-exists');
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- const createPhpStormConfig = () => ({
7
- title: 'Setting PHPStorm config',
8
- task: async ({ config: { phpStorm }, ports }) => {
9
- const { phpLanguageLevel } = phpStorm.php;
10
- const jdbcUrl = `jdbc:mysql://localhost:${ports.mysql}/magento`;
11
-
12
- try {
13
- await setConfigFile({
14
- configPathname: phpStorm.xdebug.path,
15
- template: phpStorm.xdebug.templatePath,
16
- overwrite: true,
17
- templateArgs: {
18
- phpStorm
19
- }
20
- });
21
- } catch (e) {
22
- throw new Error(`Unexpected error accrued during workspace.xml config creation\n\n${e}`);
23
- }
24
-
25
- try {
26
- await setConfigFile({
27
- configPathname: phpStorm.php.path,
28
- template: phpStorm.php.templatePath,
29
- overwrite: true,
30
- templateArgs: {
31
- phpLanguageLevel
32
- }
33
- });
34
- } catch (e) {
35
- throw new Error(`Unexpected error accrued during php.xml config creation\n\n${e}`);
36
- }
37
-
38
- try {
39
- await setConfigFile({
40
- configPathname: phpStorm.database.dataSourcesLocal.path,
41
- template: phpStorm.database.dataSourcesLocal.templatePath,
42
- overwrite: true,
43
- templateArgs: {
44
- phpStorm
45
- }
46
- });
47
- } catch (e) {
48
- throw new Error(`Unexpected error accrued during dataSources.local.xml config creation\n\n${e}`);
49
- }
50
-
51
- try {
52
- await setConfigFile({
53
- configPathname: phpStorm.database.dataSources.path,
54
- template: phpStorm.database.dataSources.templatePath,
55
- overwrite: true,
56
- templateArgs: {
57
- phpStorm,
58
- jdbcUrl
59
- }
60
- });
61
- } catch (e) {
62
- throw new Error(`Unexpected error accrued during dataSources.xml config creation\n\n${e}`);
63
- }
64
-
65
- if (!await pathExists(path.resolve('./.idea/dataSources'))) {
66
- await fs.promises.mkdir(path.resolve('./.idea/dataSources'));
67
- }
68
-
69
- try {
70
- await setConfigFile({
71
- configPathname: phpStorm.inspectionTools.path,
72
- template: phpStorm.inspectionTools.templatePath,
73
- overwrite: true,
74
- templateArgs: {}
75
- });
76
- } catch (e) {
77
- throw new Error(`Unexpected error accrued during Project_Default.xml config creation\n\n${e}`);
78
- }
79
- }
80
- });
81
-
82
- module.exports = createPhpStormConfig;