Before 8.6.0
Install profiles define a "dependencies" array in their info files to select which modules to enable on install, like so (taken from Standard):
name: Standard
type: profile
description: 'Install with commonly used features pre-configured.'
version: VERSION
core: 8.x
dependencies:
- node
- history
- block
- breakpoint
- ckeditor
...
However, these were not actually treated as true, hard dependencies. In other words, if you installed from the Standard profile, you could still uninstall History or Block (or any of Standard's so-called dependencies) if you wanted to.
After 8.6.0
As of #2952888: Allow install profiles to require modules, profiles can define an explicit 'install' array in their info file in addition to the 'dependencies' array. The 'dependencies' array will be treated as a set of hard dependencies, meaning that they cannot be uninstalled because the profile depends on them. In the following example, if this profile is used then node will be required by the install profile and will not be able to be uninstalled.
name: My Profile
type: profile
description: 'My install profile.'
core: 8.x
dependencies:
- node
install:
- block_content
- views
- ckeditor
...
If the profile simply wants to specify a list of modules to install, but upon which it does not actually depend, it can use the 'install' key, like so:
name: My Profile
type: profile
description: 'My install profile.'
core: 8.x
install:
- block_content
- node
- views
- ckeditor
...
To maintain backwards compatibility, profiles which only define a 'dependencies' array, but not an 'install' array, will have their list of dependencies treated like an 'install' list. This backwards compatibility layer will be removed in Drupal 9, so profile authors should separate their 'install' list from their actual dependencies as soon as possible.
If the install profile wants to depend on all the modules and not allow any of them to be uninstalled you will need to define an empty 'install' key, like so:
name: My Profile
type: profile
description: 'My install profile.'
core: 8.x
dependencies:
- block_content
- node
- views
- ckeditor
install: []