Permalink
Cannot retrieve contributors at this time
79 lines (68 sloc)
1.98 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Ocean-Market/gatsby-node.js /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createFields = require('./gatsby/createFields') | |
| const createMarkdownPages = require('./gatsby/createMarkdownPages') | |
| const execSync = require('child_process').execSync | |
| // 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' | |
| } | |
| ) | |
| //Extend ContentJson to support optional field "optionalCookies" in gdpr.json | |
| //Extend PublishJsonData to support optional fields for disclaimers | |
| exports.sourceNodes = ({ actions }) => { | |
| const { createTypes } = actions | |
| const typeDefs = ` | |
| type ContentJson implements Node { | |
| accept: String | |
| reject: String | |
| close: String | |
| optionalCookies: [Cookie!] | |
| } | |
| type Cookie { | |
| title: String! | |
| desc: String! | |
| cookieName: String! | |
| } | |
| type PublishJsonData implements Node { | |
| disclaimer: String | |
| disclaimerValues: [String!] | |
| } | |
| ` | |
| createTypes(typeDefs) | |
| } | |
| exports.onCreateNode = ({ node, actions, getNode }) => { | |
| createFields(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 handleClientSideOnly = page.path.match(/^\/asset/) | |
| if (handleClientSideOnly) { | |
| page.matchPath = '/asset/*' | |
| // Update the page. | |
| createPage(page) | |
| } | |
| } | |
| exports.onCreateWebpackConfig = ({ actions }) => { | |
| actions.setWebpackConfig({ | |
| node: { | |
| // 'fs' fix for ocean.js | |
| fs: 'empty' | |
| }, | |
| // fix for 'got'/'swarm-js' dependency | |
| externals: ['got'] | |
| }) | |
| } |