koala-framework / composer-extra-assets

Composer Plugin for installing Assets using native npm/bower
BSD 2-Clause "Simplified" License
42 stars 11 forks source link

Stop deleting package.json. Closes #10 #11

Closed moufmouf closed 9 years ago

moufmouf commented 9 years ago

Note: I'm allowing the user to modify package.json or bower.json. Only the dependencies section will be overwritten.

This can be useful sometimes. For instance, the gulp-bower-files extensions allows the use to put an extra section in "bower.json" that allows "gulp-bower-files" to ignore some packages. Therefore, it can be useful to let the possibility for the user to put additional material in those files.

On a side note, I added the "JSON_PRETTY_PRINT" tag to json_encode to get a pretty print. This is only supported in PHP 5.4. Hope this is not an issue for koala-framework. Let me know if it is.

nsams commented 9 years ago

looks good, thanks.

However please don't require php 5.4, instead use if (defined('JSON_PRETTY_PRINT')) - resulting in non-pretty JSON with php 5.3.

Or, you might even use the composer built in json formatter (they must have one, but I don't know if it is possible to use from a plugin)

moufmouf commented 9 years ago

Fixed. I used the JsonFile class from Composer to keeps compatibility with PHP 5.3.

moufmouf commented 9 years ago

After testing a bit more, I realize that the "package.json" files are generated for the root package but also for the packages in vendor/. It makes no sense to generate "package.json" files in the vendor/ directory. I adapted the PR to remove "package.json" from dependencies and keep it only for root package.

nsams commented 9 years ago

Makes sense.

Thanks for this PR :D