question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use file-globs for sources

See original GitHub issue

Hi! First of all, I would like to thank you for this project - superawesome generator, the only one of its kind!

As for the issue - currently I’m trying to set up documentation generation for my project and I’m running into some troubles with include/exclude params in config. First problem is that I cannot put my sources in one directory like it’s suggested in manual (src), because of legacy support. All sources are in root directory. Ok, I can handle this by filling exclude array in config with node_modules etc. Next problem is that the project is component-based and a single component directory contains lots of auxiliary js and jsx files, demo-pages, demo-scripts, etc. These files should not be documented, so I need to carefully set up includes array in config with heavy regexps just to filter out what I don’t need in documentation.

So, my suggestion is to deprecate sources, includes and excludes and to use file-globs like it’s done in gulp.src. It can be done either by specifying files as an array of glob-strings or by using array of plain file-paths.

Using globs in config:

module.exports = {
  files: ['./util/**/*.js', './components/**/*.jsx', '!./components/**/*.test.jsx']
}

Using file paths as a result of https://github.com/isaacs/node-glob package:

var glob = require('glob');
module.exports = {
  files: glob.sync(['./util/**/*.js', './components/**/*.jsx'], {
    ignore: ['./components/**/*.test.jsx']
  })
}

I think the second variant is more appropriate as it does not force you to use globs in library source and add an extra dependency - it’s for the end-user.

What do you think? I could create a pull-request after approval of this suggestment.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
h13i32marucommented, Sep 13, 2015

@raveclassic Thanks for explanation!

What do you think the following changing?

  • currently
    • config.source accepts directory path(string)
  • changing
    • config.source accepts directory path(string) and file/directory paths(string array)

So, ESDoc will support the following both case.

// case1: specify directory path
{
  source: "path/to/directory"
}
// case2: specify file/directory paths
{
  source: ["path/to/directory", "path/to/file.js",,,]
}
0reactions
typhonrtcommented, Jul 24, 2016

I have created a comprehensive solution for multiple source path support with backward compatibility and an overview is available in #310.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ansible.builtin.fileglob lookup – list files matching a pattern
This lookup plugin is part of ansible-core and included in all Ansible installations. In most cases, you can use the short plugin name...
Read more >
goreleaser/fileglob: A file globbing library. - GitHub
fileglob is a glob library that uses gobwas/glob underneath and returns only matching files or direcories, depending on the configuration.
Read more >
Using with_fileglob for multiple src and destination while ...
In you question you are using two destination paths which can be extracted from your source path. So for above question you can...
Read more >
Copy Multiple Files to Remote Hosts - Ansible Pilot
How to automate the copy of the "example/*.txt" files to a target host using the with_fileglob Ansible loop statement and Ansible lookup plugin...
Read more >
fileglob – list files matching a pattern — Ansible Documentation
name: display content of all .txt files in dir debug: msg={{lookup('fileglob', '/my/path/*.txt')}} - name: Copy each file over that matches the given ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found