Skip to content
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

Merged
merged 1 commit into from
Dec 21, 2016

Conversation

rostik404
Copy link
Collaborator

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 170672d on fix-absolute-expanding into fd160fc on master.

@eGavr
Copy link

eGavr commented Dec 1, 2016

Вегеда еще сразу сюда призывай :)

Copy link

@eGavr eGavr left a 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()
Copy link

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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а нам точно нужна эта строчка?

мы же вроде как уже зарезолвили путь...

Copy link
Collaborator Author

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

Copy link

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) {
Copy link

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;

попробуй, плз.

тут так тестить:

  1. не передавать root, но передать относительные пути
    2 не передавать root, но передавать абсолютные пути
  2. передавать root и передать относительные пути
  3. передавать root и передавать сразу абсолютные пути (изначально переданные абсолютные пути никак не должны объединяться с root-ом)

@@ -56,4 +56,3 @@ exports.isMask = isMask;

// :TODO: Backward compatibility
exports.isMasks = (patterns) => [].concat(patterns).every(isMask);
Copy link

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']);
Copy link

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']);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в одну? 😇

@rostik404
Copy link
Collaborator Author

Слушай, а может мы еще и вот эту фигню выпилим заодно

Я бы оставил, чтобы модуль был более универсальным. Мало ли, как мы его в будущем захотим использовать.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 90fdb11 on fix-absolute-expanding into fd160fc on master.

@eGavr
Copy link

eGavr commented Dec 13, 2016

Вот этот коммент пропустил или не согласен?

Слушай, а может мы еще и вот эту фигню выпилим заодно, если уж и так и так ломаем обратную совместимость? https://github.com/gemini-testing/glob-extra/blob/master/lib/index.js#L15-L17

?

@rostik404
Copy link
Collaborator Author

Я ответил выше на этот коммент #11 (comment)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling e392147 on fix-absolute-expanding into fd160fc on master.

@eGavr
Copy link

eGavr commented Dec 14, 2016

Я ответил выше на этот коммент #11 (comment)

договорились голосом, что это делать надо

@rostik404 rostik404 force-pushed the fix-absolute-expanding branch 2 times, most recently from 5b6b117 to 3732005 Compare December 19, 2016 14:13
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 5b6b117 on fix-absolute-expanding into fd160fc on master.

@rostik404 rostik404 merged commit eba006b into master Dec 21, 2016
@rostik404 rostik404 deleted the fix-absolute-expanding branch December 21, 2016 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants