Skip to content

Commit

Permalink
chore: Add logic to conditionally build doc folders
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBaker committed Jul 13, 2022
1 parent c2f437d commit 94a0316
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ const getAgentName = require('./src/utils/getAgentName');
const dataDictionaryPath = `${__dirname}/src/data-dictionary`;
const siteUrl = 'https://docs.newrelic.com';
const additionalLocales = ['jp', 'kr'];
const allFolders = fs
.readdirSync(`${__dirname}/src/content/docs`)
.filter((folder) => !folder.startsWith('.'));
const doNotIgnoreFolders =
process.env.BUILD_FOLDERS && process.env.BUILD_FOLDERS.split(',');
const ignoreFolders = process.env.BUILD_FOLDERS
? allFolders
.filter(
(folder) =>
!doNotIgnoreFolders.includes(folder) && folder !== 'release-notes'
)
.map((folder) => `${__dirname}/src/content/docs/${folder}/*`)
: [];

const autoLinkHeaders = {
resolve: 'gatsby-remark-autolink-headers',
Expand Down Expand Up @@ -193,6 +206,7 @@ module.exports = {
options: {
name: 'markdown-pages',
path: `${__dirname}/src/content`,
ignore: ignoreFolders,
},
},
{
Expand All @@ -207,13 +221,21 @@ module.exports = {
options: {
name: 'translated-content',
path: `${__dirname}/src/i18n/content`,
ignore:
process.env.BUILD_I18N === 'false'
? [`${__dirname}/src/i18n/content/*`]
: [],
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'translated-nav',
path: `${__dirname}/src/i18n/nav`,
ignore:
process.env.BUILD_I18N === 'false'
? [`${__dirname}/src/i18n/nav/*`]
: [],
},
},
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@
"validate-datasources": "node scripts/actions/check-datasource-ids.js",
"debug": "yarn develop --inspect-brk",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "GATSBY_NEWRELIC_ENV=development yarn develop",
"start": "GATSBY_NEWRELIC_ENV=development BUILD_I18N=false yarn develop",
"start:full": "GATSBY_NEWRELIC_ENV=development BUILD_I18N=true yarn develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "jest -i",
Expand Down

0 comments on commit 94a0316

Please sign in to comment.