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 a virtual file system

See original GitHub issue

On a GitHub app the file system and the cloned repo are not available. Currently cosmiconfig browse the filesystem to find the config files, so it cannot be used with a GitHub app.

Would it be possible to pass to the load function a Array of file Objects, which would contains the the file path and the file content as a String or a Buffer? So a GitHub app could retrieve the config files as a String or Buffer and pass them to cosmiconfig.

For example:

const explorer = cosmiconfig('mymodule', [
  {path: 'mymodulerc.yml', content: '....'},
  {path: 'dir/mymodulerc.yml', content: '....'},
]);

explorer.load();
// => use config from `mymodulerc.yml`

explorer.load('dir');
// => use config from `dir/mymodulerc.yml`

explorer.load(null, 'dir/mymodulerc.yml');
// => use config from `dir/mymodulerc.yml`

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:29 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
davidtheclarkcommented, Mar 31, 2018

@sudo-suhas Agreed. It could go into whatever release it’s ready for.

1reaction
davidtheclarkcommented, Mar 24, 2018

Here are the steps I see to allowing the user to pass in a custom fs module:

  • Implement our own isDirectory function, instead of using the is-directory module.
  • Document precisely which fs methods we use. That way we can document that the user-provided fs must expose those methods.
  • Try it out, maybe with memfs.

Does that sound right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtual file system - Wikipedia
The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way. A...
Read more >
Overview of the Linux Virtual File System
The Virtual File System (also known as the Virtual Filesystem Switch) is the software layer in the kernel that provides the filesystem interface...
Read more >
Virtual File Systems - IBM
The virtual file system is an abstraction of a physical file system implementation. It provides a consistent interface to multiple file systems, both...
Read more >
Virtual filesystems in Linux: Why we need them and how they ...
VFS are a "shim layer" between system calls and implementors of specific file_operations like ext4 and procfs . The file_operations functions ...
Read more >
What is virtual file system (VFS)? | Definition from TechTarget
The VFS serves as an abstraction layer that gives applications access to different types of file systems and local and network storage devices....
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