1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +01:00
market/gatsby-node.js

53 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-07-17 14:59:20 +02:00
const createFields = require('./gatsby/createFields')
const createMarkdownPages = require('./gatsby/createMarkdownPages')
const execSync = require('child_process').execSync
// Write out repo metadata
Pool statistics from the graph (#288) * graphql Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * ignore generated Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * delete generated Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix travis Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix travis Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix fetch Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix travis Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix fetch Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * update readme Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * pool creator liquidit& statistics Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * graph with the graph Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * cleanup Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix query Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * update poll interval Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * update graph url Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * ocean bump Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * run apollo codegen before starting gatsby * put back graph loading state * typing fix * graph tweak, add error state * readme update * remove unused functions, move graph provider Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix package-lock * fix graph when switching tabs * generate apollo files into one folder * fix loading Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * fix codegen camelcase Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * bump apollo packages * document subgraph usage, add example * rewrite into Data Sources, add quick examples * more data sources docs * docs updates, typos Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
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
// 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-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-07 10:26:38 +02:00
if (handleClientSideOnly) {
page.matchPath = '/asset/*'
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: {
2021-05-20 00:44:22 +02:00
// 'fs' fix for ocean.js
2020-07-17 14:59:20 +02:00
fs: 'empty'
},
// fix for 'got'/'swarm-js' dependency
externals: ['got']
2020-07-17 14:59:20 +02:00
})
}