Giter Site home page Giter Site logo

fxpio / foxy Goto Github PK

View Code? Open in Web Editor NEW
172.0 12.0 21.0 262 KB

A fast, reliable, and secure NPM/Yarn/pnpm bridge for Composer

Home Page: https://foxypkg.com

License: MIT License

PHP 100.00%
php composer npm yarn bridge dependency-manager composer-plugin foxy

foxy's Introduction

Foxy

Latest Version Build Status Coverage Status Packagist Downloads

Foxy is a Composer plugin to automate the validation, installation, updating and removing of PHP libraries asset dependencies (javaScript, stylesheets, etc.) defined in the NPM package.json file of the project and PHP libraries during the execution of Composer. It handles restoring the project state in case NPM or Yarn or pnpm terminates with an error. All features and tools are available: Npmrc, Yarnrc, Webpack, Gulp, Grunt, Babel, TypeScript, Scss/Sass, Less, etc.

It is certain that each language has its own dependency management system, and that it is highly recommended to use each package manager. NPM, Yarn or pnpm works very well when the asset dependencies are managed only in the PHP project, but when you create PHP libraries that using assets, there is no way to automatically add asset dependencies, and most importantly, no validation of versions can be done automatically. You must tell the developers the list of asset dependencies that using by your PHP library, and you must ask him to add manually the asset dependencies to its asset manager of his project.

However, another solution exist - what many projects propose - you must add the assets in the folder of the PHP library (like /assets, /Resources/public). Of course, with this method, the code is duplicated, it pollutes the source code of the PHP library, no version management/validation is possible, and it is even less possible, to use all tools such as Babel, Scss, Less, etc ...

Foxy focuses solely on automation of the validation, addition, updating and deleting of the dependencies in the definition file of the asset package, while restoring the project state, as well as PHP dependencies if NPM, Yarn or pnpm terminates with an error.

It is Fast

Foxy retrieves the list of all Composer dependencies to inject the asset dependencies in the file package.json, and leaves the execution of the analysis, validation and downloading of the libraries to NPM, Yarn or pnpm. Therefore, no VCS Repository of Composer is used for analyzing the asset dependencies, and you keep the performance of native package manager used.

It is Reliable

Foxy creates mock packages of the PHP libraries containing only the asset dependencies definition file in a local directory, and associates these packages in the asset dependencies definition file of the project. Given that Foxy does not manipulate any asset dependencies, and let alone the version constraints, this allows NPM, Yarn or pnpm to solve the asset dependencies without any intermediary. Moreover, the entire validation with the lock file and installation process is left to NPM, Yarn or pnpm.

It is Secure

Foxy restores the Composer lock file with all its PHP dependencies, as well as the asset dependencies definition file, in the previous state if NPM, Yarn or pnpm ends with an error.

Features

  • Compatible with Symfony Webpack Encore and Laravel Mix
  • Works with Node.js and NPM, Yarn or pnpm
  • Works with the asset dependencies defined in the package.json file for projects and PHP libraries
  • Works with the installation in the dependencies of the project or libraries (not in global mode)
  • Works with public or private repositories
  • Works with all features of Composer, NPM, Yarn and pnpm
  • Retains the native performance of Composer, NPM, Yarn and pnpm
  • Restores previous versions of PHP dependencies and the lock file if NPM, Yarn or pnpm terminates with an error
  • Validates the NPM, Yarn or pnpm version with a version range
  • Configuration of the plugin per project, globally or with the environment variables:
    • Enable/disable the plugin
    • Choose the asset manager: NPM, Yarn or pnpm (npm is used by default)
    • Lock the version of the asset manager with the Composer version range
    • Define the custom path of binary of the asset manager
    • Enable/disable the fallback for the asset package file of the project
    • Enable/disable the fallback for the Composer lock file and its dependencies
    • Enable/disable the running of asset manager to keep only the manipulation of the asset package file
    • Override the install command options for the asset manager
    • Override the update command options for the asset manager
    • Define the custom path of the mock package of PHP library
    • Enable/disable manually the asset packages for the PHP libraries
  • Works with the Composer commands:
    • install
    • update
    • require
    • remove

Documentation

Installation

Installation instructions are located in the guide.

License

Foxy is released under the MIT license. See the complete license in:

LICENSE

About

Foxy is a François Pluchino initiative. See also the list of contributors.

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

Acknowledgments

Thanks to Tobias Munk to have suggesting this name

foxy's People

Contributors

christopher-hopper avatar francoispluchino avatar mekdrop avatar mindplay-dk avatar samdark avatar sammousa avatar schmunk42 avatar soren121 avatar staabm avatar steffendietz avatar szepeviktor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foxy's Issues

foxy does not split packages in dev and production packages

Situation is the following:
package.json of library

[...]
"dependencies": {
    "example": "1",
  }
[...]

composer.json of project

[...]
"require-dev": {
    "library-name" : "1.0"
},
[...]

resulting package.json of project after installation with foxy

[...]
"dependencies": {
    "@library-name": "file:./vendor/foxy/composer-asset/library-name"
}
[...]

expected result in package.json

[...]
"devDependencies": {
    "@library-name": "file:./vendor/foxy/composer-asset/library-name"
}
[...]

I'm not quite sure if I overlooked something in the documentation or if there is another way to get foxy to do what we like it to do. As it is right now we found no way to make foxy install dev dependencies as such. As they are absent when we do a composer install --no-dev we get npm errors.

The binary of "npm" must be installed

Playing around with the foxy....

The binary of "npm" must be installed
  • could it also be yarn?
  • do I really need to install it, could there be a --ignore-node-packages option, just to move on (like a dry-run)?
  • would be nice to have links to the installation pages

Easy transition from composer-asset-plugin to foxy

Could there be a functionality to support cap syntax? Like so...

  • convert npm- into entries in packages.json.
  • don't use them in composer solver
  • run composer installation
  • run foxy

Maybe even with a mapping for bower-Xyz.js to npm-xyz if needed. (optional)

Install npm dependencies of composer dependency

I'm working on a project that has multiple composer dependencies. One of these dependencies has a frontend dependency. When I run composer install on dependency directory, foxy works like a charm. When I run composer install in the project directory, it installs extension as a composer dependency, but npm install runs in the project directory instead of the dependency directory, so package.json file is not found and npm dependencies are not installed. And an empty package.json file appears in the project directory. Is it a not supported feature or my configuration is wrong?

Extension:

composer.json

...
"type": "extension",
"require": {
    "foxy/foxy": "^1.0.0"
},
"config": {
    "foxy": {
        "manager": "npm",
        "manager-options": "--prefix views"
    }
},
...

views/package.json
// some npm dependency

Project

composer.json

...
"require": {
    "extension": "^1.0.0"
}
...

The code not compatible with new Composer version 2.6.6

image
PHP Fatal error: Declaration of Foxy\Json\JsonFile::encode($data, $options = 448) must be compatible with Composer\Json\JsonFile::encode($data, int $options = 448, string $indent = self::INDENT_DEFAULT): string in /www/wwwroot/yii-advanced-application/vendor/foxy/foxy/Json/JsonFile.php on line 98
the method definition not compatible with the class it inherit of

Problems with npm package stisla

For my new project I wanted to have asset management which I didn't use before. I tried foxy and asset-packagist for comparison and figured out I love foxy more. Along my playground work, I found that foxy behaves unfavourably when fetching the stisla package from npm (compared to using https://asset-packagist.org/package/npm-asset/stisla). The difference is, that foxy doesn't build stisla's dist/modules/* directory, whereas asset-packagist (and by extension the composer-asset-plugin which i never made to successfully run when installing stisla) does. After some hours of trying to reconcile the difference, I thought I better ask as there might be some obvious config option to foxy which is not so obvious to me. I'll be happy for any tips & tricks.

p.s.: I'm using yarn as the foxy backend, esp. because it usually works way better then npm for me.

Support Composer 2

composer-plugin-api for upcoming Composer 2 (can be installed with composer self-update --snapshot) has version 2.0.0.

The foxy/foxy package requires composer-plugin-api version 1.0.0 thus can't be used with Composer 2.

Make compatible with Yarn 2

I decided to try Yarn 2 instead of npm and found that Yarn 2 does not work with foxy.

Yarn 2 has done away with node_modules folder, which is why it looked appealing.

Running composer update returns:

Installing yarn dependencies
➤ YN0050: The --non-interactive option is deprecated
Fallback to previous state for the Asset package
Fallback to previous state for Composer
Installing dependencies from lock file (including require-dev)

  [RuntimeException]
  The asset manager ended with an error

Infinite loop

After trying to install this plugin composer started looping infinitely

aggregating common devDependencies?

The README mentions:

All features and tools are available: Npmrc, Yarnrc, Webpack, Gulp, Grunt, Babel, TypeScript, Scss/Sass, Less, etc.

These are all tools you'd use at development-time, meaning the source-code itself is going to have build-time dependencies on specific version of tools like tsc, node-sass, webpack, etc.

It's my understanding that devDependencies aren't aggregated like dependencies?

I should explain what I'm hoping to do: I'd like to use Foxy to aggregate the npm-dependencies of Composer packages - then use webpack at the project-level to build and bundle all the front-end dependencies of the Composer packages.

To run webpack, I'll need common dev-dependencies like Typescript and node-sass, etc.

In order for that to work, it's important to come up with a common set of dev-dependencies at the project-level - for example, a project that requires a Composer packages that has a devDependency on typescript^2 should conflict with another Composer package that requires typescript^3.

Same for node-sass, and for webpack itself, and so on.

Is this use-case supported? Will it support a truly modular architecture, in which Composer packages effectively contribute both server-side and front-end dependencies?

Or how do you use Foxy in practice? (I have read the documentation, but it's quite abstract and seems to mostly deal with technical details like using/configuring the tool, and only a brief overview of the practical use-cases? Please let me know if I've overlooked something!)

Add support for the old versions of NPM <5.0

I get this error when running composer update (with foxy):

Updating npm dependencies
npm ERR! Linux 4.4.0-72-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "update"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2

npm ERR! Cannot read property 'version' of undefined
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/sol/prj/yiisoft/yii-twig/npm-debug.log
Fallback to previous state for the Asset package

When I run npm update directly I receive no error.

What could it be?
Thank you in advance!

Keep the indentation of JSON file

When the package.json is formatted, the indent with 2 spaces become a indent with 4 spaces.

It's caused by the json_encode() function.

Asset paths in libraries

Suppose I have a library that needs some npm package(s).
Normally I would just assume these assets are manually installed (and therefore located in the node_modules folder).
Obviously when using foxy this will no longer be the case.

How would my library know where to look for the assets?
Should foxy create something like symlinks to the main node_modules folder? Or should it somehow make the location of that folder available to the PHP world?

On the PHP side with composer we basically no longer care about paths since we have autoloading; for assets however we still need the path or the URL or a way to publish them without knowing the path.
Ideally we would want to support this without requiring changes in the libraries themselves...

Read asset dependencies from a composer file as a fallback

I am working on a way to provide asset installation even without npm or yarn installed - just for quick-starting projects.

An idea woud be to use https://asset-packagist.org/ in conjunction with https://github.com/wikimedia/composer-merge-plugin - having asset definitions in separate files like composer.asset.json (described also in https://github.com/yiisoft/yii2/issues/14862#issuecomment-369303919) - they only define npm-asset/xyz...

Would it be an option for foxy to use those files instead of packages.json as a fallback?

Support for Usage, confused on documentation

Hi,

PHP: 7.4.14
CakePHP 4.2.7
Composer 2.1.3
OS: Windows 10

I was able to follow the instructions for installation correctly. I now have a /node_modules folder in my project root.
I'm confused on what to do next.

CakePHP expects JS dependencies in /webroot/js. (/webroot is public)
I'm familiar with nodejs method of including modules by import { X } from '@x/y'

Those are not going to look in the same place.
What method should I use to make these accessible? Moving node_modules into the public scope seems incorrect.

Isn't there also an npm deploy or npm run method that is meant to be run? I'm not very familiar with nodejs/npm.

Thank you!

(I did search around for quite a while, but nothing I could find seemed like a "right" way to do it)

enabled false, still triggers yarn

Even though I have this conifg:

    "config": {
        "foxy": {
            "enabled": false,
            "manager": "yarn",
            "enable-packages": {
                "*": true
            }
        },
    }

I get this error

Installs: foxy/foxy:dev-master c8225f7, psr/http-message:1.0.1, psr/log:1.0.2, psr/simple-cache:1.0.0, cebe/markdown:1.1.2, yiisoft/yii2-dev:2.1.x-dev 603c084, codemix/yii2-streamlog:1.2.1
  - Installing foxy/foxy (dev-master c8225f7): Cloning c8225f715cbe0b9310972e3d67ca15955691a26e from cache
Plugin installation failed, rolling back
  - Removing foxy/foxy (dev-master)

                                          
  [Foxy\Exception\RuntimeException]       
  The binary of "yarn" must be installed  
                                          

How to run composer install on production systems? No npm, yarn, ... available.

Hello,

I recently installed my project to the live system. Now I want to do a composer install. Unfortunately now everytime the composer hook runs and looks for yarn or npm (which of course are both not installable on a live server). Is there any flag to deactivate foxy while running composer install?

Removing the foxy section from composer.json didn't help either :-(

Bye Defcon0

Install/update ends with npm error: "invalid version dev-master"

This project looks great, and I'm really excited about the prospect of finally being able to manage the front-end dependencies of our Composer packages!

As of yet, I haven't had any luck trying it out though - every composer install or composer update ends with an npm error.

Here's the (verbose) output:

$ composer install -v
KODUS 2 installer enabled
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Dependency resolution completed in 0.002 seconds
Analyzed 290 packages to resolve dependencies
Analyzed 1058 rules to resolve dependencies
Nothing to install or update
Package http-interop/http-server-handler is abandoned, you should avoid using it. Use psr/http-server-handler instead.
Package http-interop/http-server-middleware is abandoned, you should avoid using it. Use psr/http-server-middleware instead.
Generating autoload files
Merging Composer dependencies in the asset package
Installing npm dependencies
npm ERR! Invalid version: "dev-master"

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mindplay/.npm/_logs/2018-09-06T09_16_38_957Z-debug.log
Fallback to previous state for the Asset package
Fallback to previous state for Composer
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Dependency resolution completed in 0.003 seconds
Analyzed 290 packages to resolve dependencies
Analyzed 1058 rules to resolve dependencies
Nothing to install or update
Package http-interop/http-server-handler is abandoned, you should avoid using it. Use psr/http-server-handler instead.
Package http-interop/http-server-middleware is abandoned, you should avoid using it. Use psr/http-server-middleware instead.
Generating autoload files


  [RuntimeException]
  The asset manager ended with an error


Exception trace:
 () at /mnt/c/workspace/test/staging_project/vendor/foxy/foxy/Solver/Solver.php:108
 Foxy\Solver\Solver->solve() at /mnt/c/workspace/test/staging_project/vendor/foxy/foxy/Foxy.php:131
 Foxy\Foxy->solveAssets() at n/a:n/a
 call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:176
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:96
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/bin/composer/src/Composer/Installer.php:323
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/InstallCommand.php:119
 Composer\Command\InstallCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:242
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:843
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:251
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:100
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:59
 require() at /usr/bin/composer:24

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

Here's the output of the debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session d6096af3659c374f
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall staging_project
7 info lifecycle @~preinstall: @
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 12ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 5ms
16 silly install loadAllDepsIntoIdealTree
17 silly fetchPackageMetaData error for @composer-asset/kodus--media@file:vendor/foxy/composer-asset/kodus/media Invalid version: "dev-master"
18 timing stage:rollbackFailedOptional Completed in 0ms
19 timing stage:runTopLevelLifecycles Completed in 251ms
20 silly saveTree staging_project
21 verbose stack Error: Invalid version: "dev-master"
21 verbose stack     at Object.fixVersionField (/usr/lib/node_modules/npm/node_modules/normalize-package-data/lib/fixer.js:191:13)
21 verbose stack     at /usr/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:32:38
21 verbose stack     at Array.forEach (<anonymous>)
21 verbose stack     at normalize (/usr/lib/node_modules/npm/node_modules/normalize-package-data/lib/normalize.js:31:15)
21 verbose stack     at new Manifest (/usr/lib/node_modules/npm/node_modules/pacote/lib/finalize-manifest.js:121:3)
21 verbose stack     at tarballedProps.then.props (/usr/lib/node_modules/npm/node_modules/pacote/lib/finalize-manifest.js:50:13)
21 verbose stack     at tryCatcher (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
21 verbose stack     at Promise._settlePromiseFromHandler (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
21 verbose stack     at Promise._settlePromise (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
21 verbose stack     at Promise._settlePromiseCtx (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:606:10)
21 verbose stack     at Async._drainQueue (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
21 verbose stack     at Async._drainQueues (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
21 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (/usr/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
21 verbose stack     at runCallback (timers.js:763:18)
21 verbose stack     at tryOnImmediate (timers.js:734:5)
21 verbose stack     at processImmediate (timers.js:716:5)
22 verbose cwd /mnt/c/workspace/test/staging_project
23 verbose Linux 4.4.0-17134-Microsoft
24 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
25 verbose node v9.11.2
26 verbose npm  v6.3.0
27 error Invalid version: "dev-master"
28 verbose exit [ 1, true ]

I am just trying it out, so for now, I've manually listed two packages that have package files via configuration in my project's composer.json:

    "config": {
        "foxy": {
            "enable-packages": {
                "kodus/media": true,
                "kodus/media-admin": true
            }
        }
    }

Both of these packages are on unable dev-branches, both named 1.0.0.

The package.json files in those two packages both list some "dependencies" for some npm packages.

If understand correctly, the idea is Foxy will aggregate these to a collective package.json for the project containing all the npm-dependencies of those two packages?

Any idea what I'm doing wrong?

Default value of "manager-timeout" setting is incompatible with Composer 2.3+

Foxy's documentation describes the "manager-timeout" config option as being a nullable integer, with the default being null. In Composer 2.3, the ProcessExecutor class has been updated, and its setTimeout method now requires an int value for the timeout parameter. This makes Foxy's default configuration incompatible with Composer 2.3+.

Here's the stack trace thrown when using the default configuration with Composer 2.3:

Merging Composer dependencies in the asset package
yarn check v1.22.18
success Folder in sync.
Done in 0.44s.
Updating yarn dependencies

In ProcessExecutor.php line 388:
                                                                                                                                                                                                  
  [TypeError]                                                                                                                                                                                     
  Argument 1 passed to Composer\Util\ProcessExecutor::setTimeout() must be of the type int, null given, called in /home/nicholas/projects/test/vendor/foxy/foxy/Asset/AbstractAssetManage  
  r.php on line 210                                                                                                                                                                               
                                                                                                                                                                                                  

Exception trace:
  at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Util/ProcessExecutor.php:388
 Composer\Util\ProcessExecutor::setTimeout() at /home/nicholas/projects/test/vendor/foxy/foxy/Asset/AbstractAssetManager.php:210
 Foxy\Asset\AbstractAssetManager->run() at /home/nicholas/projects/test/vendor/foxy/foxy/Solver/Solver.php:103
 Foxy\Solver\Solver->solve() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Plugin/PluginManager.php(273) : eval()'d code:205
 Foxy\Foxy_composer_tmp0->solveAssets() at n/a:n/a
 call_user_func() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:202
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:125
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Installer.php:372
 Composer\Installer->run() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Command/UpdateCommand.php:241
 Composer\Command\UpdateCommand->execute() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/vendor/symfony/console/Application.php:1015
 Symfony\Component\Console\Application->doRunCommand() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/vendor/symfony/console/Application.php:299
 Symfony\Component\Console\Application->doRun() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Console/Application.php:334
 Composer\Console\Application->doRun() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/src/Composer/Console/Application.php:130
 Composer\Console\Application->run() at phar:///home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar/bin/composer:83
 require() at /home/nicholas/.phpenv/versions/7.4.28/composer/composer.phar:29

A workaround for now is to set a non-null "manager-timeout" value in your composer.json ("300" is the default in Composer):

"config": {
    "foxy": {
        "manager-timeout": 300
    },
    "allow-plugins": {
        "foxy/foxy": true
    }
},

Issues with composer 2.1

Hello,

I tested foxy with the new composer version 2.1 with the following result:

PHP Fatal error:  Uncaught TypeError: Argument 3 passed to Composer\Package\Locker::__construct() must be an instance of Composer\Installer\InstallationManager, instance of Composer\Repository\RepositoryManager given, called in /home/dev/some_dir/acme/project/vendor/foxy/foxy/Util/LockerUtil.php on line 41 and defined in phar:///usr/local/bin/composer/src/Composer/Package/Locker.php:60
Stack trace:
#0 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Util/LockerUtil.php(41): Composer\Package\Locker->__construct()
#1 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Fallback/ComposerFallback.php(101): Foxy\Util\LockerUtil::getLocker()
#2 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Foxy.php(179): Foxy\Fallback\ComposerFallback->save()
#3 [internal function]: Foxy\Foxy->init()
#4 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(190): call_user_func()
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.p in phar:///usr/local/bin/composer/src/Composer/Package/Locker.php on line 60

Fatal error: Uncaught TypeError: Argument 3 passed to Composer\Package\Locker::__construct() must be an instance of Composer\Installer\InstallationManager, instance of Composer\Repository\RepositoryManager given, called in /home/dev/some_dir/acme/project/vendor/foxy/foxy/Util/LockerUtil.php on line 41 and defined in phar:///usr/local/bin/composer/src/Composer/Package/Locker.php:60
Stack trace:
#0 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Util/LockerUtil.php(41): Composer\Package\Locker->__construct()
#1 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Fallback/ComposerFallback.php(101): Foxy\Util\LockerUtil::getLocker()
#2 /home/dev/some_dir/acme/project/vendor/foxy/foxy/Foxy.php(179): Foxy\Fallback\ComposerFallback->save()
#3 [internal function]: Foxy\Foxy->init()
#4 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(190): call_user_func()
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.p in phar:///usr/local/bin/composer/src/Composer/Package/Locker.php on line 60

It seems foxy is not yet compatible with 2.1, or do I need to configure something?

Thanks!

Bye Defcon0

Support pnpm

It is possible to add support for pnpm, thks.

v1.2.0 no more works with PHP less than 7.1

Thank you for creating this excellent composer plugin!

Commit 7d3d824 introduced at least one PHP 7.1+ feature, a nullable type, in

public function __construct(
        IOInterface $io,
        Config $config,
        ProcessExecutor $executor,
        Filesystem $fs,
        FallbackInterface $fallback = null,
        ?VersionConverterInterface $versionConverter = null
    ) {
        $this->io = $io;
        ...
   }

Despite this breaking change the foxy version number did not bump to 2.0.0 and composer.json still requires only php >= 5.3.3:

{
    ...
    "require": {
        "php": ">=5.3.3",
        ...
    },
    ...

This is the first error encountered when running composer with PHP < 7.1. Maybe there are more.

Petr

The asset manager ended with an error

Running in a Docker container...

/ # ./composer.phar require foxy/foxy:@dev
Do not run Composer as root/super user! See https://getcomposer.org/root for details
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing foxy/foxy (dev-master 8857b24): Cloning 8857b2426a from cache
Writing lock file
Generating autoload files
Installing npm dependencies
npm ERR! Linux 4.9.0-3-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code EINVALIDTYPE

npm ERR! typeerror Error: Argument #1: Expected object but got array
npm ERR! typeerror     at moduleName (/usr/lib/node_modules/npm/lib/utils/module-name.js:25:3)
npm ERR! typeerror     at module.exports (/usr/lib/node_modules/npm/lib/utils/package-id.js:9:14)
npm ERR! typeerror     at build.linkStuff (/usr/lib/node_modules/npm/lib/build.js:105:25)
npm ERR! typeerror     at Array.<anonymous> (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
npm ERR! typeerror     at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
npm ERR! typeerror     at chain (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:5)
npm ERR! typeerror     at module.exports (/usr/lib/node_modules/npm/lib/install/action/build.js:9:3)
npm ERR! typeerror     at actions.(anonymous function) (/usr/lib/node_modules/npm/lib/install/actions.js:48:12)
npm ERR! typeerror     at execAction (/usr/lib/node_modules/npm/lib/install/actions.js:98:7)
npm ERR! typeerror     at exports.doOne (/usr/lib/node_modules/npm/lib/install/actions.js:103:3)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
Fallback to previous state for the Asset package
Fallback to previous state for Composer

Installation failed, deleting ./composer.json.

                                         
  [RuntimeException]                     
  The asset manager ended with an error  
                                         

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

[update]

Looks like a missing packages.json, should be auto-created.

[RuntimeException] The asset manager ended with an error

Hello,

we just saw this plugin and would love to integrate it into our libraries. What I did is the following:

  1. Require foxy in the project's composer.json
  2. Added the following to the project's composer.json:
"foxy": {
      "manager": "yarn",
      "manager-version": "^1.5.0"
    },
  1. Added the extra flag foxy: true in the library's composer.json
  2. Added the package.json to the library.
  3. Run composer update in my project.

After running composer update, I get:

() at /home/myuser/Kunden/customer/proj/produkte/contao/vendor/foxy/foxy/Solver/Solver.php:108
Foxy\Solver\Solver->solve() at /home/myuser/Kunden/customer/proj/produkte/contao/vendor/foxy/foxy/Foxy.php:131
Foxy\Foxy->solveAssets() at n/a:n/a
call_user_func() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:171
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:96
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:322
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:161
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:242
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:842
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:251
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:58
require() at /usr/local/bin/composer:24

The generated file package.jsonin the vendor/foxy folder is

{
"dependencies": {
"masonry-layout": "^4.2"
},
"name": "@composer-asset/heimrichhannot--contao-list-bundle",
"version": "dev-master"
}

In case you want to check the files in our library, it's https://github.com/heimrichhannot/contao-list-bundle

Thanks in advance.

Bye

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.