2020-07-30 20:33:51 +02:00
|
|
|
const path = require('path')
|
2020-07-17 14:59:20 +02:00
|
|
|
const createFields = require('./gatsby/createFields')
|
|
|
|
const createMarkdownPages = require('./gatsby/createMarkdownPages')
|
2020-11-09 14:31:04 +01:00
|
|
|
const execSync = require('child_process').execSync
|
|
|
|
|
|
|
|
// Write out repo metadata
|
2021-01-21 16:02:48 +01:00
|
|
|
execSync(`node ./scripts/write-repo-metadata > repo-metadata.json`, {
|
|
|
|
stdio: 'inherit'
|
|
|
|
})
|
|
|
|
|
|
|
|
// Generate Apollo typings
|
|
|
|
execSync(`npm run apollo:codegen`, { stdio: 'inherit' })
|
2020-07-17 14:59:20 +02:00
|
|
|
|
2021-03-04 18:16:20 +01:00
|
|
|
// Fetch EVM networks metadata
|
|
|
|
execSync(
|
|
|
|
`node ./scripts/write-networks-metadata > content/networks-metadata.json`,
|
|
|
|
{
|
|
|
|
stdio: 'inherit'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2020-07-17 14:59:20 +02:00
|
|
|
exports.onCreateNode = ({ node, actions, getNode }) => {
|
|
|
|
createFields(node, actions, getNode)
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.createPages = async ({ graphql, actions }) => {
|
|
|
|
await createMarkdownPages(graphql, actions)
|
2020-06-30 13:32:16 +02:00
|
|
|
}
|
2020-07-01 17:11:45 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
exports.onCreatePage = async ({ page, actions }) => {
|
|
|
|
const { createPage } = actions
|
|
|
|
// page.matchPath is a special key that's used for matching pages
|
|
|
|
// only on the client.
|
|
|
|
const handleClientSideOnly = page.path.match(/^\/asset/)
|
2020-07-06 12:49:30 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
if (handleClientSideOnly) {
|
|
|
|
page.matchPath = '/asset/*'
|
2020-07-06 12:49:30 +02:00
|
|
|
|
2020-07-07 10:26:38 +02:00
|
|
|
// Update the page.
|
|
|
|
createPage(page)
|
|
|
|
}
|
|
|
|
}
|
2020-07-17 14:59:20 +02:00
|
|
|
|
|
|
|
exports.onCreateWebpackConfig = ({ actions }) => {
|
|
|
|
actions.setWebpackConfig({
|
|
|
|
node: {
|
|
|
|
// 'fs' fix for squid.js
|
|
|
|
fs: 'empty'
|
|
|
|
},
|
|
|
|
// fix for 'got'/'swarm-js' dependency
|
2020-07-30 20:33:51 +02:00
|
|
|
externals: ['got'],
|
|
|
|
|
|
|
|
// fix for being able to use `npm link` with @oceanprotocol/react
|
|
|
|
// see https://github.com/facebook/react/issues/13991
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
react: path.resolve('./node_modules/react')
|
|
|
|
}
|
|
|
|
}
|
2020-07-17 14:59:20 +02:00
|
|
|
})
|
|
|
|
}
|