Skip to content

Custom folder structure #4

Discussion options

You must be logged in to vote

That's a great question @VardaPanchal005! 😊
Here’s how I’ve handled it in the extension 👇
The extension uses a custom GitignoreService internally to support ignoring files and folders — just like a .gitignore file does!


🔧 How it works:

  1. Reads .gitignore from the selected root directory
  2. Parses the rules (like node_modules, *.log, etc.)
  3. Filters out files/folders from the structure using the ignore package.

🧠 Internals (Simplified):

// services/gitignore.ts
const gitignorePath = path.join(dirPath, '.gitignore');
const content = await FileSystemService.readFile(gitignorePath);
const rules = content.split('\n').filter(Boolean);
const ig = ignore().add(rules);

if (ig.ignores(relativePath)) {

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by VardaPanchal005
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants