Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

devDependencies installed even with --no-dev #269

Closed
nazar-pc opened this issue Dec 30, 2016 · 17 comments
Closed

devDependencies installed even with --no-dev #269

nazar-pc opened this issue Dec 30, 2016 · 17 comments
Assignees
Milestone

Comments

@nazar-pc
Copy link

Composer 1.3.0 stable
fxp/composer-asset-plugin 1.2.2 stable

package.json:

{
    "require": {
        "npm-asset/mammoth": "^1.3"
    }
}

What should be installed (dependencies tree without devDependencies on any level):

 nazar-pc  /  tmp  mammoth  npm-remote-ls -d=false mammoth                                                                                                                                                                            
└─ [email protected]
   ├─ [email protected]
   ├─ [email protected]
   │  ├─ [email protected]
   │  ├─ [email protected]
   │  │  └─ [email protected]
   │  └─ [email protected]
   ├─ [email protected]
   │  └─ [email protected]
   ├─ [email protected]
   │  └─ [email protected]
   ├─ [email protected]
   ├─ [email protected]
   ├─ [email protected]
   │  └─ [email protected]
   └─ [email protected]

And now look at this (ignore error for now):

 nazar-pc  /  tmp  mammoth  composer update --no-dev --prefer-dist -v                                                                                                                                                             2  
