TAMULib / weaver-components

Custom Web Components for the Weaver UI
MIT License
0 stars 1 forks source link

Redesign dependency list, reducing dependencies where possible. #507

Closed kaladay closed 1 year ago

kaladay commented 1 year ago

resolves #501

The @ngrx/store-devtools is being included in production code. Follow the design suggested here https://ngrx.io/guide/store-devtools/recipes/exclude . This design conditionally removes the devtools when building production (taking advantage of tree-shaking to do so). A custom devtools/instrument.ts and devtools/instrument.prod.ts are provided to achieve this.

The version should be something more like 2.0.3-rc.1.

Many of the dependencies are already being included. Remove the redundant dependencies, where possible. In some cases, the dependency is necessary to prevent an unwanted version from being pulled in. Remove all variable versioning and use explicit version numbers.

The ng-inline-svg is removed by other work and is now removed from the dependencies list. The css-element-queries is removed by other work and is now removed from the dependencies list.

There are problems where numerous versions of the same package are being included. This is a problem with how npm's package system is designed. Use the "overrides" section to prevent and intermix of versions. I only fixed the packages I noticed as there are quite a lot of packages (a ballpark of ~2000 dependencies).

The use of the "overrides" is also used to remove security issues. It turns out one of the dependencies is pulling in an angular 11.x dependency for @angular/core. This is the reason for some of the more serious security issues.

Several of the polyfills are now removed.

The wysiwyg uses a lot of dependencies but is not removed.

The lighthouse dependencies remain in place because several of the scripts still use them. A redesign of the scripting process might make it possible to remove this (including moving the code into the Github workflows). Lighthouse also brings in 5 moderate severity vulnerabilities due to the latest-version dependency (which is now overwritten).

Protractor has a lot of dependencies, but it will not go away so long as we are using angular 12. This is being brought in through Angular 12 dependencies but is otherwise not explicitly defined in the dependency list.

Verdaccio is removed from the list. It is not critical and the script for it still remains. To use the npm run start:registry, the caller needs to install Verdaccio globally (such as: npm install -g verdaccio) or use the Verdaccio from another source (such as through weaver-ui).

The tslint/eslint dependencies can be reduced. This is a large task and there is already another issue for solving this. Such changes are left alone and are expected to be resolved in the other issue.

The unit tests pass for me but I am unable to run the e2e tests due to problems with the chromium webdriver version that suddenly appeared.

I made attempts and replacing karma-coverage-istanbul-reporter with karma-coverage. Problems happened, so I backed off. Replacing karma-coverage-istanbul-reporter would allow for more dependency removals.

The build statistics are now as follows:

Initial Chunk Files | Names                |      Size
main-es5.js         | main                 |   1.46 MB
main-es2015.js      | main                 |   1.33 MB
styles.css          | styles               | 287.85 kB
polyfills-es5.js    | polyfills-es5        | 133.86 kB
polyfills-es2015.js | polyfills            |  33.25 kB

                    | Initial ES5 Total    |   1.87 MB
                    | Initial ES2015 Total |   1.64 MB