-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
return absolute paths only if project root is specified #11
Conversation
Вегеда еще сразу сюда призывай :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Слушай, а может мы еще и вот эту фигню выпилим заодно, если уж и так и так ломаем обратную совместимость? https://github.com/gemini-testing/glob-extra/blob/master/lib/index.js#L15-L17
Просто этот костыль был добавлен специально для того, чтобы не обрабатывать это в gemini, но с новой архитектурой сетов там и так все хорошо обрабатывается, то есть в эту часть кода в glob-extra
мы по факту никогда не заходим.
@@ -3,7 +3,6 @@ const _ = require('lodash'); | |||
|
|||
module.exports = (options) => { | |||
return _.defaults(options || {}, { | |||
formats: [], | |||
root: process.cwd() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно в defaults
явно указать, что root: null
, то есть не задается
path = qfs.join(options.root, path); | ||
} | ||
|
||
return utils.isFile(path) | ||
.then((isFile) => isFile ? [path] : listFiles(path)) | ||
.then((paths) => paths.filter((path) => utils.matchesFormats(path, options.formats))) | ||
.then((paths) => paths.map((path) => qfs.absolute(path))); | ||
.then((paths) => options.root ? paths.map((path) => qfs.absolute(path)) : paths); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а нам точно нужна эта строчка?
мы же вроде как уже зарезолвили путь...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тогда вот такие кейсы не будут работать
https://github.com/gemini-testing/glob-extra/pull/11/files#diff-0fd0e07cf6d02bf7cf00f18cebb8e6eaR79
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот это давай голосом обсудим.. что-то я не понял на ночь глядя, в чем там проблема 😄
@@ -24,14 +24,14 @@ const listFiles = (path) => { | |||
}; | |||
|
|||
const expandPath = (path, options) => { | |||
if (!qfs.isAbsolute(path)) { | |||
if (!qfs.isAbsolute(path) && options.root) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а вроде вот так должно работать:
path = options.root ? path.resolve(options.root, path) : path;
попробуй, плз.
тут так тестить:
- не передавать
root
, но передать относительные пути
2 не передаватьroot
, но передавать абсолютные пути - передавать
root
и передать относительные пути - передавать
root
и передавать сразу абсолютные пути (изначально переданные абсолютные пути никак не должны объединяться сroot
-ом)
@@ -56,4 +56,3 @@ exports.isMask = isMask; | |||
|
|||
// :TODO: Backward compatibility | |||
exports.isMasks = (patterns) => [].concat(patterns).every(isMask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ты все равно будешь выпускать мажор!!! можешь отрывать
.then((absolutePaths) => { | ||
assert.deepEqual(absolutePaths, ['/absolute/some/deep/path/file.js']); | ||
.then((paths) => { | ||
assert.deepEqual(paths, ['some/deep/path/file.js']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в одну? :)
|
||
return globExtra.expandPaths(['some/path/*.*'], {root: 'root'}) | ||
.then((paths) => { | ||
assert.deepEqual(paths, ['/absolute/root/some/path/file.js']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в одну? 😇
Я бы оставил, чтобы модуль был более универсальным. Мало ли, как мы его в будущем захотим использовать. |
Вот этот коммент пропустил или не согласен?
? |
Я ответил выше на этот коммент #11 (comment) |
договорились голосом, что это делать надо |
5b6b117
to
3732005
Compare
/cc @j0tunn, @sipayRT, @eGavr, @tormozz48, @DudaGod