Closed jboix closed 7 months ago
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
🟢 | Statements | 98.39% | 489/497 |
🟢 | Branches | 93.44% | 228/244 |
🟢 | Functions | 100% | 136/136 |
🟢 | Lines | 99.16% | 473/477 |
153 tests passing in 9 suites.
Report generated by 🧪jest coverage report action from a004190caf808f6df065001d793d5db4e62754b5
@jboix I think we need to find another strategy for this PR. This PR deals with two very distinct subjects, so it would be better to separate it into two. Once the two PRs are separated, I think it would be best to delete all commits related to the demo.
Description
Closes #179 by migrating the compilation framework from
Parcel
toRollup
, aiming to improve the flexibility of the compilation process. To execute the full bundle of the library simply run:npm run build
.Changes made
Rollup
migrationRollup is the bundler that allows us to create an UMD package of the library, which can be used in various environments. The proposed configuration produces two main builds:
pillarbox-core
: This build includes only the superset of functions of video.js, the underlying video player library. It does not include analytics or data providers that are specific to SRG/SSR.pillarbox
: This build includes both the core and the specific business logic for SRG/SSR content, i.e.: The analytics and the data provider.Both these builds are provided in UMD and ES format.
The following plugins have been introduced:
@rollup/plugin-commonjs
: converts CommonJS modules to ES6, so they can be included in a Rollup bundle.@rollup/plugin-json
: converts JSON files to ES6 modules, so they can be imported as objects.@rollup/plugin-node-resolve
: locates modules using the Node resolution algorithm, for using third party modules in node_modules.@rollup/plugin-terser
: generates a minified bundle with terser, a JavaScript optimizer tool.rollup-plugin-filesize
: shows the filesize of the bundle in the cli.The following command executes the generation of both these bundles:
npm run build:lib
.Introduction of
sass
As part of the migration the preprocessing of
scss
files is now done directly with Sass as opposed ofparcel
. A minifiedcss
stylesheet and a sourcemap are generated by executing:npm run build:css
.Add typings generation via typescript
TypeScript is a superset of JavaScript that adds static type checking and other features. It helps to write more robust and error-free code. Even though we've opted to not use typescript in
Pillarbox
atsconfig.json
file has been added to generate the declaration files based on the JSDocs of the source code.Executing:
npm run build:typings
will generate the typings declarations.See Creating .d.ts Files from .js files.
Split the demo application to its own repository
The demo folder has been moved to SRGSSR/pillarbox-web-demo where it can be maintained and updated independently. The following pull request descibres the changes that have taken place on the demo part: SRGSSR/pillarbox-web-demo#1
Since the demo has moved to another respository the github page of this one is now a standalone player.