Skip to content

Commit

Permalink
Merge branch 'master' of github.com:gatsbyjs/gatsby into oss-telemetr…
Browse files Browse the repository at this point in the history
…y-part2
  • Loading branch information
jamo committed Sep 30, 2020
2 parents 94edfa8 + 710667f commit 5fda083
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 48 deletions.
2 changes: 0 additions & 2 deletions dictionary.txt
Expand Up @@ -1249,7 +1249,6 @@ metacompiler
metadescription
metafields
Metalsmith
metatags
METROGLAM
Meuleman
Michał
Expand Down Expand Up @@ -1648,7 +1647,6 @@ redux
Redux
Reduxjs
ReferenceError
ReflexJS
reformats
reframe
rehydrate
Expand Down
7 changes: 4 additions & 3 deletions docs/blog/gazette-july-2020/index.md
Expand Up @@ -9,9 +9,9 @@ tags: ["gatsby-gazette"]

July was full of ordinary items [revealed to be cakes 🍰](https://www.esquire.com/entertainment/tv/a33313974/cake-meme-explained/), and extraordinary websites powered by Gatsby Themes!

It’s been a year since we unveiled [Gatsby Themes](/docs/themes/what-are-gatsby-themes/) and celebrated the release with “Theme Jam”, a hackathon that produced dozens of [powerful and beautiful projects](https://themejam.gatsbyjs.org/showcase). A Gatsby Theme is like a Gatsby plugin that includes a gatsby-config.js file, and can add pre-configured functionality, data sourcing, and/or UI code to Gatsby sites. In the beginning we saw most developers focus on the UI capabilities of themes. A year later we see themes package, split, and combine functionality for every common website use case you can think of! [Search “theme” in the plugins directory](https://www.gatsbyjs.org/plugins/?=theme) to discovery over 400 Gatsby Themes you can use for your own projects.
It’s been a year since we unveiled [Gatsby Themes](/docs/themes/what-are-gatsby-themes/) and celebrated the release with “Theme Jam”, a hackathon that produced dozens of [powerful and beautiful projects](https://themejam.gatsbyjs.org/showcase). A Gatsby Theme is like a Gatsby plugin that includes a `gatsby-config.js` file, and can add pre-configured functionality, data sourcing, and/or UI code to Gatsby sites. In the beginning we saw most developers focus on the UI capabilities of themes. A year later we see themes package, split, and combine functionality for every common website use case you can think of! [Search “theme” in the plugins directory](https://www.gatsbyjs.org/plugins/?=theme) to discovery over 400 Gatsby Themes you can use for your own projects.

July was also a huge month for official Gatsby Themes. We [updated our popular Blog Theme to 2.0](/blog/2020-07-08-blog-2.0/) and introduced better image support, search engine optimization, webfont configuration, and more. We also made it easier to swap styles for your blog, using Theme-UI presets. Don’t be fooled by the name “blog” though. This theme is the perfect add-on for any site that needs to continually publish content. The lead engineer on the theme, [Laurie Barth](https://laurieontech.com/) also revamped [the step-by-step Gatsby Blog Theme tutorial](https://www.gatsbyjs.org/tutorial/using-a-theme/), so you can get started customizing this theme quickly.
July was also a huge month for official Gatsby Themes. We [updated our popular Blog Theme to 2.0](/blog/2020-07-08-blog-2.0/) and introduced better image support, search engine optimization, webfont configuration, and more. We also made it easier to swap styles for your blog, using Theme UI presets. Don’t be fooled by the name “blog” though. This theme is the perfect add-on for any site that needs to continually publish content. The lead engineer on the theme, [Laurie Barth](https://laurieontech.com/) also revamped [the step-by-step Gatsby Blog Theme tutorial](https://www.gatsbyjs.org/tutorial/using-a-theme/), so you can get started customizing this theme quickly.

Also this month, we released a new official theme for adding [i18n support to your Gatsby site](https://www.gatsbyjs.org/blog/2020-07-28-introducing-gatsby-i18n-theme/)! This i18n theme gives you access to specialized React components that help with building a multilingual site. The lead developer on this theme, [Lennart Jörgens](https://www.lekoarts.de/) also created 3 “child themes” for popular translation libraries. The i18n theme is great to use for any project that requires localization, but is also a solid example to study if you want to [build your own Gatsby Theme](/tutorial/building-a-theme/).

Expand Down Expand Up @@ -46,11 +46,12 @@ Previously [static query](https://www.gatsbyjs.org/docs/static-query/) results i
## 🌍 New from the Gatsby Community

[Alexandra Spalato](https://alexandraspalato.com/) and [Paulina Hetman](https://pehaa.com/) appeared [on the Party Corgi Podcast](https://party-corgi-podcast.simplecast.com/episodes/the-first-commercial-gatsby-wordpress-themes-with-alexandra-spalato-and-paulina-hetman) to talk about making premium [Gatsby Themes for WordPress](https://gatsbywpthemes.com/). We’ve seen a sneak peek of their work, and both the Gatsby and WordPress communities are going to be blown away by these projects 🚀.

https://twitter.com/partycorgipod/status/1288087382504419335

[Matías Hernández Arellano](https://matiashernandez.dev/) authored an Egghead course on creating a Gatsby source plugin. You can watch it in [English](https://egghead.io/playlists/creating-a-gatsby-source-plugin-3f01) or [in Spanish](https://egghead.io/playlists/creacion-de-un-plugin-de-gatsby-desde-cero-5c8b).

Arshad is back with another Gatsby Theme for to his growing [ReflexJS](https://reflexjs.org/) collection. This new theme adds a video section to your site, and is optimized with SEO, OG and Twitter metatags. Reflex also comes with beautiful, [ready-to-use components](https://reflexjs.org/library/blocks) so you can customize the style and layout of your site quickly.
Arshad is back with another Gatsby Theme for to his growing [Reflex](https://reflexjs.org/) collection. This new theme adds a video section to your site, and is optimized with SEO, OG and Twitter meta tags. Reflex also comes with beautiful, [ready-to-use components](https://reflexjs.org/library/blocks) so you can customize the style and layout of your site quickly.

![Reflex screenshot](./reflex.png)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -13,12 +13,12 @@
"@types/eslint": "^6.8.1",
"@types/express": "^4.17.3",
"@types/fast-levenshtein": "^0.0.1",
"@types/fs-extra": "^8.1.0",
"@types/fs-extra": "^8.1.1",
"@types/got": "^9.6.11",
"@types/jaeger-client": "^3.15.4",
"@types/jest": "^24.9.1",
"@types/joi": "^14.3.4",
"@types/lodash": "^4.14.149",
"@types/lodash": "^4.14.161",
"@types/node": "^12.12.30",
"@types/node-fetch": "^2.5.7",
"@types/normalize-path": "^3.0.0",
Expand Down Expand Up @@ -95,7 +95,7 @@
},
"resolutions": {
"theme-ui": "0.4.0-rc.1",
"csstype": "2.6.10"
"csstype": "2.6.13"
},
"engines": {
"yarn": "^1.17.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-cli/package.json
Expand Up @@ -13,7 +13,7 @@
"@babel/code-frame": "^7.10.4",
"@hapi/joi": "^15.1.1",
"@types/common-tags": "^1.8.0",
"better-opn": "^1.0.0",
"better-opn": "^2.0.0",
"chalk": "^2.4.2",
"clipboardy": "^2.3.0",
"common-tags": "^1.8.0",
Expand Down
38 changes: 38 additions & 0 deletions packages/gatsby-plugin-catch-links/src/__tests__/catch-links.js
Expand Up @@ -490,3 +490,41 @@ describe(`pathPrefix is handled if caught link to ${pathPrefix}/article navigate
clickElement.dispatchEvent(clickEvent)
})
})

describe(`navigation is routed through browser without SVGAnimatedString support`, () => {
let hrefHandler
let eventDestroyer
let oldSVGAnimatedString = SVGAnimatedString

beforeAll(() => {
hrefHandler = jest.fn()
eventDestroyer = catchLinks.default(window, {}, hrefHandler)
delete global.SVGAnimatedString
})

afterAll(() => {
eventDestroyer()
global.SVGAnimatedString = oldSVGAnimatedString
})

test(`works without throwing an error`, () => {
// create a click element to use for testing
const clickElement = document.createElement(`a`)
clickElement.setAttribute(`href`, `${window.location.href}/article`)
document.body.appendChild(clickElement)

// create the click event we'll be using for testing
const clickEvent = new MouseEvent(`click`, {
bubbles: true,
cancelable: true,
view: window,
})

// and trigger click
clickElement.dispatchEvent(clickEvent)

expect(() =>
catchLinks.routeThroughBrowserOrApp(jest.fn())(clickEvent)
).not.toThrow()
})
})
5 changes: 4 additions & 1 deletion packages/gatsby-plugin-catch-links/src/catch-links.js
Expand Up @@ -130,7 +130,10 @@ export const routeThroughBrowserOrApp = (
destination.href = clickedAnchor.href
}

if (clickedAnchor.href instanceof SVGAnimatedString) {
if (
`SVGAnimatedString` in window &&
clickedAnchor.href instanceof SVGAnimatedString
) {
destination.href = clickedAnchor.href.animVal
}

Expand Down
29 changes: 18 additions & 11 deletions packages/gatsby-plugin-guess-js/README.md
Expand Up @@ -85,26 +85,33 @@ module.exports = {

### How to get a JWT token?

> Excerpt from https://2ality.com/2015/10/google-analytics-api.html
> Excerpt from https://developers.google.com/identity/protocols/oauth2/service-account
Go to the Google Developers Console:
1. Open the [Google developer console IAM & admin](https://console.developers.google.com/iam-admin)
2. If prompted, select a project, or create a new one.
3. Click add **service account**.
4. on top click **Create service account**, type a name, ID, and description for the service account, then click **Create**.
5. Optional: Under **Service account permissions**, select the IAM roles to grant to the service account, then click **Continue**.
6. Optional: Under **Grant users access to this service account**, add the users or groups that are allowed to use and manage the service account.
7. Click on **three dots under actions** , then click **Create**.

- Create a new project (e.g. myproject).
- In section “APIs & auth → Credentials”, execute “Add credentials → Service account”.
- Download the resulting JSON file (e.g. “myproject-3126e4caac6a.json”).
- Put that file into a directory node_modules that is inside one of the parent directories of the script that we’ll create later. That means that you can keep it out of the repository with analytics.js. For example, the following path is perfectly fine:
`\$HOME/node_modules/myproject-3126e4caac6a.json`
- The credentials that you created have an email address (which is displayed in the user interface and stored inside the JSON file). Copy that email address.
- Put that file into a directory node_modules that is inside one of the parent directories of the script that we’ll create later. That means that you can keep it out of the repository with analytics.js. For example, the following path is perfectly fine:
`\$HOME/node_modules/myproject-3126e4caac6a.json`
- The credentials that you created have an `client_email` address (which is displayed in the user interface and stored inside the JSON file). Copy that email address.

Go to the Admin panel in Google Analytics:

- Analytics has three scopes:
- Account
- Property
- View
- Create a new user in scope “Property”, via “User Management”.
- That user has the email address that you copied previously.
- Create a new user in scope “Property”, via “Admin -> View User Management -> Plus icon -> Add User”.
- That user has the email address that you copied previously from the json file `client_email`.
- Its permissions are “Read & Analyze”.
- In scope “View”, go to “View Settings” and write down the “View ID” (e.g. 97675673) for later.

> This JWT will only be valid for a finite amount of time. If you would like to generate a token that will not expire, please follow further instructions in https://2ality.com/2015/10/google-analytics-api.html
**Note:** This JWT will only be valid for a finite amount of time. If you would like to generate a token that will not expire, please follow further instructions in https://2ality.com/2015/10/google-analytics-api.html

#### Troubleshooting

- "User does not have any Google Analytics Account": [StackOverflow answer](https://stackoverflow.com/questions/12837748/analytics-google-api-error-403-user-does-not-have-any-google-analytics-account/62998591#62998591)
2 changes: 1 addition & 1 deletion packages/gatsby-remark-copy-linked-files/package.json
Expand Up @@ -22,7 +22,7 @@
"babel-preset-gatsby-package": "^0.5.3",
"cross-env": "^7.0.2",
"remark": "^10.0.1",
"remark-mdx": "^1.6.6"
"remark-mdx": "^1.6.18"
},
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-remark-copy-linked-files#readme",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-remark-prismjs/package.json
Expand Up @@ -17,7 +17,7 @@
"babel-preset-gatsby-package": "^0.5.3",
"cheerio": "^1.0.0-rc.3",
"cross-env": "^7.0.2",
"prismjs": "^1.20.0",
"prismjs": "^1.21.0",
"remark": "^9.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-source-contentful/src/extend-node-type.js
Expand Up @@ -61,7 +61,7 @@ const getBase64Image = imageProps => {
// TODO: Find the best place for this step. This is definitely not it.
fs.mkdirSync(CACHE_IMG_FOLDER, { recursive: true })

const cacheFile = path.join(CACHE_IMG_FOLDER, urlSha)
const cacheFile = path.join(CACHE_IMG_FOLDER, urlSha + `.base64`)

if (fs.existsSync(cacheFile)) {
// TODO: against dogma, confirm whether readFileSync is indeed slower
Expand Down
6 changes: 6 additions & 0 deletions packages/gatsby-telemetry/README.md
Expand Up @@ -4,8 +4,14 @@ Check out: [gatsby.dev/telemetry](https://gatsby.dev/telemetry)

## API

### captureEvent(type, tags)

Capture an event of type `type` and decorate the generated event with these tags (note: allowed tags are filtered on server side)

### trackCli(type, tags)

_This one does the same thing as the `captureEvent` function described above._

Capture an event of type `type` and decorate the generated event with these tags (note: allowed tags are filtered on server side)

### trackError(type, tags)
Expand Down
16 changes: 16 additions & 0 deletions packages/gatsby-telemetry/src/index.ts
Expand Up @@ -41,6 +41,14 @@ export function trackCli(
instance.captureEvent(input, tags, opts)
}

export function captureEvent(
input: string | Array<string>,
tags?: ITelemetryTagsPayload,
opts?: ITelemetryOptsPayload
): void {
instance.captureEvent(input, tags, opts)
}

export function trackError(input: string, tags?: ITelemetryTagsPayload): void {
instance.captureError(input, tags)
}
Expand Down Expand Up @@ -105,6 +113,14 @@ export function setGatsbyCliVersion(version: string): void {
instance.gatsbyCliVersion = version
}

export {
AnalyticsTracker,
IAggregateStats,
ITelemetryTagsPayload,
ITelemetryOptsPayload,
IDefaultTelemetryTagsPayload,
}

module.exports = {
trackFeatureIsUsed,
trackCli,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/package.json
Expand Up @@ -36,7 +36,7 @@
"babel-plugin-lodash": "3.3.4",
"babel-plugin-remove-graphql-queries": "^2.9.20",
"babel-preset-gatsby": "^0.5.11",
"better-opn": "1.0.0",
"better-opn": "^2.0.0",
"better-queue": "^3.8.10",
"bluebird": "^3.7.2",
"body-parser": "^1.19.0",
Expand Down
8 changes: 5 additions & 3 deletions renovate.json5
Expand Up @@ -10,7 +10,8 @@
":disablePeerDependencies",
":maintainLockFilesDisabled",
":disableRateLimiting",
":label(maintenance)",
":label(type: maintenance)",
":label(topic: automation)",
":ignoreModulesAndTests",
":enableVulnerabilityAlerts",
],
Expand All @@ -27,7 +28,7 @@
stabilityDays: 2,
postUpdateOptions: ["yarnDedupeHighest"],
timezone: "GMT",
schedule: ["before 7am"],
schedule: ["before 7am on Monday"],
packageRules: [
{
depTypeList: ["engines"],
Expand All @@ -42,7 +43,7 @@
{
groupName: "starters and examples",
paths: ["starters/**", "examples/**"],
schedule: "before 3am on Monday",
schedule: "before 7am on Monday",
},
{
extends: ["monorepo:gatsby"],
Expand All @@ -51,6 +52,7 @@
automerge: true,
stabilityDays: 0,
prPriority: 50,
schedule: "at any time",
},
{
groupName: "remark docs linting",
Expand Down
41 changes: 21 additions & 20 deletions yarn.lock
Expand Up @@ -3544,10 +3544,10 @@
resolved "https://registry.yarnpkg.com/@types/fast-levenshtein/-/fast-levenshtein-0.0.1.tgz#3a3615cf173645c8fca58d051e4e32824e4bd286"
integrity sha1-OjYVzxc2Rcj8pY0FHk4ygk5L0oY=

"@types/fs-extra@^8.1.0":
version "8.1.0"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.0.tgz#1114834b53c3914806cd03b3304b37b3bd221a4d"
integrity sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg==
"@types/fs-extra@^8.1.1":
version "8.1.1"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.1.tgz#1e49f22d09aa46e19b51c0b013cb63d0d923a068"
integrity sha512-TcUlBem321DFQzBNuz8p0CLLKp0VvF/XH9E4KHNmgwyp4E3AfgI5cjiIVZWlbfThBop2qxFIh4+LeY6hVWWZ2w==
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -3677,7 +3677,7 @@
dependencies:
"@types/lodash" "*"

"@types/lodash@*", "@types/lodash@^4.14.149", "@types/lodash@^4.14.92":
"@types/lodash@*", "@types/lodash@^4.14.161", "@types/lodash@^4.14.92":
version "4.14.161"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.161.tgz#a21ca0777dabc6e4f44f3d07f37b765f54188b18"
integrity sha512-EP6O3Jkr7bXvZZSZYlsgt5DIjiGr0dXP1/jVEwVLTFgg0d+3lWVQkRavYVQszV7dYUwvg0B8R0MBDpcmXg7XIA==
Expand Down Expand Up @@ -5684,12 +5684,12 @@ better-assert@~1.0.0:
dependencies:
callsite "1.0.0"

better-opn@1.0.0, better-opn@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/better-opn/-/better-opn-1.0.0.tgz#0454e4bb9115c6a9e4e5744417dd9c97fb9fce41"
integrity sha512-q3eO2se4sFbTERB1dFBDdjTiIIpRohMErpwBX21lhPvmgmQNNrcQj0zbWRhMREDesJvyod9kxBS3kOtdAvkB/A==
better-opn@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/better-opn/-/better-opn-2.0.0.tgz#c70d198e51164bdc220306a28a885d9ac7a14c44"
integrity sha512-PPbGRgO/K0LowMHbH/JNvaV3qY3Vt+A2nH28fzJxy16h/DfR5OsVti6ldGl6S9SMsyUqT13sltikiAVtI6tKLA==
dependencies:
open "^6.4.0"
open "^7.0.3"

better-queue-memory@^1.0.1:
version "1.0.3"
Expand Down Expand Up @@ -8008,10 +8008,10 @@ cssstyle@^2.0.0:
dependencies:
cssom "~0.3.6"

csstype@2.6.10, csstype@^2.2.0, csstype@^2.5.7, csstype@^2.6.13, csstype@^2.6.9:
version "2.6.10"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.10.tgz#e63af50e66d7c266edb6b32909cfd0aabe03928b"
integrity sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==
csstype@2.6.13, csstype@^2.2.0, csstype@^2.5.7, csstype@^2.6.13, csstype@^2.6.9:
version "2.6.13"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.13.tgz#a6893015b90e84dd6e85d0e3b442a1e84f2dbe0f"
integrity sha512-ul26pfSQTZW8dcOnD2iiJssfXw0gdNVX9IJDH/X3K5DGPfj+fUYe3kB+swUY6BF3oZDxaID3AJt+9/ojSAE05A==

csvtojson@^2.0.10:
version "2.0.10"
Expand Down Expand Up @@ -17506,12 +17506,13 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"

open@^6.4.0:
version "6.4.0"
resolved "https://registry.yarnpkg.com/open/-/open-6.4.0.tgz#5c13e96d0dc894686164f18965ecfe889ecfc8a9"
integrity sha512-IFenVPgF70fSm1keSd2iDBIDIBZkroLeuffXq+wKTzTJlBpesFWojV9lb8mzOfaAzM1sr7HQHuO0vtV0zYekGg==
open@^7.0.3:
version "7.2.1"
resolved "https://registry.yarnpkg.com/open/-/open-7.2.1.tgz#07b0ade11a43f2a8ce718480bdf3d7563a095195"
integrity sha512-xbYCJib4spUdmcs0g/2mK1nKo/jO2T7INClWd/beL7PFkXRWgr8B23ssDHX/USPn2M2IjDR5UdpYs6I67SnTSA==
dependencies:
is-wsl "^1.1.0"
is-docker "^2.0.0"
is-wsl "^2.1.1"

opencollective-postinstall@^2.0.0, opencollective-postinstall@^2.0.2:
version "2.0.2"
Expand Down Expand Up @@ -19017,7 +19018,7 @@ prism-react-renderer@^1.1.1:
resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.1.1.tgz#1c1be61b1eb9446a146ca7a50b7bcf36f2a70a44"
integrity sha512-MgMhSdHuHymNRqD6KM3eGS0PNqgK9q4QF5P0yoQQvpB6jNjeSAi3jcSAz0Sua/t9fa4xDOMar9HJbLa08gl9ug==

prismjs@^1.20.0, prismjs@^1.21.0:
prismjs@^1.21.0:
version "1.21.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.21.0.tgz#36c086ec36b45319ec4218ee164c110f9fc015a3"
integrity sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw==
Expand Down

0 comments on commit 5fda083

Please sign in to comment.