salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.29k stars 2.04k forks source link

[Meta] Move remaining vendored libraries to Composer #7605

Closed connorshea closed 5 months ago

connorshea commented 5 years ago

The goal of this issue is to track a bunch of smaller issues that are dedicated to removing vendored libraries from the repository and replacing them with corresponding Composer packages. This serves a few purposes:

A lot of packages have already been moved in the last year or two, but there are still quite a few left to move.

This list isn't necessarily comprehensive, it's just all of the vendored libraries that I was able to find.

I've also got a list of JavaScript libraries. These are harder, since we don't use npm/yarn and most of these probably don't have corresponding Composer packages:

connorshea commented 5 years ago

We also have jQuery 1.6.4 here for some reason: https://github.com/salesagility/SuiteCRM/blob/develop/jssource/src_files/include/javascript/jquery.js

connorshea commented 5 years ago

Ok, so jssource/ is where we want to look for the source files, include/javascript just has the minified versions that'll hopefully be removed soon. (#7340)

It's still weird to me that we have jQuery 1.6.4 AND jQuery 2.1.3, though.

connorshea commented 4 years ago

Somehow I missed that Zend was vendored in the repository, so I've added that to the list. Looks like we're on 1.10.8? We have the Zend Gdata, Http, Oauth, Uri, and Validate packages. There's also Zend Search in the AOD_Index module, for some reason?: https://github.com/salesagility/SuiteCRM/tree/develop/modules/AOD_Index/Lib/Zend/Search

That one is going to be... fun. The 1.x docs seem to have mostly become 404 pages now, and Composer has 1.12.3 as the earliest version of the Zend packages.

connorshea commented 4 years ago

Turns out there's also a copy of jQuery at modules/jjwg_Maps/javascript/jquery-1.8.0.min.js AND two copies of jQuery at modules/jjwg_Areas/javascript/jquery-1.4.2.min.js and modules/jjwg_Areas/javascript/jquery-1.8.0.min.js.

😒

Oh, and also one at include/javascript/mozaik/colorpicker/js/jquery.js.

So I think that brings us up to a grand total of 8 copies of jQuery in this repo. ಠ_ಠ

Dillon-Brown commented 4 years ago

8 copies of Jquery.... ಠ_ಠ indeed.

connorshea commented 4 years ago

It looks like we also vendor a library here: include/parsecsv.lib.php

Dillon-Brown commented 4 years ago

It looks like we also vendor a library here: include/parsecsv.lib.php

@connorshea Well spotted, removed here: #8006

connorshea commented 4 years ago

Does anyone know where we can get XTemplate via Composer? Or can we remove it entirely?

EDIT: Opened an issue about removing XTemplate at #8016. It's going to take a decent bit of work to remove it, but it hopefully shouldn't be insurmountable. The library is unmaintained and hasn't been updated in over a decade, as far as I can tell. It's probably got security holes like swiss cheese.

connorshea commented 4 years ago

From codecov.yml, I noticed we also vendor php-sql-parser at include/php-sql-parser.php.

Looks like it's on GitHub at https://github.com/greenlion/PHP-SQL-Parser, and we can get it from Packagist here: https://packagist.org/packages/greenlion/php-sql-parser

Edit: I looked into this a bit more, this could probably be removed relatively easily. It's only used in 3 places. I wasn't able to figure out what version of the library was vendored into our repo, but it's definitely quite an old version.

connorshea commented 4 years ago

Found a new one: pChart is vendored in modules/AOR_Charts/lib/pChart.

Looks like we're using v2.1.4, which was the last version released (in 2014).

It looks like we can it from Composer but it's not official: https://github.com/szymach/c-pchart / https://packagist.org/packages/szymach/c-pchart

The Composer package doesn't have v2.1.4 for whatever reason, not sure if that'd be a problem. 2.0.12 or 3.x would be our best options. 3.x has some backwards incompatibilities and I'm not really sure what the deal is with 2.0.12.

connorshea commented 4 years ago

phpjs can probably be removed relatively easily. It just creates some PHP functions in JS, and we only use one as far as I can tell:

connorshea commented 4 years ago

We also have a copy of moment.min.js, well 2 copies. 1 is used by fullcalendar, not really sure what the other one is for.