mirror of
https://github.com/oceanprotocol/market.git
synced 2024-06-29 00:57:50 +02:00
74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
const createMarkdownFields = require('./gatsby/createMarkdownFields')
|
|
const createMarkdownPages = require('./gatsby/createMarkdownPages')
|
|
const createTypes = require('./gatsby/createTypes')
|
|
const execSync = require('child_process').execSync
|
|
const path = require('path')
|
|
|
|
// Write out repo metadata
|
|
execSync(`node ./scripts/write-repo-metadata > repo-metadata.json`, {
|
|
stdio: 'inherit'
|
|
})
|
|
|
|
// Generate GraphQL typings for urql
|
|
// execSync(`npm run graphql:graphTypes`, { stdio: 'inherit' })
|
|
|
|
// Generate Apollo typings
|
|
execSync(`npm run apollo:codegen`, { stdio: 'inherit' })
|
|
|
|
// Fetch EVM networks metadata
|
|
execSync(
|
|
`node ./scripts/write-networks-metadata > content/networks-metadata.json`,
|
|
{
|
|
stdio: 'inherit'
|
|
}
|
|
)
|
|
|
|
exports.sourceNodes = ({ actions }) => {
|
|
createTypes(actions)
|
|
}
|
|
|
|
exports.onCreateNode = ({ node, actions, getNode }) => {
|
|
createMarkdownFields(node, actions, getNode)
|
|
}
|
|
|
|
exports.createPages = async ({ graphql, actions }) => {
|
|
await createMarkdownPages(graphql, actions)
|
|
}
|
|
|
|
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 handleClientSideOnlyAsset = page.path.match(/^\/asset/)
|
|
const handleClientSideOnlyAccount = page.path.match(/^\/profile/)
|
|
|
|
if (handleClientSideOnlyAsset) {
|
|
page.matchPath = '/asset/*'
|
|
// Update the page.
|
|
createPage(page)
|
|
} else if (handleClientSideOnlyAccount) {
|
|
page.matchPath = '/profile/*'
|
|
createPage(page)
|
|
}
|
|
}
|
|
|
|
exports.onCreateWebpackConfig = ({ actions }) => {
|
|
actions.setWebpackConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@shared': path.resolve(__dirname, 'src/components/@shared'),
|
|
'@hooks': path.resolve(__dirname, 'src/@hooks'),
|
|
'@context': path.resolve(__dirname, 'src/@context'),
|
|
'@images': path.resolve(__dirname, 'src/@images'),
|
|
'@utils': path.resolve(__dirname, 'src/@utils')
|
|
}
|
|
},
|
|
node: {
|
|
// 'fs' fix for ocean.js
|
|
fs: 'empty'
|
|
},
|
|
// fix for 'got'/'swarm-js' dependency
|
|
externals: ['got']
|
|
})
|
|
}
|