Skip to content

Commit

Permalink
Merge branch 'develop' into prometheus-rw-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Jcazub committed Oct 25, 2021
2 parents 63d1617 + 1aed819 commit 947322a
Show file tree
Hide file tree
Showing 1,846 changed files with 15,963 additions and 15,717 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Auto Comment
on: [issues, pull_request_target]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: wow-actions/auto-comment@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pullRequestOpened: |
Hi @{{ author }} 👋
Thanks for your pull request! Your PR is in a queue, and a writer will take a look soon. We generally publish small edits within one business day, and larger edits within three days.
issuesOpened: |
Hi @{{ author }} 👋
Thank you for filing an issue! We'll triage your issue and let you know if we have questions, and then route it to the appropriate team so we can get it solved.
2 changes: 1 addition & 1 deletion .github/workflows/fetch-swiftype-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16

- name: Cache dependencies
id: yarn-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-whats-new-ids.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 16

- name: Install dependencies
run: yarn add vfile-glob@1.0.0 to-vfile@6.1.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16

- name: Cache dependencies
id: yarn-cache
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16

- name: Cache dependencies
id: yarn-cache
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16

- name: Cache dependencies
id: yarn-cache
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12
16
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The first time you build the site locally, it will take upwards of 20 minutes. T

### Dependencies

