forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gatsby-remark-code-repls): Resolved merge conflicts
Apparently we merged to master the previous version that added the feature to include the matching css in the folder if present. This version is the refactored one which also improves the API surface by scoping the options depending on the REPL provider BREAKING CHANGE: The API surface is not backward compatible anymore as the options have been scoped per-provider as suggested during code-review gatsbyjs#12110
- Loading branch information
Showing
852 changed files
with
23,631 additions
and
8,650 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# gatsby-plugin-manifest performance tests | ||
|
||
- Setup: `yarn` | ||
- Run: `yarn test` | ||
|
||
Benchmarks the current production version of the plugin unless you use `gatsby-dev`. | ||
|
||
## To benchmark the current branch: | ||
|
||
```sh | ||
# In the root of the Gatsby repository | ||
$ yarn run watch --scope=gatsby-plugin-manifest . | ||
``` | ||
|
||
```sh | ||
# In ./benchmarks/plugin-manifest | ||
# You'll need 'gatsby-dev' installed and configured globally. | ||
$ gatsby-dev --packages gatsby-plugin-manifest | ||
``` | ||
|
||
You may now switch branches using `git checkout` and edit code on the current branch. Changes will be compiled into the local `node_modules` for the benchmark. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
const { onPostBootstrap } = require(`gatsby-plugin-manifest/gatsby-node`) | ||
const reporter = require(`gatsby-cli/lib/reporter`) | ||
const fs = require(`fs-extra`) | ||
|
||
//Config for executing onPostBootstrap | ||
const pluginOptions = { | ||
name: `GatsbyJS`, | ||
short_name: `GatsbyJS`, | ||
start_url: `/`, | ||
background_color: `#ffffff`, | ||
theme_color: `#663399`, | ||
display: `minimal-ui`, | ||
icon: `../../www/src/assets/gatsby-icon.png`, | ||
cache_busting_mode: `none`, | ||
} | ||
|
||
//Global Variables | ||
let results = { seconds: [], nanoseconds: [] } | ||
let sum = [0, 0] | ||
let rounds = process.env.TOTAL_ROUNDS || 20 | ||
|
||
//Execute a single test of onPostBootstrap | ||
async function executeBootstrap() { | ||
const timeStart = process.hrtime() | ||
await onPostBootstrap({ reporter }, pluginOptions) | ||
const timeEnd = process.hrtime(timeStart) | ||
|
||
// console.info( | ||
// "Execution time (hr): %ds %dms", | ||
// timeEnd[0], | ||
// timeEnd[1] / 1000000 | ||
// ) | ||
|
||
results.seconds.push(timeEnd[0]) | ||
results.nanoseconds.push(timeEnd[1]) | ||
sum[0] += timeEnd[0] | ||
sum[1] += timeEnd[1] | ||
|
||
fs.removeSync(`public/icons`) | ||
fs.removeSync(`public/manifest.webmanifest`) | ||
} | ||
|
||
//Loop test to run multiple times and calculate results | ||
async function runTest() { | ||
console.info(`Timing 'onPostBootstrap' running ${rounds} times.`) | ||
|
||
for (let i = 0; i < rounds; i++) { | ||
// process.stdout.write(`Round ${i + 1}: `) | ||
await executeBootstrap(i) | ||
} | ||
|
||
let averageSum = [0, 0] | ||
averageSum[0] = sum[0] / rounds | ||
averageSum[1] = sum[1] / rounds | ||
|
||
console.info( | ||
`\nAverage execution time (hr): %ds %dms`, | ||
averageSum[0], | ||
averageSum[1] / 1000000 | ||
) | ||
|
||
console.info( | ||
`\nMax execution time (hr): ${Math.max(...results.nanoseconds) / 1000000}ms` | ||
) | ||
console.info( | ||
`\nMin execution time (hr): ${Math.min(...results.nanoseconds) / 1000000}ms` | ||
) | ||
|
||
console.info( | ||
`\nRange execution time (hr): ${(Math.max(...results.nanoseconds) - | ||
Math.min(...results.nanoseconds)) / | ||
1000000}ms` | ||
) | ||
} | ||
|
||
//execute | ||
runTest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "benchmark-gatsby-plugin-manifest", | ||
"version": "1.0.0", | ||
"description": "Run manifest lots of times", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node index.js" | ||
}, | ||
"author": "Alex Moon <[email protected]", | ||
"license": "MIT", | ||
"dependencies": { | ||
"fs-extra": "^7.0.1", | ||
"gatsby-plugin-manifest": "^2.0.25" | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
title: "Improvements to Plugin Authoring Experience" | ||
date: 2019-04-25 | ||
author: Shannon Soper | ||
tags: ["ux", "plugins"] | ||
--- | ||
|
||
We recently interviewed authors of popular Gatsby plugins; here's what we learned and how we're changing to support plugin authors! | ||
|
||
## Stats on interviewees | ||
|
||
We interviewed 6 authors of and/or contributors to popular plugins: | ||
|
||
- [Espen Hovlandsdal](https://github.com/rexxars), who helps maintain and work on [`gatsby-source-sanity`](https://www.gatsbyjs.org/packages/gatsby-source-sanity/) | ||
- [Orestis Ioannou](https://github.com/oorestisime), who created [`gatsby-source-instagram`](https://www.gatsbyjs.org/packages/gatsby-source-instagram/?=gatsby-source-instagram), [`gatsby-source-dropbox`](https://www.gatsbyjs.org/packages/gatsby-source-dropbox/?=gatsby-source-dropbox), [`gatsby-remark-rehype-images`](https://www.gatsbyjs.org/packages/gatsby-remark-rehype-images/?=gatsby-remark-reh), [`gatsby-source-marvel`](https://www.gatsbyjs.org/packages/gatsby-source-marvel/?=gatsby-source-marvel), and has worked on [`gatsby-source-pilon`](https://www.gatsbyjs.org/packages/gatsby-source-pilon/?=gatsby-source-pilo) | ||
- [Tyler Barnes](https://github.com/TylerBarnes), who created [`gatsby-plugin-transition-link`](https://www.gatsbyjs.org/packages/gatsby-plugin-transition-link/?=transition-link) and is working on an alternative WordPress source plugin | ||
- [Christopher Biscardi](https://github.com/ChristopherBiscardi), who created [`gatsby-mdx`](https://github.com/ChristopherBiscardi/gatsby-mdx) | ||
- [Mike Allanson](https://github.com/m-allanson), who built proprietary plugins to pull data from a custom CMS for the [http://2018.stateofeuropeantech.com/](http://2018.stateofeuropeantech.com/) and | ||
[ http://2017.stateofeuropeantech.com](http://2017.stateofeuropeantech.com) sites | ||
- [Michal Piechowiak](https://github.com/pieh), who contributed to the [`gatsby-source-wordpress`](https://www.gatsbyjs.org/packages/gatsby-source-wordpress/?=gatsby-source-wordpress) plugin | ||
- [Ali Mahmoud](https://github.com/babbins) who is well-acquainted with the challenges and joys of maintaining the [`gatsby-plugin-pointer-events`](https://www.gatsbyjs.org/packages/gatsby-plugin-pointer-events/?=gatsby-plugin-pointer) plugin, which was created by [Tim Brown](https://github.com/brimtown) | ||
|
||
Thanks to all for taking the time to give thoughtful interviews! | ||
|
||
> Are you a plugin author/maintainer? If you have additional feedback that is not covered by this article, please [let us know here](https://docs.google.com/forms/d/e/1FAIpQLSfhZOKcnbGvAYAzwWUXuVNkeGFGDHZP8DNdabj7CUG27kBngg/viewform?usp=sf_link) | ||
> If you're thinking of creating a plugin, [sign up for a CLI usability test](https://calendly.com/shannon-soper/gatsby-research-call-gatsby-cli). You'll get to try out some new things in the CLI! | ||
## Why do people decide to create a plugin? | ||
|
||
We asked people what motivated them to create and maintain a plugin so we can make sure to support them in their goals. Most plugin authors we interviewed said something like: “I created the plugin to solve a problem I had that other plugins couldn’t solve". Typically, other plugins couldn't solve the problem because they weren’t v2 compatible, weren’t being maintained, or didn’t exist. | ||
|
||
For example, Tyler Barnes is working on alternative WordPress source plugin, with a functionality closer to how Netlify CMS works as opposed to pulling from the WP REST API every time. | ||
|
||
Why? Pulling all data and images every time he started `gatsby develop` was annoying — some of the sites were big and it could take 2 minutes to download. Local images would get dumped so he’d wait 10 minutes for the images to get processed again. Some cheaper servers were limited and would crash when trying to handle large numbers of images. He said he “wanted to make WP and Gatsby work on a crappy server.” | ||
|
||
What did he do to solve his problem? | ||
He commits the data instead so it’s available on the local machine instead. He was using gatsby-source-wordpress and adding extra stuff to it (permalink support, etc.) and then turned that functionality into a plugin. He basically added the features necessary to make it work like Netlify CMS and didn’t need to use the source plugin anymore. | ||
|
||
Creating a plugin isn't the only kind of contribution that helps others; @pieh's story of how he started to contribute to Gatsby involves editing a plugin:“`gatsby-source-wordpress` didn’t handle gallery type fields which I needed for some freelance work. It was my first PR to work on that plugin”. | ||
|
||
Other reasons people build plugins include having fun! According to Orestis, “Learning is fun! Actually having people open pull request against my plugins is also fun”. | ||
|
||
## How can we better support plugin authors? | ||
|
||
ANSWER: make time-consuming things take less time, and make frustrating things less frustrating :) | ||
|
||
## Make time-consuming things take less time | ||
|
||
People who use plugin authoring docs say they are super helpful; however, most people don’t know about them and solve challenges through looking at the source code of other plugins. While this works for many people, we think making this even easier is a positive change. | ||
|
||
## Solution | ||
|
||
- [Gatsby CLI to add scaffolding for source plugin creation #13376](https://github.com/gatsbyjs/gatsby/issues/13376) | ||
- [Invite new Gatsby users to learn more about plugin authoring via CLI #13377](https://github.com/gatsbyjs/gatsby/issues/13377) | ||
|
||
## Make frustrating things less frustrating | ||
|
||
It's frustrating that many plugins are outdated or not maintained. | ||
|
||
Examples of things that are confusing: | ||
|
||
- Yarn link has weird inconsistencies | ||
- People run into issues around processing a lot of nodes in a for loop | ||
- There's some misunderstanding around how async/await works — one person said they were awaiting everything instead of creating an array of Promises and using Promise.all() | ||
- Most people don’t know how to write automated tests for plugins and mentioned building a site just to test the plugin, which they felt wasn't the most ideal way to test | ||
- Rebuilding for every change often “feels wrong” to people | ||
|
||
## Solution | ||
|
||
[Redesigned the plugin docs](https://github.com/gatsbyjs/gatsby/pull/13261/files) to include a category called "Creating Plugins" where we can document answers to people's concerns; for example, ideas for how to test plugins and advice to use yarn workspaces to avoid yarn link inconsistencies. | ||
|
||
## What we need help with | ||
|
||
It'd be great to get help with any of the following: | ||
|
||
- Use [schema customization](https://www.gatsbyjs.org/blog/2019-03-04-new-schema-customization/) since this solves one of the biggest complaints of plugin authors! | ||
- Add your tips and tricks to the [maintaining a plugin docs page](https://www.gatsbyjs.org/docs/maintaining-a-plugin/) | ||
|
||
* Comment on this issue: [Gatsby CLI to add scaffolding for source plugin creation #13376](https://github.com/gatsbyjs/gatsby/issues/13376) | ||
* Comment on this issue: [Invite new Gatsby users to learn more about plugin authoring via CLI #13377](https://github.com/gatsbyjs/gatsby/issues/13377) | ||
|
||
Read these ideas and create issues and/or PRs for ones that prove valuable! | ||
|
||
- Add a “processAllNodes()” helper that automatically sets up the Promise.all() so people don’t need to know how this works | ||
- Plugin library default filter set to v2 compatible. Script to grab file, looks for exported APIs that aren’t compatible | ||
- Create end-to-end tests for plugins (more needed for internal/core plugins where we want to test the outpout) | ||
- Create #plugin-authoring Discord channel and publicize the #contributing channel more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: Accessibility Statement | ||
--- | ||
|
||
_Last updated: April 8, 2019_ | ||
|
||
We want everyone who uses Gatsby to feel welcome and find the experience rewarding: this includes developers with disabilities and users with disabilities for Gatsby sites, docs, and resources. | ||
|
||
This page was created to collect accessibility information about the Gatsby ecosystem in one place and provide communication channels for people with disabilities to get help with Gatsby. | ||
|
||
## Gatsby products and services | ||
|
||
Gatsbyjs.org is the online home of the open source Gatsby website framework; it includes documentation, tutorials, and guides on how and why to build with Gatsby, as well as a blog, site showcase, and information on how to contribute to the project. | ||
|
||
Gatsbyjs.com is the business website for Gatsby, Inc. the startup building Gatsby, including our first product, Gatsby Preview: a cloud service allowing team members to collaborate on a Gatsby site in development. | ||
|
||
## Providing feedback and getting accessibility help | ||
|
||
We strive to make these websites and the Gatsby framework itself as accessible as possible. Our goal is to meet [WCAG 2.0 AA](https://www.w3.org/TR/WCAG20/), with which we are partially compliant. We’ll be the first to admit the Gatsby ecosystem is a work in progress, and we are open to all feedback to make things better. | ||
|
||
To contact the core team with your accessibility feedback or challenges, please [file an issue on GitHub](https://github.com/gatsbyjs/gatsby/issues/new/choose). | ||
|
||
Alternatively, we welcome you to reach out directly to Marcy Sutton, Head of Learning at Gatsby: [[email protected]](mailto:[email protected]) | ||
|
||
## Building with Gatsby | ||
|
||
To learn how to build an accessible website with Gatsby, visit our [docs accessibility page](/docs/making-your-site-accessible/). Contributions are very welcome as this page evolves. | ||
|
||
## Third-party platforms, products and services | ||
|
||
Common Gatsby workflows involve third-party products and services, such as sourcing from Content Management Systems, and managing and deploying sites with hosting platforms. Some of these platforms appear to have been designed and/or built without accessibility in mind; we encourage those vendors to improve their accessibility along with us. | ||
|
||
Our current recommendations for accessible CMS platforms are: | ||
|
||
- Wordpress with the Classic Editor Plugin | ||
- Drupal | ||
|
||
For managing and deploying Gatsby sites with accessible tools, we recommend: | ||
|
||
- Netlify | ||
|
||
To provide feedback for third-party services, you can contact those vendors directly or [write to us](mailto:[email protected]), and we will do our best to pass the information along. We're also interested in hearing about your successes with third-party platforms! | ||
|
||
## Surveys and research projects | ||
|
||
The Gatsby team conducts surveys and research projects from time to time. We highly value feedback from all Gatsby users, and particularly those with experience applicable to the research being conducted. | ||
|
||
To be considered for these initiatives, please contact [[email protected]](mailto:[email protected]). |
Oops, something went wrong.