Loading composer repositories with package information
Updating dependencies
Adding VCS repository npm-asset/mammoth
Adding VCS repository npm-asset/bluebird
Adding VCS repository npm-asset/sax     
Adding VCS repository npm-asset/underscore
Adding VCS repository npm-asset/lop       
Adding VCS repository npm-asset/argparse
Adding VCS repository npm-asset/jszip   
Adding VCS repository npm-asset/xmlbuilder
Adding VCS repository npm-asset/path-is-absolute
Adding VCS repository npm-asset/option          
Adding VCS repository npm-asset/duck  
Adding VCS repository npm-asset/lodash
Adding VCS repository npm-asset/sprintf-js
Adding VCS repository npm-asset/istanbul  
Adding VCS repository npm-asset/pako    
Reading package.json of npm-asset/lodash (3.11.0-patch1)
Importing tag 3.11.0-patch1 (3.11.0.0-patch1)
Reading package.json of npm-asset/lodash (3.10.3-patch1)
Importing tag 3.10.3-patch1 (3.10.3.0-patch1)
Reading package.json of npm-asset/lodash (3.10.2-patch1)
Importing tag 3.10.2-patch1 (3.10.2.0-patch1)
Reading package.json of npm-asset/lodash (3.10.1-patch1)
Importing tag 3.10.1-patch1 (3.10.1.0-patch1)
Reading package.json of npm-asset/lodash (3.10.0-patch1)
Importing tag 3.10.0-patch1 (3.10.0.0-patch1)
Reading package.json of npm-asset/lodash (3.9.3-patch1)
Importing tag 3.9.3-patch1 (3.9.3.0-patch1)
Reading package.json of npm-asset/lodash (3.9.2-patch1)
Importing tag 3.9.2-patch1 (3.9.2.0-patch1)
Reading package.json of npm-asset/lodash (3.9.1-patch1)
Importing tag 3.9.1-patch1 (3.9.1.0-patch1)
Reading package.json of npm-asset/lodash (3.9.0-patch1)
Importing tag 3.9.0-patch1 (3.9.0.0-patch1)
Reading package.json of npm-asset/lodash (3.8.2-patch1)
Importing tag 3.8.2-patch1 (3.8.2.0-patch1)
Reading package.json of npm-asset/lodash (3.8.1-patch1)
Importing tag 3.8.1-patch1 (3.8.1.0-patch1)
Reading package.json of npm-asset/lodash (3.8.0-patch1)
Importing tag 3.8.0-patch1 (3.8.0.0-patch1)
Reading package.json of npm-asset/lodash (3.7.4-patch1)
Importing tag 3.7.4-patch1 (3.7.4.0-patch1)
Reading package.json of npm-asset/lodash (3.7.3-patch1)
Importing tag 3.7.3-patch1 (3.7.3.0-patch1)
Reading package.json of npm-asset/lodash (3.7.2-patch1)
Importing tag 3.7.2-patch1 (3.7.2.0-patch1)
Reading package.json of npm-asset/lodash (3.7.1-patch1)
Importing tag 3.7.1-patch1 (3.7.1.0-patch1)
Reading package.json of npm-asset/lodash (3.7.0-patch1)
Importing tag 3.7.0-patch1 (3.7.0.0-patch1)
Reading package.json of npm-asset/lodash (3.6.2-patch1)
Importing tag 3.6.2-patch1 (3.6.2.0-patch1)
Reading package.json of npm-asset/lodash (3.6.1-patch1)
Importing tag 3.6.1-patch1 (3.6.1.0-patch1)
Reading package.json of npm-asset/lodash (3.6.0-patch1)
Importing tag 3.6.0-patch1 (3.6.0.0-patch1)
Reading package.json of npm-asset/lodash (3.5.3-patch1)
Importing tag 3.5.3-patch1 (3.5.3.0-patch1)
Reading package.json of npm-asset/lodash (3.5.2-patch1)
Importing tag 3.5.2-patch1 (3.5.2.0-patch1)
Reading package.json of npm-asset/lodash (3.5.1-patch1)
Importing tag 3.5.1-patch1 (3.5.1.0-patch1)
Reading package.json of npm-asset/lodash (3.5.0-patch1)
Importing tag 3.5.0-patch1 (3.5.0.0-patch1)
Reading package.json of npm-asset/lodash (3.4.4-patch1)
Importing tag 3.4.4-patch1 (3.4.4.0-patch1)
Reading package.json of npm-asset/lodash (3.4.3-patch1)
Importing tag 3.4.3-patch1 (3.4.3.0-patch1)
Reading package.json of npm-asset/lodash (3.4.2-patch1)
Importing tag 3.4.2-patch1 (3.4.2.0-patch1)
Reading package.json of npm-asset/lodash (3.4.1-patch1)
Importing tag 3.4.1-patch1 (3.4.1.0-patch1)
Reading package.json of npm-asset/lodash (3.4.0-patch1)
Importing tag 3.4.0-patch1 (3.4.0.0-patch1)
Reading package.json of npm-asset/lodash (3.3.7-patch1)
Importing tag 3.3.7-patch1 (3.3.7.0-patch1)
Reading package.json of npm-asset/lodash (3.3.6-patch1)
Importing tag 3.3.6-patch1 (3.3.6.0-patch1)
Reading package.json of npm-asset/lodash (3.3.5-patch1)
Importing tag 3.3.5-patch1 (3.3.5.0-patch1)
Reading package.json of npm-asset/lodash (3.3.4-patch1)
Importing tag 3.3.4-patch1 (3.3.4.0-patch1)
Reading package.json of npm-asset/lodash (3.3.3-patch1)
Importing tag 3.3.3-patch1 (3.3.3.0-patch1)
Reading package.json of npm-asset/lodash (3.3.2-patch1)
Importing tag 3.3.2-patch1 (3.3.2.0-patch1)
Reading package.json of npm-asset/lodash (3.3.1-patch1)
Importing tag 3.3.1-patch1 (3.3.1.0-patch1)
Reading package.json of npm-asset/lodash (3.3.0-patch1)
Importing tag 3.3.0-patch1 (3.3.0.0-patch1)
Reading package.json of npm-asset/lodash (3.2.3-patch1)
Importing tag 3.2.3-patch1 (3.2.3.0-patch1)
Reading package.json of npm-asset/lodash (3.2.2-patch1)
Importing tag 3.2.2-patch1 (3.2.2.0-patch1)
Reading package.json of npm-asset/lodash (3.2.1-patch1)
Importing tag 3.2.1-patch1 (3.2.1.0-patch1)
Reading package.json of npm-asset/lodash (3.2.0-patch1)
Importing tag 3.2.0-patch1 (3.2.0.0-patch1)
Reading package.json of npm-asset/lodash (4.17.3-patch1)
Importing tag 4.17.3-patch1 (4.17.3.0-patch1)
Reading package.json of npm-asset/lodash (4.17.2-patch1)
Importing tag 4.17.2-patch1 (4.17.2.0-patch1)
Reading package.json of npm-asset/lodash (4.17.1-patch1)
Importing tag 4.17.1-patch1 (4.17.1.0-patch1)
Reading package.json of npm-asset/lodash (4.17.0-patch1)
Importing tag 4.17.0-patch1 (4.17.0.0-patch1)
Reading package.json of npm-asset/lodash (4.16.6-patch1)
Importing tag 4.16.6-patch1 (4.16.6.0-patch1)
Reading package.json of npm-asset/lodash (4.16.5-patch1)
Importing tag 4.16.5-patch1 (4.16.5.0-patch1)
Reading package.json of npm-asset/lodash (4.16.4-patch1)
Importing tag 4.16.4-patch1 (4.16.4.0-patch1)
Reading package.json of npm-asset/lodash (4.16.3-patch1)
Importing tag 4.16.3-patch1 (4.16.3.0-patch1)
Reading package.json of npm-asset/lodash (4.16.2-patch1)
Importing tag 4.16.2-patch1 (4.16.2.0-patch1)
Reading package.json of npm-asset/lodash (4.16.1-patch1)
Importing tag 4.16.1-patch1 (4.16.1.0-patch1)
Reading package.json of npm-asset/lodash (4.16.0-patch1)
Importing tag 4.16.0-patch1 (4.16.0.0-patch1)
Reading package.json of npm-asset/lodash (4.15.0-patch1)
Importing tag 4.15.0-patch1 (4.15.0.0-patch1)
Reading package.json of npm-asset/lodash (4.14.2-patch1)
Importing tag 4.14.2-patch1 (4.14.2.0-patch1)
Reading package.json of npm-asset/lodash (4.14.1-patch1)
Importing tag 4.14.1-patch1 (4.14.1.0-patch1)
Reading package.json of npm-asset/lodash (4.14.0-patch1)
Importing tag 4.14.0-patch1 (4.14.0.0-patch1)
Reading package.json of npm-asset/lodash (4.13.1-patch1)
Importing tag 4.13.1-patch1 (4.13.1.0-patch1)
Reading package.json of npm-asset/lodash (4.13.0-patch1)
Importing tag 4.13.0-patch1 (4.13.0.0-patch1)
Reading package.json of npm-asset/lodash (4.12.1-patch1)
Importing tag 4.12.1-patch1 (4.12.1.0-patch1)
Reading package.json of npm-asset/lodash (4.12.0-patch1)
Importing tag 4.12.0-patch1 (4.12.0.0-patch1)
Reading package.json of npm-asset/lodash (4.11.2-patch1)
Importing tag 4.11.2-patch1 (4.11.2.0-patch1)
Reading package.json of npm-asset/lodash (4.11.1-patch1)
Importing tag 4.11.1-patch1 (4.11.1.0-patch1)
Reading package.json of npm-asset/lodash (4.11.0-patch1)
Importing tag 4.11.0-patch1 (4.11.0.0-patch1)
Reading package.json of npm-asset/lodash (4.10.2-patch1)
Importing tag 4.10.2-patch1 (4.10.2.0-patch1)
Reading package.json of npm-asset/lodash (4.10.1-patch1)
Importing tag 4.10.1-patch1 (4.10.1.0-patch1)
Reading package.json of npm-asset/lodash (4.10.0-patch1)
Importing tag 4.10.0-patch1 (4.10.0.0-patch1)
Reading package.json of npm-asset/lodash (4.9.1-patch1)
Importing tag 4.9.1-patch1 (4.9.1.0-patch1)
Reading package.json of npm-asset/lodash (4.9.0-patch1)
Importing tag 4.9.0-patch1 (4.9.0.0-patch1)
Reading package.json of npm-asset/lodash (4.8.2-patch1)
Importing tag 4.8.2-patch1 (4.8.2.0-patch1)
Reading package.json of npm-asset/lodash (4.8.1-patch1)
Importing tag 4.8.1-patch1 (4.8.1.0-patch1)
Reading package.json of npm-asset/lodash (4.8.0-patch1)
Importing tag 4.8.0-patch1 (4.8.0.0-patch1)
Reading package.json of npm-asset/lodash (4.7.1-patch1)
Importing tag 4.7.1-patch1 (4.7.1.0-patch1)
Reading package.json of npm-asset/lodash (4.7.0-patch1)
Importing tag 4.7.0-patch1 (4.7.0.0-patch1)
Reading package.json of npm-asset/lodash (4.6.2-patch1)
Importing tag 4.6.2-patch1 (4.6.2.0-patch1)
Reading package.json of npm-asset/lodash (4.6.1-patch1)
Importing tag 4.6.1-patch1 (4.6.1.0-patch1)
Reading package.json of npm-asset/lodash (4.6.0-patch1)
Importing tag 4.6.0-patch1 (4.6.0.0-patch1)
Reading package.json of npm-asset/lodash (4.5.7-patch1)
Importing tag 4.5.7-patch1 (4.5.7.0-patch1)
Reading package.json of npm-asset/lodash (4.5.6-patch1)
Importing tag 4.5.6-patch1 (4.5.6.0-patch1)
Reading package.json of npm-asset/lodash (4.5.5-patch1)
Importing tag 4.5.5-patch1 (4.5.5.0-patch1)
Reading package.json of npm-asset/lodash (4.5.4-patch1)
Importing tag 4.5.4-patch1 (4.5.4.0-patch1)
Reading package.json of npm-asset/lodash (4.5.3-patch1)
Importing tag 4.5.3-patch1 (4.5.3.0-patch1)
Reading package.json of npm-asset/lodash (4.5.2-patch1)
Importing tag 4.5.2-patch1 (4.5.2.0-patch1)
Reading package.json of npm-asset/lodash (4.5.1-patch1)
Importing tag 4.5.1-patch1 (4.5.1.0-patch1)
Reading package.json of npm-asset/lodash (4.5.0-patch1)
Importing tag 4.5.0-patch1 (4.5.0.0-patch1)
Reading package.json of npm-asset/lodash (4.4.3-patch1)
Importing tag 4.4.3-patch1 (4.4.3.0-patch1)
Reading package.json of npm-asset/lodash (4.4.2-patch1)
Importing tag 4.4.2-patch1 (4.4.2.0-patch1)
Reading package.json of npm-asset/lodash (4.4.1-patch1)
Importing tag 4.4.1-patch1 (4.4.1.0-patch1)
Reading package.json of npm-asset/lodash (4.4.0-patch1)
Importing tag 4.4.0-patch1 (4.4.0.0-patch1)
Reading package.json of npm-asset/lodash (4.3.5-patch1)
Importing tag 4.3.5-patch1 (4.3.5.0-patch1)
Reading package.json of npm-asset/lodash (4.3.4-patch1)
Importing tag 4.3.4-patch1 (4.3.4.0-patch1)
Reading package.json of npm-asset/lodash (4.3.3-patch1)
Importing tag 4.3.3-patch1 (4.3.3.0-patch1)
Reading package.json of npm-asset/lodash (4.3.2-patch1)
Importing tag 4.3.2-patch1 (4.3.2.0-patch1)
Reading package.json of npm-asset/lodash (4.3.1-patch1)
Importing tag 4.3.1-patch1 (4.3.1.0-patch1)
Reading package.json of npm-asset/lodash (4.3.0-patch1)
Importing tag 4.3.0-patch1 (4.3.0.0-patch1)
Reading package.json of npm-asset/lodash (4.2.5-patch1)
Importing tag 4.2.5-patch1 (4.2.5.0-patch1)
Reading package.json of npm-asset/lodash (4.2.4-patch1)
Importing tag 4.2.4-patch1 (4.2.4.0-patch1)
Reading package.json of npm-asset/lodash (4.2.3-patch1)
Importing tag 4.2.3-patch1 (4.2.3.0-patch1)
Reading package.json of npm-asset/lodash (4.2.2-patch1)
Importing tag 4.2.2-patch1 (4.2.2.0-patch1)
Reading package.json of npm-asset/lodash (4.2.1-patch1)
Importing tag 4.2.1-patch1 (4.2.1.0-patch1)
Reading package.json of npm-asset/lodash (4.2.0-patch1)
Importing tag 4.2.0-patch1 (4.2.0.0-patch1)
Reading package.json of npm-asset/lodash (4.1.5-patch1)
Importing tag 4.1.5-patch1 (4.1.5.0-patch1)
Reading package.json of npm-asset/lodash (4.1.4-patch1)
Importing tag 4.1.4-patch1 (4.1.4.0-patch1)
Reading package.json of npm-asset/lodash (4.1.3-patch1)
Importing tag 4.1.3-patch1 (4.1.3.0-patch1)
Reading package.json of npm-asset/lodash (4.1.2-patch1)
Importing tag 4.1.2-patch1 (4.1.2.0-patch1)
Reading package.json of npm-asset/lodash (4.1.1-patch1)
Importing tag 4.1.1-patch1 (4.1.1.0-patch1)
Reading package.json of npm-asset/lodash (4.1.0-patch1)
Importing tag 4.1.0-patch1 (4.1.0.0-patch1)
Reading package.json of npm-asset/lodash (4.0.9-patch1)
Importing tag 4.0.9-patch1 (4.0.9.0-patch1)
Reading package.json of npm-asset/lodash (4.0.8-patch1)
Importing tag 4.0.8-patch1 (4.0.8.0-patch1)
Reading package.json of npm-asset/lodash (4.0.7-patch1)
Importing tag 4.0.7-patch1 (4.0.7.0-patch1)
Reading package.json of npm-asset/lodash (4.0.6-patch1)
Importing tag 4.0.6-patch1 (4.0.6.0-patch1)
Reading package.json of npm-asset/lodash (4.0.5-patch1)
Importing tag 4.0.5-patch1 (4.0.5.0-patch1)
Reading package.json of npm-asset/lodash (4.0.4-patch1)
Importing tag 4.0.4-patch1 (4.0.4.0-patch1)
Reading package.json of npm-asset/lodash (4.0.3-patch1)
Importing tag 4.0.3-patch1 (4.0.3.0-patch1)
Reading package.json of npm-asset/lodash (4.0.2-patch1)
Importing tag 4.0.2-patch1 (4.0.2.0-patch1)
Reading package.json of npm-asset/lodash (4.0.1-patch1)
Importing tag 4.0.1-patch1 (4.0.1.0-patch1)
Reading package.json of npm-asset/lodash (4.0.0-patch1)
Importing tag 4.0.0-patch1 (4.0.0.0-patch1)
Adding VCS repository npm-asset/abbrev
Adding VCS repository npm-asset/async 
Adding VCS repository npm-asset/escodegen
Adding VCS repository npm-asset/esprima  
Adding VCS repository npm-asset/glob   
Adding VCS repository npm-asset/handlebars
Adding VCS repository npm-asset/js-yaml   
Adding VCS repository npm-asset/mkdirp 
Adding VCS repository npm-asset/nopt  
Adding VCS repository npm-asset/once
Adding VCS repository npm-asset/resolve
Adding VCS repository npm-asset/supports-color
Adding VCS repository npm-asset/which         
Adding VCS repository npm-asset/wordwrap
Reading package.json of npm-asset/abbrev (v1.0.0)
Importing tag v1.0.0 (1.0.0.0)
Reading package.json of npm-asset/abbrev (v1.0.1)
Importing tag v1.0.1 (1.0.1.0)
Reading package.json of npm-asset/abbrev (v1.0.2)
Importing tag v1.0.2 (1.0.2.0)
Reading package.json of npm-asset/abbrev (v1.0.8)
Importing tag v1.0.8 (1.0.8.0)
Adding VCS repository npm-asset/estraverse
Adding VCS repository npm-asset/esutils   
Adding VCS repository npm-asset/optionator
Adding VCS repository npm-asset/source-map
Adding VCS repository npm-asset/inflight  
Adding VCS repository npm-asset/inherits
Adding VCS repository npm-asset/minimatch
Adding VCS repository npm-asset/optimist 
Adding VCS repository npm-asset/uglify-js
Adding VCS repository npm-asset/inherit  
Reading package.json of npm-asset/js-yaml (3.2.0)
Importing tag 3.2.0 (3.2.0.0)
Adding VCS repository npm-asset/minimist
Adding VCS repository npm-asset/wrappy  
Adding VCS repository npm-asset/has-flag
Adding VCS repository npm-asset/is-absolute
Adding VCS repository npm-asset/isexe      
Reading package.json of npm-asset/which (v1.2.3)
Importing tag v1.2.3 (1.2.3.0)
Reading package.json of npm-asset/which (v1.2.2)
Importing tag v1.2.2 (1.2.2.0)
Adding VCS repository npm-asset/prelude-ls
Adding VCS repository npm-asset/deep-is   
Adding VCS repository npm-asset/type-check
Adding VCS repository npm-asset/levn      
Adding VCS repository npm-asset/fast-levenshtein
Adding VCS repository npm-asset/amdefine        
Reading package.json of npm-asset/inherits (v2.0.2)
Importing tag v2.0.2 (2.0.2.0)
Adding VCS repository npm-asset/brace-expansion
Reading package.json of npm-asset/minimatch (v2.0.0-patch0)
Importing tag v2.0.0-patch0 (2.0.0.0-patch)
Adding VCS repository npm-asset/lru-cache
Adding VCS repository npm-asset/sigmund  
Adding VCS repository npm-asset/uglify-to-browserify
Adding VCS repository npm-asset/yargs               
Adding VCS repository npm-asset/underscore.string
Adding VCS repository npm-asset/is-relative      
Reading package.json of npm-asset/fast-levenshtein (1.1.1)
Importing tag 1.1.1 (1.1.1.0)
Adding VCS repository npm-asset/balanced-match
Adding VCS repository npm-asset/concat-map    
Reading package.json of npm-asset/lru-cache (v2.4.0)
Importing tag v2.4.0 (2.4.0.0)
Reading package.json of npm-asset/lru-cache (v2.2.3)
Importing tag v2.2.3 (2.2.3.0)
Adding VCS repository npm-asset/readable-stream
Adding VCS repository npm-asset/camelcase      
Adding VCS repository npm-asset/decamelize
Adding VCS repository npm-asset/window-size
Adding VCS repository npm-asset/cliui      
Adding VCS repository npm-asset/string_decoder
Adding VCS repository npm-asset/core-util-is  
Adding VCS repository npm-asset/isarray     
Adding VCS repository npm-asset/escape-string-regexp
Adding VCS repository npm-asset/center-align        
Adding VCS repository npm-asset/right-align 
Adding VCS repository npm-asset/align-text 
Adding VCS repository npm-asset/lazy-cache
Adding VCS repository npm-asset/kind-of   
Adding VCS repository npm-asset/longest
Adding VCS repository npm-asset/repeat-string
Adding VCS repository npm-asset/is-buffer    
Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install npm-asset/mammoth 1.3.1
    - Can only install one of: npm-asset/underscore[1.6.0, 1.4.4].
    - npm-asset/lop 0.4.0 requires npm-asset/underscore ~1.4.4 -> satisfiable by npm-asset/underscore[1.4.4].
    - npm-asset/mammoth 1.3.0 requires npm-asset/underscore ~1.6.0 -> satisfiable by npm-asset/underscore[1.6.0].
    - npm-asset/mammoth 1.3.0 requires npm-asset/lop ~0.4.0 -> satisfiable by npm-asset/lop[0.4.0].
    - Installation request for npm-asset/mammoth ^1.3 -> satisfiable by npm-asset/mammoth[1.3.0, 1.3.1].

Clearly more packages than necessary.

@cebe
Copy link
Contributor

cebe commented Dec 31, 2016

  --no-dev                   Disables installation of require-dev packages.

this means that the packages are not installed after dependency resolution. They are still included in resolving dependencies otherwise a lock file may result in a set of package versions that is not installable when --no-dev is not specified.

@nazar-pc
Copy link
Author

It does make some sense, but in context of this being plugin for Composer it doesn't make as much sense as it would for NPM. If we're using PHP instead of Node.js to install packages, there is a good chance we don't need dev packages too.

What about some option, probably in extra section, to ignore dev packages entirely and thus improve performance as well as avoiding potential conflicts in dev packages that might not be used anyway?

@cebe
Copy link
Contributor

cebe commented Jan 1, 2017

how would you expect a composer install to behave with a composer.lock file that has been created without dev dependencies?

@nazar-pc
Copy link
Author

nazar-pc commented Jan 1, 2017

Typically composer.lock is accompanied with original composer.json. In this case it is possible to use extra information from composer.json (not sure how Composer itself works in this case) since composer.lock doesn't store extra's contents itself.

@nazar-pc
Copy link
Author

nazar-pc commented Jan 1, 2017

In other words, require-dev should be constructed, but fxp/composer-asset-plugin can skip downloading and resolving any dependencies from that list of packages if corresponding option is set in extra key.