Node v12 is used in this project as specified in [.nvmrc](https://github.com/newrelic/developer-website/blob/master/.nvmrc).
Node v16 is used in this project as specified in [.nvmrc](https://github.com/newrelic/developer-website/blob/master/.nvmrc).

### Unit tests

Expand All @@ -72,7 +72,7 @@ have the tests automatically re-run, use `yarn run test:watch`
### Using multiple versions of Node

If you intend to run multiple versions of Node please be aware that the New Relic
Docs Site is currently on Node v12. Therefore it's recommended you use Node Version Manager [NVM](https://github.com/nvm-sh/nvm) to manage Node versions.
Docs Site is currently on Node v16. Therefore it's recommended you use Node Version Manager [NVM](https://github.com/nvm-sh/nvm) to manage Node versions.

Review [this article](https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b)
which clearly explains the setup and configuration of NVM.
Expand Down
2 changes: 0 additions & 2 deletions codemods/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const landingPageHero = require('./landingPageHero');
const collapseLandingPageTileGrids = require('./collapseLandingPageTileGrids');
const landingPageButtonType = require('./landingPageButtonType');
const tocLinks = require('./tocLinks');
const watermarks = require('./watermarks');
const browserLandingPageBlockquote = require('./browserLandingPageBlockquote');
const techTiles = require('./techTile');

Expand All @@ -37,7 +36,6 @@ module.exports = [
collapseLandingPageTileGrids,
landingPageButtonType,
tocLinks,
watermarks,
landingPageHero,
techTiles,
require('./imageSizing'),
Expand Down
42 changes: 0 additions & 42 deletions codemods/watermarks.js

This file was deleted.

18 changes: 10 additions & 8 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const fs = require('fs');
const parse = require('rehype-parse');
const path = require('path');
const parse = require('rehype-parse');
const unified = require('unified');
const rehypeStringify = require('rehype-stringify');
const addAbsoluteImagePath = require('./rehype-plugins/utils/addAbsoluteImagePath');
Expand Down Expand Up @@ -146,7 +146,7 @@ module.exports = {
`docs${postfix}`,
`developer${postfix}`,
`opensource${postfix}`,
`quick_starts${postfix}`,
`quickstarts${postfix}`,
],
document_type: [
'!views_page_menu',
Expand All @@ -163,13 +163,13 @@ module.exports = {
configs: {
development: {
instrumentationType: 'proAndSPA',
accountId: '10175106',
accountId: '10956800',
trustKey: '1',
agentID: '23865145',
licenseKey: '528f970912',
applicationID: '23865145',
beacon: 'staging-bam.nr-data.net',
errorBeacon: 'staging-bam.nr-data.net',
agentID: '35094418',
licenseKey: 'NRJS-649173eb1a7b28cd6ab',
applicationID: '35094418',
beacon: 'staging-bam-cell.nr-data.net',
errorBeacon: 'staging-bam-cell.nr-data.net',
},
production: {
instrumentationType: 'proAndSPA',
Expand Down Expand Up @@ -377,6 +377,7 @@ module.exports = {
getStartedLink
learnMoreLink
summary
isFeatured
}
fields {
slug
Expand Down Expand Up @@ -410,6 +411,7 @@ module.exports = {
getStartedLink: frontmatter.getStartedLink,
body: htmlParser.stringify(parsedHtml),
docUrl: new URL(fields.slug, siteUrl).href,
isFeatured: frontmatter.isFeatured,
};
}
),
Expand Down
23 changes: 22 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
filter: { fileAbsolutePath: { regex: "/src/content/whats-new/" } }
) {
nodes {
frontmatter {
isFeatured
}
fields {
slug
}
Expand Down Expand Up @@ -263,9 +266,14 @@ exports.createPages = async ({ actions, graphql, reporter }) => {

whatsNewPosts.nodes.forEach((node) => {
const {
frontmatter: { isFeatured },
fields: { slug },
} = node;

if (!isFeatured) {
node.frontmatter.isFeatured = false;
}

createLocalizedRedirect({
locales,
fromPath: slug.replace(/\/\d{4}\/\d{2}/, ''),
Expand Down Expand Up @@ -293,6 +301,19 @@ exports.createSchemaCustomization = ({ actions }) => {
createTypes(typeDefs);
};

exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions;
const typeDefs = `
type MarkdownRemark implements Node {
frontmatter: Frontmatter
}
type Frontmatter {
isFeatured: Boolean
}
`;
createTypes(typeDefs);
};

exports.createResolvers = ({ createResolvers }) => {
createResolvers({
NavYaml: {
Expand All @@ -307,7 +328,7 @@ exports.createResolvers = ({ createResolvers }) => {
},
rootNav: {
resolve: (source) =>
hasOwnProperty(source, 'rootNav') ? source.rootNav : true,
hasOwnProperty(source, 'rootNav') ? source.rootNav : false,
},
},
});
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@github-docs/frontmatter": "^1.3.1",
"@mdx-js/mdx": "^2.0.0-next.8",
"@mdx-js/react": "^2.0.0-next.8",
"@newrelic/gatsby-theme-newrelic": "^3.1.2",
"@newrelic/gatsby-theme-newrelic": "^3.3.0",
"@splitsoftware/splitio-react": "^1.2.4",
"babel-jest": "^26.3.0",
"common-tags": "^1.8.0",
Expand Down Expand Up @@ -132,15 +132,15 @@
"license": "Apache-2",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"develop": "GATSBY_NEWRELIC_ENV=development gatsby develop",
"reboot": "rm -rf node_modules && yarn && yarn clean && yarn start",
"build:production": "GATSBY_NEWRELIC_ENV=production yarn run build",
"build:staging": "GATSBY_NEWRELIC_ENV=staging yarn run build",
"generate-whatsnew-ids": "node scripts/actions/generate-whats-new-ids.js",
"fetch-related-content": "node scripts/actions/get-related-resources.js",
"debug": "yarn develop --inspect-brk",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "yarn develop",
"start": "GATSBY_NEWRELIC_ENV=development yarn develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "jest -i",
Expand Down
46 changes: 14 additions & 32 deletions plugins/gatsby-source-nav/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,22 @@ exports.onCreatePage = ({ page, actions }) => {
}
};

const createRootNav = async ({ createNodeId, nodeModel }) => {
const nav = await nodeModel.runQuery({
type: 'NavYaml',
query: {
filter: {
rootNav: { eq: true },
},
sort: {
fields: ['title'],
order: ['ASC'],
},
},
});
const createRootNav = async ({ args, createNodeId, nodeModel }) => {
const { slug } = args;

const rootNavYamlNode = nodeModel
.getAllNodes({ type: 'NavYaml' })
.filter((node) => node.rootNav);

const nav = rootNavYamlNode.find((nav) => findPage(nav, slug));

if (!nav) {
return null;
}

return {
...nav,
id: createNodeId('root'),
pages: nav.map((item) => ({ ...item, pages: [] })),
};
};

Expand Down Expand Up @@ -257,26 +256,9 @@ const createNav = async ({ args, createNodeId, nodeModel, locales }) => {
.replace(/\/table-of-contents$/, '')
.replace(new RegExp(`^\\/(${locales.join('|')})(?=\\/)`), '');

const fileNode = await nodeModel.runQuery({
type: 'File',
query: {
filter: {
sourceInstanceName: { eq: 'markdown-pages' },
relativePath: { regex: '/docs/' },
childMdx: {
fields: {
slug: {
eq: slug,
},
},
},
},
firstOnly: true,
},
});

const allNavYamlNodes = nodeModel
.getAllNodes({ type: 'NavYaml' })
.filter((node) => !node.rootNav)
.sort((a, b) => a.title.localeCompare(b.title));

let nav =
Expand Down
8 changes: 7 additions & 1 deletion scripts/actions/generate-whats-new-ids.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ const generateWhatsNewIds = async () => {
);

return new Promise((resolve) => {
const currentWhatsNewPaths = [];
vfileGlob('./src/content/whats-new/**/*.md').subscribe({
next: (file) => {
const slug = file.path
.replace(/.*?src\/content/, '')
.replace('.md', '');

currentWhatsNewPaths.push(slug);
if (!data[slug]) {
data[slug] = String(++largestID);
}
},
complete: async () => {
Object.entries(data).forEach(([path]) => {
if (!currentWhatsNewPaths.includes(path)) {
delete data[path];
}
});
file.contents = JSON.stringify(data, null, 2);

await write(file, 'utf-8');
Expand Down
1 change: 0 additions & 1 deletion scripts/utils/migrate/html-to-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const SPECIAL_COMPONENTS = [
{ tag: 'div', className: 'callout-pricing' },
{ tag: 'dl', className: 'clamshell-list' },
{ tag: 'dl', className: 'example-box' },
{ id: 'watermark' },
];

const escapes = [
Expand Down

0 comments on commit 947322a

Please sign in to comment.