Skip to content

Commit fd39d6b

Browse files
authored
VAST-86: Cleanup obsolete files and update README (#83)
* chore: VAST-86 cleanup obsolete files and update README - Remove .versionrc.js, standard-version dep and release script (replaced by GitHub Actions) - Fix .gitignore to properly ignore dist/ and build/ - Clean .npmignore (remove references to non-existent files) - Remove empty Cypress scaffolding (plugins/index.js, commands.js) - Update README: fix events list, typos, rewrite Running locally, add Testing section * ci: add GitHub Actions workflow to run tests on PRs
1 parent 33283ca commit fd39d6b

File tree

11 files changed

+110
-2927
lines changed

11 files changed

+110
-2927
lines changed

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [develop]
6+
7+
jobs:
8+
lint-build-test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: 20
16+
cache: npm
17+
18+
- run: npm ci
19+
20+
- run: npm run lint
21+
22+
- run: npm run build
23+
24+
- run: npm run test:unit
25+
26+
e2e:
27+
runs-on: ubuntu-latest
28+
needs: lint-build-test
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: npm
36+
37+
- run: npm ci
38+
39+
- run: npm run bundle:demo
40+
41+
- name: Start server and run E2E tests
42+
run: |
43+
npx serve -l 3333 docs &
44+
npx wait-on http://localhost:3333/
45+
npx cypress run --browser chrome

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
ehthumbs.db
2626
Thumbs.db
2727
/**/node_modules/
28-
/**/dist/**/
29-
/**/build/**/
28+
dist/
29+
build/
3030
/vcode.code-workspace
3131
/**/coverage/
3232
node_modules

.npmignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@ node_modules
22
src
33
docs
44
cypress
5-
public
65
cypress.config.js
76
esbuild.js
87
.gitignore
9-
coverage
108
.eslintrc.js
11-
.versionrc.js
12-
changelog.config.js
13-
github-release.mjs
9+
coverage

.versionrc.js

Lines changed: 0 additions & 113 deletions
This file was deleted.

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Table of contents
2121
* [Implementing a CTA](#implementing-a-cta)
2222
* [Options](#options)
2323
* [Events](#events)
24-
* [Runnning locally](#runnning-locally)
24+
* [Running locally](#running-locally)
25+
* [Testing](#testing)
2526
* [Credits](#credits)
2627
* [License](#license)
2728

@@ -65,7 +66,7 @@ const vastVjsOptions = {
6566
videoJsInstance.vast(vastVjsOptions);
6667
6768
// Do something with Ads events
68-
videojsInstance.on('vast.play', (event, data) => {
69+
videoJsInstance.on('vast.play', (event, data) => {
6970
console.log('Ad is playing');
7071
});
7172
```
@@ -98,7 +99,7 @@ This plugin currently supports a handful of options that might help you customiz
9899
* **debug** (boolean) - Display detailed logging in the browser console. ***Default: false***
99100
* **addCtaClickZone** (boolean) - Add or not a clickzone for the cta url. ***Default: true***
100101
* **addSkipButton** (boolean) - Add or not a skip button for skippable ads. ***Default: true***
101-
* **skipButtonOptions** (object) - Customize skip button text and style. ⚠️ ***inlineStyle*** option extends the default value, unless ***resetStyle*** is set to `true`.
102+
* **skipButtonOptions** (object) - Customize skip button text and style. Warning: ***inlineStyle*** option extends the default value, unless ***resetStyle*** is set to `true`.
102103
***Defaults:***
103104
```
104105
{
@@ -114,7 +115,7 @@ The plugin communicates with the consumer through default event bus built into V
114115

115116
```
116117
// Do something when there is an ad time update
117-
videojsInstance.on('vast.time', (event, data) => {
118+
videoJsInstance.on('vast.time', (event, data) => {
118119
console.log('Ad is playing');
119120
console.log('Current position - ' + data.position);
120121
console.log('Total Duration - ' + data.duration);
@@ -123,26 +124,35 @@ videojsInstance.on('vast.time', (event, data) => {
123124

124125
Below you can find a list of the events currently supported. Just like the plugin options, this is a work in progress and more events should be available in the future, especially if requested through this repository.
125126

126-
* **vast.canplay** - The plugin successfully parsed the VAST manifest and is capable of playing an ad
127127
* **vast.playAttempt** - The plugin will try and play a creative of an ad. It might be the case that the creative fails to load, in which case **vast.play** will never be fired
128-
* **vast.play** - The plugin started playing a creative
129-
* **vast.time** - Called every 100ms or so, this event gives the consumer an update of the current position within a creative
128+
* **vast.play** - The plugin started playing a creative. Contains `ctaUrl`, `skipDelay`, `adClickCallback` and `duration`
129+
* **vast.metadata** - Fired when ad metadata is available. Contains `duration`, `id`, `adId` and `type`
130+
* **vast.time** - Called on each time update during ad playback. Contains `position`, `currentTime` and `duration`
131+
* **vast.skip** - Called when the user skips the current ad
130132
* **vast.complete** - Called once the current ad pod (set of ads) is done playing
131-
* **vast.error** - Called if the plugin fails at some point in the process
132-
* **vast.click** - Called once the plugin succeffully registers a click in the call to action element associated with an ad - check the [Implementing a CTA](#implementing-a-cta) section for more details
133+
* **vast.click** - Called once the plugin successfully registers a click in the call to action element associated with an ad - check the [Implementing a CTA](#implementing-a-cta) section for more details
134+
* **vast.error** - Called if the plugin fails at some point in the process. Contains `message` and optionally `tag`
133135

134-
#### Runnning locally
136+
#### Running locally
135137

136-
Running the plugin locally to further develop it is quite simple. Since the plugin repository does not contain any self contained development environment, we recommend using [**yalc**](https://www.npmjs.com/package/yalc) to publish the package in a local repository and then use [**yalc**](https://www.npmjs.com/package/yalc) again to install the plugin from the same local repository in in a dedicated development environment or even within the project you are working on.
138+
The plugin includes a self-contained development environment with a demo page.
137139

138-
Here's a small step-by-step to run the plugin locally.
139-
140-
* Install Yalc globally with ```npm i yalc -g``` or, using yarn: ```yarn global add yalc```
141140
* Clone the repository with ```git clone https://github.com/ArteGEIE/videojs-vast.git```
142-
* Install the plugin dependencies with ```npm install```
143-
* Run the plugin in watch mode with ```npm start```, leave this terminal open while you are working on the plugin's code
144-
* In your local project, run ```yalc add videojs-vast``` to install the plugin from your local repository
145-
* Run your project normally, it will consume the local version of the plugin
141+
* Install dependencies with ```npm install```
142+
* Run ```npm start``` to start the dev environment (serves the demo on http://localhost:3333, watches for changes and rebuilds automatically)
143+
144+
If you prefer using [**yalc**](https://www.npmjs.com/package/yalc) to test the plugin within your own project:
145+
146+
* Install Yalc globally with ```npm i yalc -g```
147+
* Run ```npm run build:local``` to build and push to the local yalc registry
148+
* In your project, run ```yalc add @artegie/videojs-vast```
149+
150+
#### Testing
151+
152+
* ```npm test``` - Run all tests (unit + E2E)
153+
* ```npm run test:unit``` - Run unit tests (Vitest)
154+
* ```npm run test:e2e``` - Run E2E tests (Cypress, requires the dev server on port 3333)
155+
* ```npm run test:open``` - Open Cypress interactive runner
146156

147157
#### Credits
148158

cypress.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ const { defineConfig } = require('cypress')
33
module.exports = defineConfig({
44
chromeWebSecurity: false,
55
e2e: {
6-
// We've imported your old cypress plugins here.
7-
// You may want to clean this up later by importing these.
8-
setupNodeEvents(on, config) {
9-
// eslint-disable-next-line global-require
10-
return require('./cypress/plugins/index')(on, config);
11-
},
126
baseUrl: 'http://localhost:3333',
137
video: false,
148
experimentalWebKitSupport: true,

cypress/plugins/index.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

cypress/support/commands.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

cypress/support/e2e.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
// ***********************************************************
2-
// This example support/index.js is processed and
3-
// loaded automatically before your test files.
4-
//
5-
// This is a great place to put global configuration and
6-
// behavior that modifies Cypress.
7-
//
8-
// You can change the location of this file or turn off
9-
// automatically serving support files with the
10-
// 'supportFile' configuration option.
11-
//
12-
// You can read more here:
1+
// Support file loaded automatically before test files.
2+
// Add global configuration and custom commands here.
133
// https://on.cypress.io/configuration
14-
// ***********************************************************
15-
16-
// Import commands.js using ES2015 syntax:
17-
import './commands'
18-
19-
// Alternatively you can use CommonJS syntax:
20-
// require('./commands')

0 commit comments

Comments
 (0)