I can't get composer to work properly with local packages.
package A:
{
"name": "package/A",
"repositories": [
{
"type": "vcs",
"url": "../B"
}
],
"require": {
"package/B": "dev-master"
}
}
package B:
{
"name": "package/B",
"repositories": [
{
"type": "vcs",
"url": "../C"
}
],
"require": {
"package/C": "dev-master"
}
}
package C:
{
"name": "package/C",
}
Now installing package B works fine and it resolves the package C properly.
Installing package A fails because it can not resolve the package C from the package B, which is the only dependency of package A.
I couldn't find anything about this #google, it looks like composer can't handle that kind of complexity in local packages. Hopefully I'm wrong.
Here is a small illustration for better understanding of this problem.
Composer doesn't load local repos recursively.
1) You might declare dependencies for B and C in A. You have to redefine the dependencies in your composer.json. Here, this will add some more require and repository defines to composer.json of A.
2) Or you might setup a local Satis proxy, which serves your private packages.
Private or public publishing of the dependencies will resolve the situation.
Related
There are several standard Java dependencies that have forks with the same maven coordinates and a "redhat-xxx" suffix in their version number, for example
commons-configuration:common-configuration
org.eclipse.microprofile.config:microprofile-config-api
javax.enterprise:cdi-api
My question is
(How) can I configure renovate to exclude all dependencies whose version matches /redhat-\d+$/ ?
There is a similar question here, but that asks for a more restricted set of dependencies. If I were to define a packageRule like
{
"packageRules": [
{
"groupName" : "Exclude all redhat-xyz versions"
"matchPackagePatterns": [".*"],
"allowedVersions": "!/redhat-\\d+$/"
}
]
}
It would group all dependencies into one giant pull request which isn't helpful.
Try to set registryUrls to standard Maven repo so that Redhat dependencies and such are not checked:
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"packageRules": [{
"matchManagers": ["maven"],
"registryUrls": ["https://repo.maven.apache.org/maven2"],
}]
}
or use your given config and add "enabled": false
I have tried using
$data = BasicFunctions::checkEmailExists('emailaddress', 'Modal_name');
I am using my own package https://packagist.org/packages/jainam/basicfunctions
It is giving error that Class vendor\jainam\basicfunctions\src\BasicFunctions does not exist
Can anyone know how to use this?
I am adding that file using use BasicFunctions;
Open your plugin's composer.json file and change
"autoload": {
"psr-4": {
"jainam\\BasicFunctions\\": "src/"
}
}
to
"autoload": {
"psr-4": {
"Jainam\\": "src/"
}
}
NOTE: "Jainam\\": "src/" here is the namespace, so you will end up writing use Jainam\BasicFunctions in your code.
Then install the plugin and run composer dump-autoload.
To test this now, you can directly edit the composer.json file inside vendor folder and run composer dump-autoload in your project
Inside my Monorepo I have one packages in which I want all the dependencies inside its node_modules.
But whatever I do, it's node_modules remains empty.
So, for the purpose of my question I was able to reproduce the issue with the following setup
/
package.json
lerna.json
node_modules
packages/
A/
node_modules
package.json
index.ts
B/
node_modules
package.json
index.ts
I've created a repo for this!
Main package.json
{
"name": "A-B-test",
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": [ "**/B" ]
},
...
"devDependencies": {
"lerna": "^3.13.4"
}
}
B/package.json looks like
{
"name": "#scaljeri/B",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"angular": "^1.7.8"
},
"devDependencies": {
"browserify": "^16.2.3",
"typescript": "^3.5.2"
}
}
Now when I run yarn in the root of the project, all dependencies are installed in the root node_modules.
yarn version: 1.16.0
node: 12.4.0
Any suggestions what might be the problem?
In my experience, it has been necessary to doubly specify each package in the following manner:
{
"nohoist": [
"**/B",
"**/B/**",
"**/C",
"**/C/**"
]
}
In addition, I have found it necessary to delete all existing node_modules folders after modifying the nohoist settings. So, if your projects are in packages, and you are in your project directory, you can delete all of those node_modules folders like this:
# delete node_modules on linux
rm -rf ./packages/*/node_modules
rm -rf ./node_modules
# install again
yarn install --check-files
I tried a few options but the only one that finally worked for me was specifying the nohoist option in the child package. No need to specify anything at the root level.
So my package.json in B package is:
{
...
"workspaces": {
"nohoist": ["**"]
},
...
}
Applying the nohoist to the child package's package.json did it for me.
"workspaces": {
"nohoist": [
"*react-native*",
"*react-native*/**"
]
},
If you want to exclude package B node modules from hoisting you can do that in you package.json:
"workspaces": {
"nohoist": [
"**/B",
"**/B/**"
]
},
after that remove node_modules and yarn.lock and run yarn install again now you should see packages/B/node_modules not being hoisted to the top level of the project
I have problem with composer to generate symbolic link.
I have script in ./bin/my-script which code looks like:
#!/usr/bin/php
<?php echo 'Hello World!'; ?>
I have added config in to package composer.json (not in to main project)
"bin": ["bin/my-script"]
When updating composer in main project my package is installing fine.
However composer not creates symbolic link to my bin script in ./vendor/bin
What I'm doing wrong?
OK I found the problem.
As I pull from local repository instead composer packages
I had to add below line in to repositories settings in my main project.
"repositories": [
{
"type": "package",
"package": {
"name": "200mph/m-commander",
"version": "dev-master",
"source": {
"url": "/home/wojtek/m-commander",
"type": "git",
"reference": "develop"
},
"bin": ["bin/m-commander"],
"autoload": {
"psr-4" : {
"mcommander\\" : "src/",
"examples\\mcommander\\" : "examples/"
}
}
}
}
]
Did you checked this link https://getcomposer.org/doc/articles/vendor-binaries.md
I think your problem related with following subject :
What happens when Composer is run on a composer.json that defines
vendor binaries?#
For the binaries that a package defines directly, nothing happens.
What happens when Composer is run on a composer.json that has
dependencies with vendor binaries listed?#
Composer looks for the binaries defined in all of the dependencies. A
symlink is created from each dependency's binaries to vendor/bin.
i've got a strange problem ...
project-a is my main project.
project-b is my library, checked in to subversion
composer.json of project-b
{
"name": "fragger/baseclasses",
"version" : "0.0.1-dev",
"description": "Baseclasses and Interfaces",
"require": {
"silex/silex": "1.0.x-dev",
"3rd-party/smarty": "3.*",
"swiftmailer/swiftmailer": "4.2-dev"
},
"autoload": {
"psr-0": { "baseclasses": "src/" }
}
}
and composer.json of project-b
{
"repositories" : [
{
"type": "vcs",
"url" : "svn+ssh://....."
}
],
"require": {
"fragger/baseclasses": ">=0.0.1-dev"
}
}
output of install command
php composer.phar install
Loading composer repositories with package information
Installing dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for fragger/baseclasses >=0.0.1-dev -> satisfiable by fragger/baseclasses dev-trunk.
- fragger/baseclasses dev-trunk requires silex/silex 1.0.x-dev -> no matching package found.
But a composer install in project a alone, works fine
You can find detailed information about the packages on packgist, for example for Silex, but it seems, that all of your dependencies have invalid version strings.
Instead of "silex/silex": "1.0.x-dev" it must be named "silex/silex": "1.0.*#dev". There is no branch for 1.0.x and the correct version string for a branch would be dev-branchname anyway ;)