diff --git a/docs/README.md b/docs/README.md index 95dd7ac..a0c4865 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,7 +45,7 @@ npm install Open your terminal and execute the following command: ```bash -npm run create:plugin +npm run create ``` After running the command, you will be prompted to enter the name of your plugin. A new plugin diff --git a/package.json b/package.json index 86ec182..c5b2e8b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "themes/*" ], "scripts": { - "create:plugin": "plop --plopfile scripts/create-plugin.js", + "create": "plop --plopfile scripts/create.js", "eslint": "eslint {plugins/**/{src,test}/**/*.{js,jsx},scripts/*.{js,jsx}}", "outdated": "npm outdated", "prepare": "husky", diff --git a/plugins/skip-button-plugin/src/skip-button-plugin.js b/plugins/skip-button-plugin/src/skip-button-plugin.js deleted file mode 100644 index 6d766dd..0000000 --- a/plugins/skip-button-plugin/src/skip-button-plugin.js +++ /dev/null @@ -1,28 +0,0 @@ -import pillarbox from '@srgssr/pillarbox-web'; -import SkipButton from './skip-button.js'; - -/** - * @ignore - * @type {typeof import('video.js/dist/types/plugin').default} - */ -const Plugin = pillarbox.getPlugin('plugin'); - -/** - * Represents a SkipButtonPlugin plugin for the pillarbox player. - */ -class SkipButtonPlugin extends Plugin { - /** - * Creates an instance of a SkipButtonPlugin. - * - * @param {import('@srgssr/pillarbox-web').Player} player The player instance. - * @param {Object} options Configuration options for the plugin. - */ - constructor(player, options) { - super(player, options); - this.player.addChild('SkipButton'); - } -} - -pillarbox.registerPlugin('skipButtonPlugin', SkipButtonPlugin); - -export { SkipButtonPlugin, SkipButton }; diff --git a/plugins/skip-button-plugin/test/skip-button-plugin.spec.js b/plugins/skip-button-plugin/test/skip-button-plugin.spec.js deleted file mode 100644 index f69abc9..0000000 --- a/plugins/skip-button-plugin/test/skip-button-plugin.spec.js +++ /dev/null @@ -1,31 +0,0 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import pillarbox from '@srgssr/pillarbox-web'; -import { SkipButtonPlugin } from '../src/skip-button-plugin.js'; - -window.HTMLMediaElement.prototype.load = () => {}; - -describe('SkipButtonPlugin', () => { - let player, videoElement; - - beforeAll(() => { - document.body.innerHTML = ''; - videoElement = document.querySelector('#test-video'); - }); - - beforeEach(() => { - player = pillarbox(videoElement, { - plugins: { - skipButtonPlugin: true - } - }); - }); - - afterEach(() => { - player.dispose(); - }); - - it('should be registered and attached to the player', () => { - expect(pillarbox.getPlugin('skipButtonPlugin')).toBe(SkipButtonPlugin); - expect(player.skipButtonPlugin).toBeDefined(); - }); -}); diff --git a/plugins/skip-button-plugin/.babelrc b/plugins/skip-button/.babelrc similarity index 100% rename from plugins/skip-button-plugin/.babelrc rename to plugins/skip-button/.babelrc diff --git a/plugins/skip-button-plugin/README.md b/plugins/skip-button/README.md similarity index 81% rename from plugins/skip-button-plugin/README.md rename to plugins/skip-button/README.md index be013a3..c4eff9c 100644 --- a/plugins/skip-button-plugin/README.md +++ b/plugins/skip-button/README.md @@ -1,7 +1,6 @@ -# Pillarbox Web: SkipButtonPlugin +# Pillarbox Web: SkipButton -> Introduce your plugin with a clear overview of its goals, providing -> essential context and addressing fundamental questions. +A button that allow skipp ## Requirements @@ -11,7 +10,7 @@ To use this component, you need the following installed on your system: ## Quick Start -To get started with this plugin, follow these steps: +To get started with this component, follow these steps: Add the `@srgssr` registry to your `.npmrc` file: @@ -26,18 +25,18 @@ guide: [Authenticating with a personal access token][generate-token] You can now install it through `npm` the following command: ```bash -npm install --save @srgssr/pillarbox-web @srgssr/skip-button-plugin +npm install --save @srgssr/pillarbox-web @srgssr/skip-button ``` For instructions on setting up Pillarbox, see the [Quick Start guide](SRGSSR/pillarbox-web#quick-start). -Once the player is installed you can activate the plugin as follows: +Once the player is installed you can activate the button as follows: ```javascript import Pillarbox from '@srgssr/pillarbox-web'; -import '@srgssr/skip-button-plugin'; +import '@srgssr/skip-button'; -const player = new Pillarbox('my-player', { plugins: { 'skipButtonPlugin': true } }); +const player = new Pillarbox('my-player', { SkipButton: true }); player.src({ src: 'urn:swi:video:48115940', type: 'srgssr/urn' diff --git a/plugins/skip-button-plugin/index.html b/plugins/skip-button/index.html similarity index 82% rename from plugins/skip-button-plugin/index.html rename to plugins/skip-button/index.html index 6d54e1c..361f9fd 100644 --- a/plugins/skip-button-plugin/index.html +++ b/plugins/skip-button/index.html @@ -4,9 +4,9 @@ - SkipButtonPlugin Demo + SkipButton Demo - +