Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luciobenini committed Nov 27, 2021
0 parents commit db52e70
Show file tree
Hide file tree
Showing 16 changed files with 457 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
52 changes: 52 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- run: npm install
- run: npm ci

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://npm.pkg.github.com/
- run: npm install
- run: npm ci
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
105 changes: 105 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Lock files
package-lock.json
yarn.lock
16 changes: 16 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
logs
*.log
node_modules
*.un~
yarn.lock
package-lock.json
flow-typed
coverage
decls
examples
.gitattributes
*.code-workspace
src
.github
.prettierignore
.prettierrc
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.cache
package.json
package-lock.json
public
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# pittica/gatsby-plugin-video

![License](https://img.shields.io/github/license/pittica/gatsby-plugin-video)
![Version](https://img.shields.io/github/package-json/v/pittica/gatsby-plugin-video)
![Release](https://img.shields.io/github/v/release/pittica/gatsby-plugin-video)

## Description

Video embed plugin for [GatsbyJS](https://www.gatsbyjs.org/).

## Install

[![npm](https://img.shields.io/npm/v/@pittica/gatsby-plugin-video)](https://www.npmjs.com/package/@pittica/gatsby-plugin-video)
[![npm](https://img.shields.io/npm/dm/@pittica/gatsby-plugin-video)](https://www.npmjs.com/package/@pittica/gatsby-plugin-video)

```shell
npm install @pittica/gatsby-plugin-video
```

## Copyright

(c) 2021, [Pittica S.r.l.](https://pittica.com).
8 changes: 8 additions & 0 deletions gatsby-plugin-video.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
55 changes: 55 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@pittica/gatsby-plugin-video",
"private": false,
"description": "Video embed plugin for GatsbyJS.",
"version": "1.0.0",
"author": {
"name": "Lucio Benini",
"email": "info@pittica.com",
"url": "https://pittica.com"
},
"bugs": {
"url": "https://github.com/pittica/gatsby-plugin-video/issues"
},
"deprecated": false,
"homepage": "https://github.com/pittica/gatsby-plugin-video",
"keywords": [
"gatsby",
"gatsby-plugin",
"video"
],
"devDependencies": {
"@babel/cli": "^7.16.0",
"babel-preset-gatsby-package": "^2.0.0",
"react-scripts": "^4.0.3"
},
"peerDependencies": {
"gatsby": "^3.0.0 || ^4.0.0"
},
"license": "MIT",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/pittica/gatsby-plugin-video.git"
},
"config": {
"access": "public"
},
"scripts": {
"test": "react-scripts test",
"prepare": "rimraf ./dist && mkdirp ./dist && babel src --out-dir dist --copy-files"
},
"eslintConfig": {
"extends": "react-app"
},
"babel": {
"presets": [
"babel-preset-gatsby-package"
]
},
"dependencies": {
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}
33 changes: 33 additions & 0 deletions src/components/dailymotion.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react"
import PropTypes from "prop-types"

export default function Dailymotion({ id, width, height, title, className }) {
return (
<iframe
className={className}
style="width:100%;height:100%;position:absolute;left:0px;top:0px;overflow:hidden"
frameborder="0"
type="text/html"
src={`https://www.dailymotion.com/embed/video/${id}`}
title={title}
width={width}
height={height}
allowfullscreen
/>
)
}

Dailymotion.propTypes = {
id: PropTypes.string.isRequired,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
title: PropTypes.string.isRequired,
className: PropTypes.string,
}

Dailymotion.defaultProps = {
width: "100%",
height: "100%",
title: "Dailymotion video player",
className: "video",
}
31 changes: 31 additions & 0 deletions src/components/pornhub.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react"
import PropTypes from "prop-types"

export default function PornHub({ id, width, height, title, className }) {
return (
<iframe
className={className}
width={width}
height={height}
title={title}
src={`https://www.pornhub.com/embed/${id}`}
frameBorder="0"
allowFullScreen
/>
)
}

PornHub.propTypes = {
id: PropTypes.string.isRequired,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
title: PropTypes.string.isRequired,
className: PropTypes.string,
}

PornHub.defaultProps = {
width: 560,
height: 315,
title: "PornHub video player",
className: "video",
}
33 changes: 33 additions & 0 deletions src/components/vimeo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from "react"
import PropTypes from "prop-types"

export default function Vimeo({ id, width, height, title, className }) {
return (
<iframe
className={className}
width={width}
height={height}
src={`https://player.vimeo.com/video/${id}`}
style="position:absolute;top:0;left:0;width:100%;height:100%;"
title={title}
frameborder="0"
allow="autoplay; fullscreen; picture-in-picture"
allowfullscreen
/>
)
}

Vimeo.propTypes = {
id: PropTypes.string.isRequired,
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
className: PropTypes.string,
title: PropTypes.string.isRequired,
}

Vimeo.defaultProps = {
width: "100%",
height: "100%",
className: "video",
title: "Vimeo video player",
}
Loading

0 comments on commit db52e70

Please sign in to comment.