How to use the gatsby-cli/lib/reporter.warn function in gatsby-cli

To help you get started, we’ve selected a few gatsby-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taessina / gatsby-source-firestore / gatsby-node.js View on Github external
exports.sourceNodes = async (
  { boundActionCreators },
  { types, credential, appConfig }
) => {
  try {
    if (firebase.apps || !firebase.apps.length) {
      const cfg = appConfig ? appConfig : {credential: firebase.credential.cert(credential)}
      firebase.initializeApp(cfg);
    }
  } catch (e) {
    report.warn(
      'Could not initialize Firebase. Please check `credential` property in gatsby-config.js'
    );
    report.warn(e);
    return;
  }
  const db = firebase.firestore();
  db.settings({
    timestampsInSnapshots: true,
  });

  const { createNode } = boundActionCreators;

  const promises = types.map(
    async ({ collection, type, map = node => node }) => {
      const snapshot = await db.collection(collection).get();
      for (let doc of snapshot.docs) {
github taessina / gatsby-source-firestore / gatsby-node.js View on Github external
exports.sourceNodes = async (
  { boundActionCreators },
  { types, credential, appConfig }
) => {
  try {
    if (firebase.apps || !firebase.apps.length) {
      const cfg = appConfig ? appConfig : {credential: firebase.credential.cert(credential)}
      firebase.initializeApp(cfg);
    }
  } catch (e) {
    report.warn(
      'Could not initialize Firebase. Please check `credential` property in gatsby-config.js'
    );
    report.warn(e);
    return;
  }
  const db = firebase.firestore();
  db.settings({
    timestampsInSnapshots: true,
  });

  const { createNode } = boundActionCreators;

  const promises = types.map(
    async ({ collection, type, map = node => node }) => {
      const snapshot = await db.collection(collection).get();
      for (let doc of snapshot.docs) {
        const contentDigest = getDigest(doc.id);
        createNode(
          Object.assign({}, map(doc.data()), {