Skip to content

Commit

Permalink
chore: merge 'develop' into translations-8c086c3
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonlightKomorebi committed Nov 1, 2021
2 parents 8c086c3 + 00d1dc4 commit f1b1ada
Show file tree
Hide file tree
Showing 1,888 changed files with 13,429 additions and 17,767 deletions.
1 change: 1 addition & 0 deletions .github/workflows/auto-comment.yml
Expand Up @@ -10,6 +10,7 @@ jobs:
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.
Gatsby Cloud will automatically generate a preview of your request, and will comment with a link when the preview is ready (usually 20 to 30 minutes).
issuesOpened: |
Hi @{{ author }} 👋
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fetch-swiftype-content.yml
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
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
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
@@ -1 +1 @@
12
16
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
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
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
@@ -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
14 changes: 13 additions & 1 deletion gatsby-node.js
Expand Up @@ -288,6 +288,12 @@ exports.createSchemaCustomization = ({ actions }) => {
pages: [NavYaml!]!
rootNav: Boolean!
}
type MarkdownRemark implements Node {
frontmatter: Frontmatter
}
type Frontmatter {
isFeatured: Boolean
}
`;

createTypes(typeDefs);
Expand All @@ -307,7 +313,13 @@ exports.createResolvers = ({ createResolvers }) => {
},
rootNav: {
resolve: (source) =>
hasOwnProperty(source, 'rootNav') ? source.rootNav : true,
hasOwnProperty(source, 'rootNav') ? source.rootNav : false,
},
},
Frontmatter: {
isFeatured: {
resolve: (source) =>
hasOwnProperty(source, 'isFeatured') ? source.isFeatured : false,
},
},
});
Expand Down
8 changes: 4 additions & 4 deletions package.json
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.3",
"@newrelic/gatsby-theme-newrelic": "^3.3.0",
"@splitsoftware/splitio-react": "^1.2.4",
"babel-jest": "^26.3.0",
"common-tags": "^1.8.0",
Expand All @@ -24,7 +24,7 @@
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-offline": "^4.8.0",
"gatsby-plugin-react-helmet": "^4.8.0",
"gatsby-plugin-sharp": "^3.8.0",
"gatsby-plugin-sharp": "^3.14.1",
"gatsby-remark-autolink-headers": "^4.5.0",
"gatsby-remark-copy-linked-files": "^4.5.0",
"gatsby-remark-images": "^5.5.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
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
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
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 f1b1ada

Please sign in to comment.