Skip to content

Commit

Permalink
fix: merge main into nerd-days branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jaesius committed Aug 19, 2020
2 parents bc214cc + 07c8b4a commit e2c0edf
Show file tree
Hide file tree
Showing 134 changed files with 14,680 additions and 5,218 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/fetch-related-content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Fetch related pages from Swiftype

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # start of every day

env:
BOT_NAME: nr-opensource-bot
BOT_EMAIL: [email protected]

jobs:
fetch-swiftype-results:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 12

- name: Cache node_modules
id: cache-node
uses: actions/cache@v2
env:
cache-name: node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
- name: Install dependencies
run: npm ci

- name: Gatsby Build
run: npm run build:related-content

- name: Commit changes
id: commit-changes
run: |
git config --local user.email "${{ env.BOT_EMAIL }}"
git config --local user.name "${{ env.BOT_NAME }}"
git add ./src/data/related-pages.json
git commit -m 'chore(related-content): updated related content data'
echo "::set-output name=commit::true"
- name: Push Commit
if: steps.commit-changes.outputs.commit == 'true'
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
branch: main
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
# todo: change this branch name
- master
- main

env:
BOT_NAME: nr-opensource-bot
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.OPENSOURCE_BOT_TOKEN }}
branch: master
branch: main

generate-changelog:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"branches": ["master"],
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
403 changes: 403 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions COMPONENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,39 @@ Text

</Caution>
```

## Related Resources

The related resources component is controlled by specific Frontmatter slugs that
are defined on a page.

By setting the Frontmatter for `resources` and `tags` you can control what is populated
in this component. Please review the [Style Guide](STYLE_GUIDE.md) for further details
on these slugs.

### Maximum references

This component allows a maximum of 5 resources.

### Resource population logic

If no resources or tags are available in the page Frontmatter the component will fallback
to using the page title as the search query term but you will
always have 5 results, assuming Swiftype can return 5 results for that query.

### Order of priority

The order of priority for populating content in this component is driven by:

1. Any resources defined in the page Frontmatter.
2. Any tags defined in the the page Frontmatter will send a search query term and return results from Swiftype.
2b. Any Swifttype results that match the page title.

### Resource site tags

Resource site tags control the labels that appears below each resource URL. These
can be found in the [Resources.js](./src/components/RelatedContentModules/Resources.js).
If you are adding a resource that doesn't currently have a defined site tag, you will need to
modify this file an add a new site tag accordingly.

When naming the site tag the site domain name should be used for the site tag name.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ you can use the Github `Edit This File` button to submit a change.

### Cloning vs Forking

To be able to [Clone](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) this repository and contribute you will need to be given write access to the repository. This is reserved for New Relic Employees only. Contact the Developer Experience Team if you need write access.
To be able to [Clone](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository) this repository and contribute you will need to be given write access to the repository. This is reserved for New Relic Employees only. Contact the Developer Experience team (developer-website-content Slack channel) if you need write access.

As a non New Relic employee you can [Fork](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) the repository and contribute as needed.

Expand All @@ -81,7 +81,7 @@ As a non New Relic employee you can [Fork](https://help.github.com/en/github/get
### Submitting a PR from a cloned repo

0. Create a [Github](https://github.com/) account if you don't already have one.
1. `Clone` this this repository.
1. `Clone` this repository.
2. Create a new branch locally.
3. Make your changes.
4. Test your changes! Review the project's [READ ME](README.md) for instructions on how to build and run tests locally.
Expand Down Expand Up @@ -199,7 +199,7 @@ When a new guide is added or an existing guide path frontmatter slug is changed

1. Make your guide change and submit a PR.
2. Within that PR also make the navigation change.
3. In order to change navigation you will need to update the [sidenav.json](../src/data/sidenav.json) file.
3. In order to change navigation you will need to update the [sidenav.json](/src/data/sidenav.json) file.
4. Given the side navigation file is JSON, be sure to close all `[ ]` and `{ }` and use trailing `,` correctly.
5. Navigation `displayName` should always be sentence case.
6. Submit your PR and add the `navigation` label.
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

# developer.newrelic.com

[View known vulnerabilities](https://snyk.io/test/github/newrelic/developer-website)

## 🚀 Local development

Navigate into your new site’s directory and start it up.
You can serve this site locally to quickly see your changes and additions before you PR them. To get started, navigate into your new site’s directory and start it up, as follows.

```shell
cd developer-website/
Expand All @@ -27,8 +29,8 @@ have the tests automatically re-run, use `npm run test:watch`.

New Relic hosts and moderates an online forum where customers can interact with
New Relic employees as well as other customers to get help and share best practices.
If you are looking for configuration help or more information about New Relic's
products please visit the [New Relic Explorers Hub](https://discuss.newrelic.com/)
If you're looking for configuration help or more information about New Relic's
products, please visit the [New Relic Explorers Hub](https://discuss.newrelic.com/).

Like all official New Relic open source projects, there's a related
[Community topic](https://discuss.newrelic.com/t/developer-newrelic-com/108069)
Expand Down
18 changes: 18 additions & 0 deletions STYLE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ The value that is assigned to the key slug is used in order to navigate to your
- `redirects`:
- url you wish to redirect from
- another url you wish to redirect from
- `resources`:
- `title`: title of related resource. This resource will show up in the "Resources" section to the right of the main content.
- `url`: URL of related resource. Can be absolute or relative.
- `tags`: sets the search parameters you wish to pass to Swiftype.
- tag name1
- tag name2
- tag name3

### GuideTemplate Frontmatter example

Expand All @@ -306,6 +313,17 @@ tileShorthand:
redirects:
- /build-tools/new-relic-one-applications/intro-to-sdk
- /client-side-sdk/index.html
resources:
- title: Introduction to New Relic NerdGraph
url: https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph
- title: Deploy an app
url: /build-apps/publish-deploy
tags:
- Agent API
- Telemetry SDK
- Trace API
- Metric API
- Event API
---
```

Expand Down
2 changes: 1 addition & 1 deletion amplify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ frontend:
build:
commands:
- |
if [ "${AWS_BRANCH}" = "master" ]; then
if [ "${AWS_BRANCH}" = "main" ]; then
npm run build:production;
else
npm run build:staging;
Expand Down
24 changes: 21 additions & 3 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import wrapPageElement from './gatsby/wrap-page-element';

export { wrapPageElement };

const onInitialClientRender = () => {
function destyleMktoForm(mktoForm, options) {
const formEl = mktoForm.getFormElem()[0];
Expand Down Expand Up @@ -49,4 +47,24 @@ const onInitialClientRender = () => {
});
};

export { onInitialClientRender };
const onRouteUpdate = ({ location }) => {
if (process.env.NODE_ENV !== `production` || typeof ga !== `function`) {
return null;
}

// wrap inside a timeout to make sure react-helmet is done with it's changes (https://github.com/gatsbyjs/gatsby/issues/9139)
// reactHelmet is using requestAnimationFrame: https://github.com/nfl/react-helmet/blob/5.2.0/src/HelmetUtils.js#L296-L299
const sendPageView = () => {
const pagePath = location
? location.pathname + location.search + location.hash
: undefined;
window.ga(`set`, `page`, pagePath);
window.ga(`send`, `pageview`);
};

// Minimum delay for reactHelmet's requestAnimationFrame
setTimeout(sendPageView, 32);

return null;
};
export { onRouteUpdate, wrapPageElement, onInitialClientRender };
Loading

0 comments on commit e2c0edf

Please sign in to comment.