Skip to content

Exclude node_modules from copying and page rendering in default site.json#1925

Merged
jonahtanjz merged 2 commits into
MarkBind:masterfrom
tlylt:exclude-node-modules
May 7, 2022
Merged

Exclude node_modules from copying and page rendering in default site.json#1925
jonahtanjz merged 2 commits into
MarkBind:masterfrom
tlylt:exclude-node-modules

Conversation

@tlylt

@tlylt tlylt commented May 6, 2022

Copy link
Copy Markdown
Contributor

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • Others, please explain:

Overview of changes:
Fixes #1844

  • exclude node_modules from page rendering as the default pages include a glob of
	{
      "glob": ["**/index.md", "**/*.md"]
    }
  • the above does not play nice if MarkBind is installed locally, or if there are any other node_modules (because most of them include README.md), which will have to be excluded explicitly.

Anything you'd like to highlight / discuss:
nil

Testing instructions:

  1. Check out this PR
  2. Run markbind init
  3. Verify the site.json
  4. Install a node_module by doing something like npm init -y and then npm install happy-birthday
  5. Run markbind serve or markbind build
  6. Verify that the node_modules are not copied over to _site and things are rendered properly

Proposed commit message: (wrap lines at 72 characters)
Exclude node_modules from page rendering in default site.json

If there are node modules installed along with MarkBind, the
README.md files within these folders will be processed due to
our default glob pattern in site.json, and they will be copied
over to the production site.

The users will typically want to avoid the above situation, but
they may not be familiar with MarkBind configurations early on
and can be troubled by this problem.

Let's exclude node_modules from copying over to the
production site and add them into pagesExclude to prevent
any processing, by default.

This change will not affect users negatively but provides a
sensible default to deal with node_modules.


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No unrelated changes

@jonahtanjz jonahtanjz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @tlylt. This makes it so much easier for MarkBind users to work with projects that require node_modules 💯

LGTM 👍

@jonahtanjz jonahtanjz added this to the 4.0 milestone May 6, 2022
@jonahtanjz jonahtanjz merged commit 15f5edb into MarkBind:master May 7, 2022
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.

Exclude node_modules files by default when setting up via markbind init

2 participants