This PR lays the groundwork for better modularization of the backend code that has been living in the "injected.js" file.
The goal is to break that one long file into individual class modules that can be developed adhering to principles of single responsibility and then connected via import/export statements. The issue is that those files will need to be packaged into their own bundle, separate from the client bundles, so this PR sets up a second build process to to facilitate that.
Specific file changes:
webpack.config.script.js is a new file with configs for the new build process for the injected script.
The original webpack.config.js has been renamed to webpack.config.client.js to distinguish it.
References to the injected.js file in manifest.js and index.js have been updated to reflect the new path of the new bundled file in the build folder.
In light of now having two separate build processes, scripts have been updated in package.json: "build-client", "build-script", and "build-all" produce production builds of the two bundles separately and together; "watch-client" and "watch-script" start watch mode for the two bundles respectively to ease development workflow.
The Github Actions workflow file has been updated to take into account the new build scripts.
An src folder has been added to the devtools folder to hold source code for the injected script. Inside that folder are new files "main.js", "ComponentParser.js" and "utils.js". Main is essentially the old injected.js, as a starting point for future refactoring. Utils pulls out two specific functions that are simple utilities. ComponentParser is the first piece to be pulled out of the original file - it creates a new class module encapsulating specific related functionality.
Unit testing for the old injected.js file have been removed and replaced with tests specifically for ComponentParser.js.
This PR lays the groundwork for better modularization of the backend code that has been living in the "injected.js" file.
The goal is to break that one long file into individual class modules that can be developed adhering to principles of single responsibility and then connected via import/export statements. The issue is that those files will need to be packaged into their own bundle, separate from the client bundles, so this PR sets up a second build process to to facilitate that.
Specific file changes: