You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
487 B
19 lines
487 B
7 years ago
|
const request = require('request-promise');
|
||
|
|
||
|
const errorCodesUrl = 'http://raw.githubusercontent.com/facebook/react/master/scripts/error-codes/codes.json';
|
||
|
|
||
|
exports.sourceNodes = async ({ boundActionCreators }) => {
|
||
|
const { createNode } = boundActionCreators;
|
||
|
|
||
|
const jsonString = await request(errorCodesUrl);
|
||
|
|
||
|
createNode({
|
||
|
id: 'error-codes',
|
||
|
children: [],
|
||
|
parent: 'ERRORS',
|
||
|
internal: {
|
||
|
type: 'ErrorCodesJson',
|
||
|
contentDigest: jsonString,
|
||
|
},
|
||
|
});
|
||
|
};
|