@Zaporozhec7
Copy link
Contributor

Zaporozhec7 commented Aug 20, 2017

I was have similar problem with dependencies. In my quite big project it was take more than half of hour for each "composer require" or "composer update", and respectively to debug output from composer (with option -vvv), 90% of that time was spend to packages that i absolutelly no need. In my case that is not only dev dependencies, but for big part of packages i do not need regular dependencies too.
So I made small patch for composer-asset-plugin, as temporary solution (i hope :) ). I was not have to much time for this work, so it maybe quite dirty solution.

It add two options under config.fxp-asset, skipDependencies and skipDevDependencies. skipDevDependencies should be boolean value, and in case of "true", all devDependencies skipped.
skipDependencies can be boolean or array. In case of boolean "true", all dependencies of all packages skipped. In case if that value is array, it should contain names of packages dependencies of which should be skipped. Package names should be without prefix "npm-asset/".

Sample config:

    "config": {
        "fxp-asset": {
            "skipDependencies": ["admin-lte", "gentelella"],
            "skipDevDependencies": true
        }
    }

Here is the patch: https://gist.github.com/Zaporozhec7/6ba54ad9369e44d6b83df0ca2e10a896

EDITED:

Seems I missed something, that my solution cause bugs with some packages.

@nazar-pc
Copy link
Author

nazar-pc commented Sep 7, 2017

@francoispluchino, was this fixed? Or does closing mean we'll suffer forever?

@francoispluchino
Copy link
Member

Your error isn't a bug, because Composer can only install a single version of the same dependency (npm-asset/underscore[1.6.0, 1.4.4]).

Use the config.fx-asset.resolutions option to solve the resolution of version (see the doc).

And Composer doesn't install the dev dependencies. On the other hand, Composer analyzes the dev section, and therefore the plugin imports the packages. It's not a bug, it's the standard behavior of Composer.

So, I want to re-open this issue if it's for an optimization request, but not for a report of a bug that is not one :-).

@nazar-pc
Copy link
Author

nazar-pc commented Sep 7, 2017

It's not a bug, it's the standard behavior of Composer.

Agree, but complaint was that it doesn't make any sense to do anything with frontend dev dependencies in Composer. Analyzing those dev dependencies takes time as well as become a source of unnecessary conflicts:

because Composer can only install a single version of the same dependency (npm-asset/underscore[1.6.0, 1.4.4])

I agree this might not be a bug, but rather a very good optimization to have.
Something as simple as optionally dropping devDependencies property early in the process for each package could greatly improve installation time.

@francoispluchino
Copy link
Member

I agree with you. So, I reopen this issue and change the labels. Just for info, I closed all the old issues with the label support. That's why it was closed.

