Comments (5)
When you add Foxy in the require
or require-dev
section (make optional Foxy), it's only to enable Foxy for the PHP library (see the doc Use the plugin in PHP library). In addition, when you install a NPM dependency, this one never installs dev dependencies (only the dependencies in the root package.json file), so, Foxy has the same behavior, which is why you do not have the desired behavior.
Given that the dev dependencies of the JS library are Given that the dev dependencies of a JS library are present only for its development, the dev dependencies are never installed by NPM/Yarn, and Foxy keeps this behavior.
On the other hand I understand your wait, and it would be interesting to add a new option to activate the possibility of injecting devDependencies
from the package.json file of the PHP library into the root package.json file (like extra.foxy.dev-dependencies = true
, disabled by default).
In this case, and regarding your example, you should use the dev-dependencies
section and not dependencies
in the package.json file of the PHP library.
from foxy.
Thank you for your quick reply.
When you add Foxy in the
require
orrequire-dev
section (make optional Foxy), it's only to enable Foxy for the PHP library (see the doc Use the plugin in PHP library). In addition, when you install a NPM dependency, this one never installs dev dependencies (only the dependencies in the root package.json file), so, Foxy has the same behavior, which is why you do not have the desired behavior.
Given that the dev dependencies of the JS library are Given that the dev dependencies of a JS library are present only for its development, the dev dependencies are never installed by NPM/Yarn, and Foxy keeps this behavior.
Unfortunatly this is not possible for us as we want to install dev and no-dev dependencies with foxy.
On the other hand I understand your wait, and it would be interesting to add a new option to activate the possibility of injecting
devDependencies
from the package.json file of the PHP library into the root package.json file (likeextra.foxy.dev-dependencies = true
, disabled by default).In this case, and regarding your example, you should use the
dev-dependencies
section and notdependencies
in the package.json file of the PHP library.
I'm not completely sure if I understood you correctly. From our point of view it would be perfect if the deciding factor would be if the composer-package is added as dev or no dev. So composer require --dev libname
would result in all package.json packages (no matter if dev or no dev from npm point of view) be stored in the dev section of the resulting package.json of the main project.
As a cherry on top, it would be nice to have dependencies in the dev section of the package.json of the library always installed as dev dependency in the main package.json of the project but that would by far not be necessary for our use case.
As an practical example you may use our composer library zooroyal/coding-standard found on github and packagist.org. Obviously we only want to install this lib in our project as dev dependency. When we do it that way it results in a package.json in our main project which contains the npm dependencies. So far so good.
By the time we want to deploy the project we want to use composer install --no-dev
so dev dependencies are not installed. This results in npm throwing errors.
So executing:
composer require --dev zooroyal/coding-standard
composer install
composer install --no-dev
Results in:
npm WARN checkPermissions Missing write access to /project-path/node_modules/@composer-asset/zooroyal--coding-standard
npm ERR! path /project-path/node_modules/@composer-asset/zooroyal--coding-standard
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access '/project-path/node_modules/@composer-asset/zooroyal--coding-standard'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
from foxy.
Hello,
we will be working on a solution for that issue.
Our approach will be an extension to the foxyscripts that rewrites the name before storing it in the "/node_modules/@composer-asset/"-folder.
The idea is to identify if the current package is required as dev and if so the corrosponding section will be replaced in the "/vendor/foxy/composer/.../package.json".
We identified the "AssetUtil.php" with the "formatPackage" function to be our point of entry.
We would like to inform you about our endeavour because we want to provide our solution as a pull request for you as soon as its finished.
If you have any suggestions that could help us please let us know.
Thank you in advance!
from foxy.
Hello @rdss-hmorsi, thank you for your help, and in this case, I await your Pull Request :-).
from foxy.
If you wish, it is possible to add this improvement for version 1.2
. However, you have to rebase the Pull Request with the main branch 1.2
.
from foxy.
Related Issues (20)
- Infinite loop HOT 1
- Install/update ends with npm error: "invalid version dev-master" HOT 18
- aggregating common devDependencies? HOT 8
- Asset paths in libraries HOT 11
- Add support for the old versions of NPM <5.0 HOT 5
- I made a plugin for Yii2 to use your plugin, can you watch it and give me some suggestion? HOT 15
- Yarn update should use install instead of upgrade HOT 6
- Install npm dependencies of composer dependency HOT 1
- Problems with npm package stisla HOT 1
- Support Composer 2 HOT 11
- Issues with composer 2.1 HOT 4
- Support for Usage, confused on documentation
- Make compatible with Yarn 2 HOT 1
- Running composer install is updating package-lock.json HOT 1
- Running composer update --lock updates package-lock.json
- v1.2.0 no more works with PHP less than 7.1 HOT 2
- Default value of "manager-timeout" setting is incompatible with Composer 2.3+ HOT 2
- Support pnpm
- The code not compatible with new Composer version 2.6.6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foxy.