samdark / yii2-cookbook

Yii 2.0 Community Cookbook
1.45k stars 297 forks source link

Show how to use npm-asset with composer #107

Open cherifGsoul opened 8 years ago

cherifGsoul commented 8 years ago

for Asset processing with Grunt I think is better to show how to use npm-asset or bower-asset of fxp/composer-asset-plugin to to encourage users to use yii2 workflow

samdark commented 8 years ago

Probably but usage of bower/npm packages via fxp is in the official guide already...

cherifGsoul commented 8 years ago

Oh I missed that in the guide :+1:

cherifGsoul commented 8 years ago

Seems that the fxp/composer-asset-plugin dosent handle dependencies automaticaly this issue might be useless

samdark commented 8 years ago

What do you mean by doesn't handle dependencies? It does.

cherifGsoul commented 8 years ago

I will check it again, because composer require npm-asset/gulp throws errors:

Problem 1
    - Conclusion: don't install npm-asset/gulp 3.9.1
    - Installation request for npm-asset/gulp ^3.9 -> satisfiable by npm-asset/gulp[3.9.0, 3.9.1].
    - npm-asset/gulp 3.9.0 requires npm-asset/vinyl-fs >=0.3.0,<0.4.0 -> satisfiable by npm-asset/vinyl-fs[0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.3.9, 0.3.10, 0.3.11, 0.3.12, 0.3.13, 0.3.14].
    - npm-asset/vinyl-fs 0.3.0 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.1 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.2 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.3 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.4 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.5 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.6 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.7 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.8 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.9 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.10 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.11 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.12 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.13 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/vinyl-fs 0.3.14 requires npm-asset/mkdirp >=0.5.0,<0.6.0 -> satisfiable by npm-asset/mkdirp[0.5.0, 0.5.1].
    - npm-asset/mkdirp 0.5.0 requires npm-asset/minimist 0.0.8 -> satisfiable by npm-asset/minimist[0.0.8].
    - npm-asset/mkdirp 0.5.1 requires npm-asset/minimist 0.0.8 -> satisfiable by npm-asset/minimist[0.0.8].
    - Conclusion: don't install npm-asset/minimist 0.0.8
schmunk42 commented 6 years ago

@cherifGsoul This issue can not be solved with fxp & composer, without tweaking your config, see https://github.com/fxpio/composer-asset-plugin/issues/307#issuecomment-327102805 for details.

The underlying issue is that npm can handle multiple versions, but composer can't. You can work around this limitation, but it's going to be hard when you have a lot of assets in your app.