From e76bb59970c09d7ea0f86b4d8cd1c74f28dde7b2 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Mon, 13 Dec 2021 10:46:08 +0300 Subject: [PATCH] Easiest way to disable the compiler prompt was not mentioned in the documentation (#131) --- README.md | 17 +++++++---------- doc/compilation_prompt.md | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 883084c..048eafa 100644 --- a/README.md +++ b/README.md @@ -46,23 +46,20 @@ Allow these packages to compile? ([y]es, [a]lways, [n]o, [l]ist, [h]elp) ``` That's because the Client uses code generation to speed up serialization and deserialization of models in production. This code should be generated during installation or update. Without that code, the library itself will not work at all. -Just type `y` here and press Enter. The DTO cache will be generated after that. +Choose `[a]lways` by typing `a` and pressing Enter if you don't want to see this message anymore. If you want to approve the compilation task every time - use `[y]es` option. The DTO cache will be generated after that. + +**Note:** You should choose `[a]lways` if your application is using CI/CD pipeline because the interactive terminal is not available +in that environment which will result in failure during the dependencies installation. If you skipped the compilation task - don't worry, it can be executed manually at any time with this command: ```sh composer compile --all ``` -3. **Optional.** Disable compilation prompt that you have seen in the previous step. Run this command to do that: +3. **Optional.** Disable compilation prompt that you have seen in the previous step. -```sh -./vendor/bin/retailcrm-client compiler:prompt -``` - -Replace `vendor/bin` with your bin directory path if it's different from the default. You can find more information about this step in the [documentation](doc/compilation_prompt.md). - -**Note:** You should not skip this step if your application is using CI/CD pipeline because the interactive terminal is not available -in that environment which will result in failure during the dependencies installation. +If you wish to disable the compilation prompt but didn't do that at the previous step - you can disable the prompt manually. +Read the [documentation](doc/compilation_prompt.md) to learn how to do that. 4. Include the autoloader if it's not included, or you didn't use Composer before. ```php diff --git a/doc/compilation_prompt.md b/doc/compilation_prompt.md index a6a5d51..bd3eb04 100644 --- a/doc/compilation_prompt.md +++ b/doc/compilation_prompt.md @@ -12,15 +12,23 @@ That's because the API client utilizes code generation to speed up the serializa this prompt may be annoying and sometimes can even break the application lifecycle pipeline (in the CI/CD environment). We can't just disable it for everyone [because of security concerns](https://github.com/composer/composer/issues/1193). But you can disable it for your project. -There are two ways of disabling this prompt: -1. Automated way. -2. Manual way. +There are three ways of disabling this prompt: +1. During the installation. +2. Automated way. +3. Manual way. + +### Disable compilation prompt during the installation + +Just choose `[a]lways` option by pressing `a` followed by Enter. This will automatically edit your `composer.json` and will disable +the compilation prompt for you. No additional steps are needed. ### Disable or enable compilation prompt via CLI -For the automated way, you can use `retailcrm-client` CLI utility. It will be in your binary directory. By default, it'll be in the +Alternatively, you can use `retailcrm-client` CLI utility. It will be in your binary directory. By default, it'll be in the `vendor/bin` directory if not defined otherwise in the composer.json `config.bin-dir` entry. +The only benefit of this utility is the fact that it also can enable the prompt again. + #### Disabling compilation prompt You can disable the compiler prompt by running this command: