Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make gatsby-remark-source-name compatible with gatsby v3 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Boelensman1
Copy link

Gatsby v3 has some breaking changes, this makes it work again.

I also bumped the version number as this would probably be a breaking change for gatsby-remark-source-name itself.

Signed-off-by: Boelensman1 <me@wiggerboelens.com>
Signed-off-by: Boelensman1 <me@wiggerboelens.com>
@AnnieTaylorCHEN
Copy link

Yeah I did that for my local repo but Netlify won't build properly unless we update this. Look forward to the update soon!

@raravi
Copy link

raravi commented May 8, 2021

It would be awesome if this could be merged soon! One of my gatsby projects depends on this package, and its currently blocked from upgrading to Gatsby v3 due to this!!

I realised that its just a single file! I implemented it directly in my gatsby-node.js file.. :)

@AnnieTaylorCHEN
Copy link

It would be awesome if this could be merged soon! One of my gatsby projects depends on this package, and its currently blocked from upgrading to Gatsby v3 due to this!!

I realised that its just a single file! I implemented it directly in my gatsby-node.js file.. :)

Yes you can do that locally. However for deployment you might need to fork the project, change that line in package.json and point it to your forked and changed repo for the moment before this library finally updates. You might need to run a build on that one so it will be pulled correctly. I had to do that otherwise Netlify will have deployment error.

@raravi
Copy link

raravi commented May 8, 2021

Oops, my bad. I meant you wouldn't even need this package.

In the gatsby-node.js file for your project, you can add the below code in exports.onCreateNode function directly:

const fileNode = getNode(node.parent);
    createNodeField({
      node,
      name: 'sourceName',
      value: fileNode.sourceInstanceName,
    });

@AnnieTaylorCHEN
Copy link

Oops, my bad. I meant you wouldn't even need this package.

In the gatsby-node.js file for your project, you can add the below code in exports.onCreateNode function directly:

const fileNode = getNode(node.parent);
    createNodeField({
      node,
      name: 'sourceName',
      value: fileNode.sourceInstanceName,
    });

Jaha, this is even simpler!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants