Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Remove recursive/ignore option from ipfs.addFromFs and accept globs? #2885

Closed
achingbrain opened this issue Sep 1, 2019 · 1 comment · Fixed by ipfs/js-ipfs-utils#151
Closed
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature

Comments

@achingbrain
Copy link
Member

It seems weird that we accept globs for the ignore option but not for the path parameter?

ipfs.addFromFs('/path/to/dir', {
  recursive: true,
  ignore: ['*.js', '*.css']
})

We could accept globs there and then remove the recursive option.

ipfs.addFromFs('/path/to/dir/**', {
  ignore: ['*.js', '*.css']
})

Going further you can also specify ignores in the path glob so we can retire the ignore option too:

ipfs.addFromFs('/path/to/dir/**/!(*.js|*.css)')

In the positive matching case this would also let the user specify the files they want, instead of having to specify a base dir, a recursive flag and then ignore patterns for all the files they don't want:

ipfs.addFromFs('/path/to/dir/**/{*.js,*.css}')

Perhaps we could pass the options object through to minimatch for really advanced usage - so you can match hidden files and so on?

@alanshaw
Copy link
Member

alanshaw commented Sep 3, 2019

+1 yes please! This would simplify the API and our code

@achingbrain achingbrain transferred this issue from ipfs-inactive/interface-js-ipfs-core Mar 10, 2020
@achingbrain achingbrain added exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature labels Mar 10, 2020
achingbrain added a commit to ipfs/js-ipfs-utils that referenced this issue Sep 15, 2021
We use a weird mix of multiple glob patterns and ignores which means
we parse the available files in an inefficient way.

Instead just use a single glob pattern which can do everything we
need.

Fixes ipfs/js-ipfs#2885
achingbrain added a commit to ipfs/js-ipfs-utils that referenced this issue Sep 22, 2021
We use a weird mix of multiple glob patterns and ignores which means we parse the available files in an inefficient way.

Instead just use a single glob pattern which can do everything we need.

Fixes ipfs/js-ipfs#2885

BREAKING CHANGE: the globSource call signature has changed and no longer supports the recursive or ignore options
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants