Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next release #158

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on: push
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Make sure the release step uses its own credentials.
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "lts/*"
- name: Install dependencies
run: yarn install
- name: Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ node_modules/
public/
.cache/
coverage/
.prefetched-providers.json
prefetched-providers.json
*.log
54 changes: 54 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"branches": [
"main",
{
"name": "next",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{
"type": "docs",
"scope": "README",
"release": "patch"
}
],
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES"
]
}
}
],
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/npm",
{
"pkgRoot": "gatsby-remark-oembed"
}
],
[
"@semantic-release/git",
{
"assets": [
"gatsby-remark-oembed/package.json",
"CHANGELOG.md",
"yarn.lock"
]
}
],
"@semantic-release/github"
]
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [0.2.0-next.3](https://github.com/queen-raae/gatsby-remark-oembed/compare/v0.2.0-next.2...v0.2.0-next.3) (2022-04-26)


### Bug Fixes

* use prepack to download provider list ([d421b84](https://github.com/queen-raae/gatsby-remark-oembed/commit/d421b849289dc6c23bb0246b4873f6daf31e4f06))

# [0.2.0-next.2](https://github.com/queen-raae/gatsby-remark-oembed/compare/v0.2.0-next.1...v0.2.0-next.2) (2022-04-26)


### Bug Fixes

* npm unignore prefetched-providers.json ([2dde20d](https://github.com/queen-raae/gatsby-remark-oembed/commit/2dde20d9628d29550e6798b4fbdabfa6a61069db))

# [0.2.0-next.1](https://github.com/queen-raae/gatsby-remark-oembed/compare/v0.1.1...v0.2.0-next.1) (2022-04-26)


### Features

* do not fetch providers list on evert build ([4c1ac9c](https://github.com/queen-raae/gatsby-remark-oembed/commit/4c1ac9c2109f0693e6755fc70e82f1571a90af3d))
54 changes: 44 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

> This GatsbyJS Remark Sub-Plugin transforms oEmbed links (Twitter, Instagram, YouTube, Vimeo, SoundCloud, CodePen etc.) into its corresponding embed code.

This is an early version of the plugin. Let me know if you have problems or questions by submitting an issue.
Works with both `gatsby-transformer-remark` and `gatsby-plugin-mdx`.

Let me know if you have problems or questions by submitting an issue.

## Install

Expand Down Expand Up @@ -30,13 +32,14 @@ Twitter, Flickr, Instagram and Reddit requires external javascript to be added t

> **Update:** Twitch removed oEmbed support in 2020 when deprecating their v5 API. It seems they are not planning to support oEmbed again. Unfortunately this means Twitch urls are no longer being transformed. Let them know how you feel about this [on their forum](https://discuss.dev.twitch.tv/t/oembed-deprecation/24424/2).

## Example site
## Demo sites

Check out [gatsby-remark-oembed.netlify.com/](https://gatsby-remark-oembed.netlify.com/). Its source code can be found in [gatsby-remark-oembed-example-site](/gatsby-remark-oembed-example-site).
- [Markdown Demo Site](https://gatsby-remark-oembed.netlify.com/)
- [Mdx Demo Site](https://gatsby-remark-oembed-mdx.netlify.app)

## How to use

### Configuration
### Configuration example for gatsby-transformer-remark

```js
// In your gatsby-config.js
Expand Down Expand Up @@ -65,6 +68,42 @@ plugins: [
];
```

### Configuration example for gatsby-plugin-mdx

```js
// In your gatsby-config.js
plugins: [
{
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
{
resolve: `@raae/gatsby-remark-oembed`,
options: {
// usePrefix defaults to false
// usePrefix: true is the same as ["oembed"]
usePrefix: ["oembed", "video"],
providers: {
// Important to exclude providers
// that adds js to the page.
// If you do not need them.
exclude: ["Reddit"],
},
providers: {
settings: {
Twitter: {
theme: "dark", // Use the Twitter light theme
},
},
},
},
},
],
},
},
];
```

#### Settings per provider

Many oEmbed providers offer additional options for configure the display of the embed.
Expand Down Expand Up @@ -176,11 +215,6 @@ This is a monorepo consisting of the plugin, and two example sites:

And the plugin `/gatsby-remark-oembed`.

By running `yarn dev` in the monorepo root you will spin up both sites.

- `/gatsby-remark-oembed-md-site` on [localhost:8000](http://localhost:8000/)
- `/gatsby-remark-oembed-mdx-site` on [localhost:8080](http://localhost:8080/)

## Release routines

Make sure you have checked out and updated master.
Expand All @@ -189,7 +223,7 @@ Change directory to `gatsby-remark-oembed`.

- Run `yarn version patch|minor|major`
- Run `yarn publish`
- Create a [release on Github](https://github.com/raae/gatsby-remark-oembed/releases/new).
- Create a [release on Github](https://github.com/queen-raae/gatsby-remark-oembed/releases/new).

## Buy me a coffee?

Expand Down
10 changes: 1 addition & 9 deletions gatsby-remark-oembed-md-site/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# gatsby-remark-oembed-example-site
# gatsby-remark-oembed-md-site

This is an example site for the [gatsby-remark-oembed](https://github.com/raae/gatsby-remark-oembed) plugin.

Based of the [gatsby-starter-blog](https://github.com/gatsbyjs/gatsby-starter-blog).

## Install

`npm install`

## Running in development

`gatsby develop`
7 changes: 1 addition & 6 deletions gatsby-remark-oembed-md-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "@raae (queen.raae.codes)",
"version": "1.0.0",
"license": "MIT",
"homepage": "https://github.com/raae/gatsby-remark-oembed-example-site#readme",
"homepage": "https://gatsby-remark-oembed.netlify.app/",
"scripts": {
"develop": "gatsby develop -p 8000",
"build": "gatsby build",
Expand Down Expand Up @@ -32,10 +32,5 @@
"typeface-montserrat": "1.1.13",
"typography": "^0.16.17",
"typography-theme-wordpress-2016": "^0.16.19"
},
"main": "n/a",
"repository": {
"type": "git",
"url": "https://github.com/raae/gatsby-remark-oembed-example-site"
}
}
10 changes: 1 addition & 9 deletions gatsby-remark-oembed-mdx-site/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# gatsby-remark-oembed-example-site
# gatsby-remark-oembed-mdx-site

This is an example site for the [gatsby-remark-oembed](https://github.com/raae/gatsby-remark-oembed) plugin.

Based of the [gatsby-starter-blog](https://github.com/gatsbyjs/gatsby-starter-blog).

## Install

`npm install`

## Running in development

`gatsby develop`
2 changes: 1 addition & 1 deletion gatsby-remark-oembed-mdx-site/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
providers: {
settings: {
Twitter: {
theme: "light", // Use the Twitter light theme
theme: "dark", // Use the Twitter light theme
},
Instagram: {
hidecaption: false,
Expand Down
7 changes: 1 addition & 6 deletions gatsby-remark-oembed-mdx-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "@raae (queen.raae.codes)",
"version": "1.0.0",
"license": "MIT",
"homepage": "https://github.com/raae/gatsby-remark-oembed-example-site#readme",
"homepage": "https://gatsby-remark-oembed-mdx.netlify.app/",
"scripts": {
"develop": "gatsby develop -p 8080",
"build": "gatsby build",
Expand Down Expand Up @@ -38,10 +38,5 @@
"devDependencies": {
"eslint": "^8.13.0",
"eslint-plugin-react": "^7.11.1"
},
"main": "n/a",
"repository": {
"type": "git",
"url": "https://github.com/raae/gatsby-remark-oembed-example-site"
}
}
2 changes: 1 addition & 1 deletion gatsby-remark-oembed/.npmignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!.prefetched-providers.json
!prefetched-providers.json
3 changes: 0 additions & 3 deletions gatsby-remark-oembed/gatsby-node.js

This file was deleted.

11 changes: 4 additions & 7 deletions gatsby-remark-oembed/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ const {
getProviders,
} = require("./utils");

module.exports = async (
{ markdownAST, markdownNode, cache, reporter },
rawOptions
) => {
module.exports = async (gatsbyUtils, rawOptions) => {
const { markdownAST, markdownNode, reporter } = gatsbyUtils;

try {
const options = amendOptions(rawOptions);
const providers =
(await getProviders({ cache, reporter }, rawOptions)) || [];

const providers = await getProviders(gatsbyUtils, options);
const nodes = selectPossibleOembedLinkNodes(markdownAST, options.usePrefix);

if (nodes.length > 0) {
Expand Down
14 changes: 9 additions & 5 deletions gatsby-remark-oembed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
"name": "@raae/gatsby-remark-oembed",
"description": "> A GatsbyJS Plugin that transforms oembed links into its corresponding embed code.",
"author": "@raae (queen.raae.codes)",
"version": "0.1.1",
"version": "0.2.0-next.3",
"license": "MIT",
"homepage": "https://github.com/lillylabs/gatsby-remark-oembed#readme",
"homepage": "https://github.com/queen-raae/gatsby-remark-oembed#readme",
"scripts": {
"develop": "yarn test:watch",
"lint": "eslint --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"prepublish": "./prepublish.js"
"prepack": "./prepublish.js",
"postversion": "cp ../README.md ./README.md"
},
"dependencies": {
"axios": "0.26.1",
Expand All @@ -27,6 +29,8 @@
"keywords": [
"gatsby",
"gatsby-plugin",
"gatsby-plugin-mdx",
"gatsby-transformer-remark",
"oembed",
"remark",
"youtube",
Expand All @@ -38,10 +42,10 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/lillylabs/gatsby-remark-oembed.git"
"url": "git+https://github.com/queen-raae/gatsby-remark-oembed.git"
},
"bugs": {
"url": "https://github.com/lillylabs/gatsby-remark-oembed/issues"
"url": "https://github.com/queen-raae/gatsby-remark-oembed/issues"
},
"main": "index.js",
"jest": {
Expand Down
Loading