Package Manager
Composer Asset Compiler can work with both npm and Yarn. Nevertheless, some packages might require the usage of a specific package manager.
Auto-discovery
For that reason, Composer Asset Compiler tries to determine the best package manager for each package using the following criteria:
- if a file
package-lock.json
ornpm-shrinkwrap.json
is found in the package’s root folder, the chosen package manager will be npm. - if a file
yarn.lock
is found in the package’s root folder, the chosen package manager will be Yarn.
Configuration
Instead of letting Composer Asset Compiler determine the best package manager for the package, it is possible to manually configure it via the package-manager
configuration. For example:
{
"name": "acme/some-plugin",
"extra": {
"composer-asset-compiler": {
"package-manager": "yarn",
"script": "gulp build"
}
}
}
Fall-back
It might happen that Composer Asset Compiler determines a package manager is the best choice for a package, but it is not installed in the system.
In that case, Composer Asset Compiler will default to the other package manager.
If neither npm nor Yarn are installed Composer Asset Compiler execution will fail.