I have a VCS override as such:
"repositories": [{
"type": "vcs",
"url": "https://github.com/mygithub/myrepo.git",
"no-api": true
}],
and require as:
"repo/repo": "dev-mybranch",
It works fine, however the time it takes to composer install is unacceptable. This is because it is reading every version of the source repository first. Like this:
Reading composer.json of repo/repo (1.11.101)
Reading composer.json of repo/repo (1.11.102)
Reading composer.json of repo/repo (1.11.103)
Reading composer.json of repo/repo (1.11.104)
Reading composer.json of repo/repo (1.11.105)
Reading composer.json of repo/repo (1.11.106)
Reading composer.json of repo/repo (1.11.107)
Reading composer.json of repo/repo (1.11.108)
Reading composer.json of repo/repo (1.11.109)
Reading composer.json of repo/repo (1.11.110)
There are well over a thousand version.
Can this be stopped? Why can't it just read the one version that I need?
Related
I'm trying to package an NWJS app following various tutorials on YouTube and the web. But I'm getting "No files matching" error and it exits. Assuming it was because the dist/ and src/ directories hadn't been created, I created them myself, but I still get the error. All other paths listed in package.json exist.
After searching the web for a similar issue, the only thing I found was this:
https://github.com/nwutils/nw-builder/issues/190
However, this is regarding doing the build using command line args, rather than from package.json.
npm and nodejs were updated to latest version and nwjs was updated to 0.64.0-sdk.
I am attempting the build on MacOS 10.13.6, nodejs version 16.15.0, npm version 8.5.5 .
Any ideas anyone?
Thanks!
Kevin
CLI:
15:40:55 : ~/ReolinkNWJS
npm run prod
> ReolinkNWJS#0.0.1 prod
> nwbuild --platforms osx64 --buildDir dist/ src/
No files matching
15:41:00 : ~/ReolinkNWJS
ls
dist icons javascript package-lock.json package.json.TEMPLATE src
html images node_modules package.json resources styles
package.json:
{
"name": "ReolinkNWJS",
"description": "Reolink Client App In NWJS Framework",
"version": "0.0.1",
"icon": "icons/app.icns",
"main": "html/main.html",
"chromium-args": "--enable-logging=stderr --enable-spell-checking",
"window": {
"toolbar": false,
"width": 800,
"height": 500,
"position": "center"
},
"nodejs": true,
"node-remote": "*://*",
"scripts": {
"prod": "nwbuild --platforms osx64 --buildDir dist/ src/"
},
"devDependencies": {
"nw": "^0.64.0-sdk",
"nw-builder": "^3.7.0"
}
}
I think you either need to remove your src/ or move it to the front
"prod": "nwbuild --platforms osx64 --buildDir dist/"
"prod": "nwbuild src/ --platforms osx64 --buildDir dist/"
Also, either remove or change your node-remote. It is currently set up so that any webpage on the internet has complete control to run Node, meaning they can easily read the contents of all files on the computer, download virus.exe, delete all files, whatever, literally anything. Don't do that.
node-remote is almost exclusively used to point to http://localhost:8080, or some other port, for a local webserver your app runs on. Your main is pointing to a local file, not a webserver, so you likely do not need node-remote at all.
You probably want to move the "icon" at the root into the "window" sub object.
https://nwjs.readthedocs.io/en/latest/References/Manifest%20Format/#window-subfields
There is a library on Github, named abc/xyz.
I have forked the library to update its composer.json.
The require section of its composer.json is:
{
"require": {
"xyz/abc": "^1.2",
}
}
Therequire section of the forked version is:
{
"require": {
"xyz/abc": "^2.4",
}
}
When I do composer require abc/xyz, it also downloads and installs the xyz/abc
library.
But when I use the forked version and add the following to the repositories section of my root composer.json
{
"repositories": [
{
"type": "package",
"package": {
"name": "abc/xyz",
"version": "1.2",
"dist": {
"url": "url to zip folder of the forked version",
"type": "zip"
},
"type": "library"
}
}
]
}
Now when I do composer require abc/xyz, it only downloads and installs the actual package and not the xyz/abc.
I also tried with the type: git instead of zip and changed the url to the git version but the same results.
It only downloads and installs that dependency if I use it in the root composer.json
"type": "package",
"package": {
"name": "abc/xyz",
"version": "1.2",
"dist": {
"url": "url to zip folder of the forked version",
"type": "zip"
},
"type": "library",
"require": {
"xyz/abc": "^2.4",
}
}
Is this a standard way? OR I am doing something wrong here?
When you use a repository of type package, the linked package's composer.json is not read.
The package type is meant to define the composer.json file inline, mostly for packages that do not support composer.
From the docs:
package: If you depend on a project that does not have any support for Composer whatsoever you can define the package inline using a package repository. You basically inline the composer.json object.
(emphasis mine)
If your package does support composer (e.g. includes a composer.json file that defines dependencies, autoloader, etc.), use type vcs.
To use a forked version, you simply add a repository that includes the forked version. Typically, for forks I simply depend on dev-master/dev-main, because the fork is not really published and only includes some hot-fixes that do not exist in the "main" package. Or dev-whatever-branch-your-fixes-exist.
Assuming your fork of xyz/abc is hosted on https://github.com/ahmad/abc, your root composer.json should be something like:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ahmad/abc"
}
],
"require": {
"xyz/abc": "dev-master"
}
}
(Just added the relevant parts, obviously this doesn't mean you have to delete the rest of your root composer.json file, just change the appropriate bits)
In composer.json I entered "nex/yii2-datepicker" : "*" in require section and minimum stability is stable. Now I run composer update, then foll error is displayed
Loading composer repositories with package information
Updating dependencies (including require-dev)
Content-Length mismatch
http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package nex/yii2-datepicker * is satisfiable by nex/yii2-datepicker[dev-master] but these conflict with your requirements or minimum-stability
Replace in composer.json
"minimum-stability": "stable",
to
"minimum-stability": "dev",
"prefer-stable": true,
I am trying to create a custom vendor package but have not yet put the package on packagist. According to the docs, the package can be loaded from git (vcs) instead of packagist: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository
The yii2 project (although don't think framework matters) I have created package inside vendor folder:
foundationize/yii2-foundation
(folder structure is as above, I have quadruple-checked).
My root public_html/composer.json has following entries:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-swiftmailer": "*",
"foundationize/yii2-foundation": "dev-master"
},
My package composer file, vendor/foundationize/yii2-foundation/composer.json looks like:
{
"name": "foundationize/yii2-foundation",
"description": "The Foundation extension for the Yii2 framework",
"keywords": ["yii2", "foundation"],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/foundationize/yii2-foundation/issues",
"wiki": "https://github.com/foundationize/yii2-foundation/wiki",
"source": "https://github.com/foundationize/yii2-foundation.git"
},
"authors": [
{
"name": "gvanto",
"email": "gvanto#hotmail.com",
"homepage": "http://foundationize.com"
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"foundationize\\foundation\\": ""
}
},
"repositories": [
{
"packagist": false,
"type": "vcs",
"url": "https://github.com/foundationize/yii2-foundation.git"
}
]
}
When I run composer install (or update), I keep getting error below:
Your requirements could not be resolved to an installable set of
packages.
Problem 1
- The requested package foundationize/yii2-foundation could not be found in any version, there may be a typo in the package name.
Potential causes:
A typo in the package name
The package is not available in a stable-enough version according to your minimum-stability setting see
https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion
for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for
further common problems.
I have googled it high and low, read the docs can't seem to get it to work (always the same error, which I actually think would be more useful if it said either the package was not found OR the incorrect package version was found).
You have to add the repositories entry to your root composer.json file. Otherwise, Composer does not know where to search for your package.
Had a similar problem to this and it was because I was running composer in the /web directory in the new Drupal structure. When I ran it in the root all was fine. Annoyingly, you need to run Drush in /web
Since Laravel version 5.5 there is a Package Auto-Discovery feature, so there is no need to add service provider. All you need to register package like this:
composer require barryvdh/laravel-debugbar:dev-master
You can find more info in these articles:
https://medium.com/#taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518
https://divinglaravel.com/laravels-package-auto-discovery
I'm trying to update this test extension to my project but I encountered an error:
adz#adz:/var/www/site$ php composer.phar update
Loading composer repositories with package information Updating
dependencies (including require-dev)
Nothing to install or update
I also tried
adz#adz:/var/www/site$ php composer.phar require adz/yii2-featureditems:dev-master
./composer.json has been updated
Package "adz/yii2-featureditems" listed for update is not installed.
Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Here is my composer.json file
{
"repositories":[
{
"type": "git",
"url": "https://github.com/adzayko/featured-items.git"
}
],
"require": {
"adz/yii2-featureditems": "dev-master"
}
}