Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Add comments to explain copy files process
Browse files Browse the repository at this point in the history
  • Loading branch information
igorbrasileiro committed Jan 3, 2022
1 parent 4097aa1 commit 2819b02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ exports.onCreateWebpackConfig = ({ actions: { setWebpackConfig }, stage }) => {
})
}

// Copy @builder.io/partytown lib files to the <rootPath>/static/~partytown wheen gatsby stage is develop.
// Those files are used by the Partytown component.
if (stage === 'develop') {
copyPartytown()
}
Expand Down Expand Up @@ -50,6 +52,10 @@ const copyRecursiveSync = (src, dest) => {
}
}

/**
* Copy @builder.io/partytown/lib to <rootPath>/static/\~partytown.
* If folder static/\~partytown doesn't exist, it will be created.
*/
const copyPartytown = () => {
copyRecursiveSync(
path.join(__dirname, 'node_modules/@builder.io/partytown/lib'),
Expand All @@ -59,5 +65,8 @@ const copyPartytown = () => {

exports.onPreBuild = ({ reporter }) => {
reporter.info('Copying Partytown Files')

// Copy @builder.io/partytown lib files to the <rootPath>/static/~partytown.
// Those files are used by the Partytown component.
copyPartytown()
}
4 changes: 3 additions & 1 deletion gatsby-ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export const onRenderBody = ({ setHeadComponents }) => {
])
} else if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line
console.log('Add the gtmContainerId on storeConfig file')
console.log(
'gtmContainerId is not set. Google Tag Manager will not work until you provide a valid container id.'
)
}
}

0 comments on commit 2819b02

Please sign in to comment.