Code Monkey home page Code Monkey logo

Comments (3)

ifduyue avatar ifduyue commented on July 16, 2024

Find this in https://github.com/isaacs/node-glob/blob/e3cdccc0e295c2e1d5f40cf74c73ea17a8319c5c/README.md#options

root The place where patterns starting with / will be mounted onto. Defaults to path.resolve(options.cwd, "/") (/ on Unix systems, and C:\ or some such on Windows.)

from glob-stream.

ifduyue avatar ifduyue commented on July 16, 2024

Here is a demo https://github.com/ifduyue/gulp-src-with-opts-cwd-and-root, and what I want to do:

$ tree this-is-root/
this-is-root/
├── a
├── b
└── c
    ├── d
    └── e

1 directory, 4 files

Set directory this-is-a-root as the root (like a chroot root), so that every glob, not matter whether it start with / or not, captures expected files under this-is-root.

But it doesn't work. Below is the output of running gulp:

$ gulp
[01:00:16] Using gulpfile ~/workspace/github/gulp-src-with-opts-cwd-and-root/gulpfile.js
[01:00:16] Starting 'default'...
[01:00:16] glob is [ 'a', '/b', 'c/d', '/c/e' ]
[01:00:16] Finished 'default' after 16 ms
[01:00:16] { cwd: 'this-is-root' } 'captures' [ 'a', 'd' ]
[01:00:16] { root: 'this-is-root' } 'captures' [ 'this-is-root/b',
  '../Users/d/workspace/github/gulp-src-with-opts-cwd-and-root/this-is-root/c/e' ]
[01:00:16] { cwd: 'this-is-root', root: 'this-is-root' } 'captures' [ 'this-is-root/b',
  '../Users/d/workspace/github/gulp-src-with-opts-cwd-and-root/this-is-root/c/e' ]

It is expected that all the files under this-is-root are captures by gulp.src.
But the reality is no matter how I use a combination of the opts cwd and root, it only capture two files, not all four.

from glob-stream.

ifduyue avatar ifduyue commented on July 16, 2024

It seems both glob-stream and node-glob manipulate on globs and opt.cwd, and something happens.

from glob-stream.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.