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

feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files. #8016

Merged
merged 3 commits into from
Sep 11, 2018
Merged

feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files. #8016

merged 3 commits into from
Sep 11, 2018

Conversation

Mike-Dax
Copy link
Contributor

One of my clients uses a markdown editor that saves .~<filename> temporary files in an auto-save context. These get eaten up by the gatsby-source-filesystem plugin and can cause issues.

This PR allows for an ignore array in the options to specify more regex's to ignore.

    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/packages/pages`,
        name: 'pages',
        ignore: [`**/\.*`],
      },
    },

I would argue that adding **/\.* to the default list of ignores (ignore dot files) would be a sane default, but that might be considered a breaking change?

I can amend this PR with that change / make a second PR if desired.

@Mike-Dax Mike-Dax changed the title Added an 'ignore' property to the options to ignore more files. feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files. Sep 10, 2018
@nihgwu
Copy link
Contributor

nihgwu commented Sep 10, 2018

You are the man! #8017

@nihgwu
Copy link
Contributor

nihgwu commented Sep 10, 2018

please add doc for the new option

@Mike-Dax
Copy link
Contributor Author

@nihgwu Heh, that's a funny coincidence.

I wrote a small note in the README.md of gatsby-source-filesystem. Happy to write more docs if I can be pointed to where they should go.

@nihgwu
Copy link
Contributor

nihgwu commented Sep 10, 2018

add an extra Options section to the readme like the other plugins, including the existing name, path, also it's better to list the default ignored too

@pieh
Copy link
Contributor

pieh commented Sep 10, 2018

Very nitpicky - could you update list of default ignored stuff ( it was changed very recently in #8017 )

---edit
already done

@pieh
Copy link
Contributor

pieh commented Sep 11, 2018

Travis has some problems with reporting status but tests passed - https://travis-ci.org/gatsbyjs/gatsby/builds/426692369 so I'm going to merge that in

Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Mike-Dax!

@pieh pieh merged commit 3f67a2f into gatsbyjs:master Sep 11, 2018
@Mike-Dax
Copy link
Contributor Author

@pieh Do you think that all dot files should be ignored by default? If so I'll create a second PR.

@KyleAMathews
Copy link
Contributor

Any reason to ignore all dot files?

@Mike-Dax
Copy link
Contributor Author

@KyleAMathews I would think it would be unlikely that someone intended for dot files to produce content. Unfortunately chokidar doesn't seem to have any method for whitelisting files explicitly if that is the intention and 'no dot files' is the default.

Some editors unfortunately pollute the file system with autosave files with a dot prefix, if they're pages with page queries that can cause this error:

GraphQL Error There was an error while compiling your site's GraphQL queries.
  Invariant Violation: GraphQLCompilerContext: Duplicate document named `ReleaseIndexQuery`. GraphQL fragments and roots must have unique names.
    t: Duplicate document named `ReleaseIndexQuery`. GraphQL fragments and roots must have unique names.

mwfrost pushed a commit to mwfrost/gatsby that referenced this pull request Apr 20, 2023
…ions to ignore more files. (gatsbyjs#8016)

* feat(gatsby-source-filesystem): Added an 'ignore' property to the options to ignore more files.

* docs(gatsby-source-filesystem): Added an options section to the README and fixed an error in the example.

* update default list
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.

None yet

4 participants