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

Exclude node_modules files by default when setting up via markbind init #1844

Closed
tlylt opened this issue Mar 22, 2022 · 0 comments · Fixed by #1925
Closed

Exclude node_modules files by default when setting up via markbind init #1844

tlylt opened this issue Mar 22, 2022 · 0 comments · Fixed by #1925

Comments

@tlylt
Copy link
Contributor

tlylt commented Mar 22, 2022

Tell us about your environment
Windows 10

  • MarkBind Version:
    v3.1.1
    What did you do? Please include the actual source code causing the issue.
    I think it is pretty complicated for someone new with MarkBind to do a simple task such as ignoring files from node_modules. This is a common scenario when starting a js project and adding MarkBind to it. I took some time myself in order to figure out how to do it and initially thought that it was bug 😢

A typical project initialization process might look like this:

  1. Start a new js project npm init
  2. Install the latest version of markbind-cli npm i markbind-cli
  3. Add in the package.json's script that "build": "markbind build", "init": "markbind init"
  4. initialize a markbind project npm run init
  5. try building the project by npm run build
    • will copy and build all the files in node_modules
    • not what is expected
    • read the docs to discover the ignore attribute
  6. try adding "node_modules/*" in site.json's ignore attribute
  7. try building the project by npm run build
    • doesn't quite work, still tries to build 500 plus pages, and ended with an error
    • possibly due to the glob pattern of "**/*.+(md|mbd)"
    • read the docs again to figure out that there's a globExcludes that works with glob (I initially thought that it is defined in a separate object and that doesn't work)
  8. try adding "node_modules/*" in a globExcludes:
    Note that this doesn't work, but it's the first thing I tried:
    {
      "glob": ["**/index.md", "**/*.+(md|mbd)"],
    },
	{
      "globExclude": ["node_modules/*"]
	}

This works

    {
      "glob": ["**/index.md", "**/*.+(md|mbd)"],
      "globExclude": ["node_modules/*"]
    }
  1. possibly also realize that this will work:
"pagesExclude": ["node_modules/*"],

What did you expect to happen?
I expect the common task to be simple.

What actually happened? Please include the actual, raw output.
Currently, it requires a new user to understand a few attributes such as 'ignore', 'glob', 'globExcludes', 'pagesExclude' just to get started.
This could be due to the fact that we only mention how to globally install markbind-cli in our user guide. While that works, it may not work well for existing projects or those that already have the setup of a package.json with node_modules. My proposal is as follows:

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

Successfully merging a pull request may close this issue.

2 participants