@nazar-pc
Copy link
Author

I think, for this to happen it should be enough to simplify following:

/**
* Get the map conversion of dependencies.
*
* @return array
*/
protected function getMapDependencies()
{
return array(
'dependencies' => 'require',
'devDependencies' => 'require-dev',
);
}

to:

     protected function getMapDependencies() 
     { 
         return array( 
             'dependencies' => 'require', 
         ); 
    }

If this is not desired to be hardcoded, new options would be nice to have.

nazar-pc added a commit to nazar-pc/CleverStyle-Framework that referenced this issue Jan 27, 2018
@schmunk42
Copy link
Contributor

schmunk42 commented Mar 9, 2018

This is very important IMHO, just try to install

composer require -vvv npm-asset/selectize.js

It has Babel in it's devDependencies and ~~~installs~~~ clones and analyzes 100s of packages.
You can install this via Asset-Packagist, with half a dozen dependencies.
@hiqsol @SilverFire Does AP discard devDependencies?

npm itself also does not behave this way, devDependencies are not installed - I even think there's no way to do this with the standard CLI, without going to each module-directory.

I think there has to be an option to discard devDependencies and it should be on by default. If you need to develop a npm-package, you'll need npm anyway.

@hiqsol
Copy link
Contributor

hiqsol commented Mar 10, 2018

Does AP discard devDependencies?

Yes.
When AP converts bower/npm packages to composer packages it preserves dependencies and completely skips devDependencies.
See AssetPackage::prepareReleases

@schmunk42
Copy link
Contributor

@francoispluchino Would it be possible to get a fix for this? CAP is practically unusable with npm-assets.

@francoispluchino
Copy link
Member

If we can get the value of the --no-dev option, we can avoid adding the devDependencies section of the package.json file during the conversion. Any PR will be appreciated :-).

@schmunk42
Copy link
Contributor

I think it should be disabled by default and not depending on composer --no-dev since it has a completely different context.

If you need development packages for client packages you also have the development tools.

@francoispluchino francoispluchino added this to the 1.4.3 milestone May 22, 2018
@francoispluchino francoispluchino self-assigned this May 22, 2018
@francoispluchino
Copy link
Member

Performance improved by 3ec92aa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants