fxpio / foxy

A fast, reliable, and secure NPM/Yarn/pnpm bridge for Composer
https://foxypkg.com
MIT License
173 stars 21 forks source link

I made a plugin for Yii2 to use your plugin, can you watch it and give me some suggestion? #25

Closed krissss closed 5 years ago

krissss commented 5 years ago

https://github.com/krissss/foxy-yii2-convert

For this issue #8

schmunk42 commented 5 years ago

@krissss How do you convert bower-asset to package.json?

krissss commented 5 years ago

Just only get bower version. Almost bower name is same in npm. I think we can add an option to map bower name to npm if they are different.

francoispluchino commented 5 years ago

Indeed, many names on Bower are identical for NPM, however, this is not always the case, and even for widely used packages. Making a conversion card is relevant, but it would be more interesting to have a server listing the entire names to convert.

In this logic, it would be very useful for the final user, and to avoid adding the names manually on the server, to have an interactive mode, if the package name does not exist on NPM. In this way it would be possible to save the conversion of the package name on the server. Of course, you need to make sure that the Interactive mode is enabled before.

krissss commented 5 years ago

The idea that I want change form asset-package to foxy is asset-package is slow! If you add a server, this may be slow too...

I assumed it is not difficult to let users to edit bower to npm map.

Another reason is, foxy-yii2-convert is only for project, not for library. Not like Foxy.

francoispluchino commented 5 years ago

I agree with you, and that's why I created Foxy ;-)

Of course, edited the conversion map is not difficult, but it is not user friendly. I said just that it would be cooler, if this map could be retrieved directly from a server, and even better, if it could be directly updated by an end user. For the question about speed, you only make one request on the server to retrieve a Json file of key-values composed of package names, so it's very fast (300 ms). After, the conversion is always in local via your plugin.

Personally, that is what I would propose, but I grant you it, it is not at all required, it is simply more pleasant for the users not to add this conversion map manually.

schmunk42 commented 5 years ago

I like the idea, but also keep in mind that the file structure in the package might not be the same in bower and npm.

krissss commented 5 years ago

for example? @schmunk42

francoispluchino commented 5 years ago

See the list for NPM to Composer and Bower to Composer. There are slight differences.

https://github.com/fxpio/composer-asset-plugin/blob/master/Resources/doc/schema.md#mapping-asset-file-to-composer-package

krissss commented 5 years ago

@francoispluchino And which widely used package is not use the same name in bower and npm?Give an example. I search for adminlte, It uses a new package name admin-lte same as in npm

francoispluchino commented 5 years ago

From memory, I do not have one, but by looking in CAP issues, we can find some.

krissss commented 5 years ago

@francoispluchino Maybe because npm was not popular when bower was not maintained. Now bower was maintained for almost one and half year(from 02 Oct 2017). Frontend developer is crazy! If one package is popular, it will be a same name for user to pick in bower and npm.

So, we can ignore the problem and just provide an option for user to config if necessary.

schmunk42 commented 5 years ago

for example? @schmunk42

Would need to dig some up, but the release process on bower and npm is totally different. I just wanted to note that.

I'd really like to replace CAP for Yii2 with Foxy, but it might be very difficult.

francoispluchino commented 5 years ago

I close this issue, but do not hesitate to reopen it if you have any other questions.

krissss commented 4 years ago

I release kriss/foxy-yii2-convert to 1.0 because everything is OK for use at least 5 month and 10 projects.

And I add some FAQ in README.md for solve some known problems.

Use Foxy, I can install Yii2 asset package very fast~ Thank You~

francoispluchino commented 4 years ago

Thank you @krissss for your work, I think the Yii Framework community will appreciate your plugin.