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

Support absolute paths and NODE_PATH #37

Merged
merged 2 commits into from
Jan 24, 2019

Conversation

vinhlh
Copy link
Contributor

@vinhlh vinhlh commented Oct 4, 2018

Resolves #36.

About NODE_PATH, we use to have this setting with projects created via create-react-app.

cc @evenchange4

@codecov
Copy link

codecov bot commented Oct 4, 2018

Codecov Report

Merging #37 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #37   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      3           
  Lines          29     31    +2     
  Branches        3      4    +1     
=====================================
+ Hits           29     31    +2
Impacted Files Coverage Δ
src/macro.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e9a16b...9eab0c9. Read the comment docs.

@vinhlh
Copy link
Contributor Author

vinhlh commented Oct 8, 2018

Ping :D @evenchange4

@audiolion
Copy link

ping @evenchange4 this would be great to have

const queryPath = path.join(filename, '..', value);
const queryPath = value.startsWith('./')
? path.join(filename, '..', value)
: resolvePathFromCwd(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition does not cover the case when relative path starts with ../. I would rather use path.isAbsolute function to check whether path is absolute.

const queryPath = path.isAbsolute(value)
    ? resolvePathFromCwd(value)
    : path.join(filename, '..', value);

Copy link
Contributor

Choose a reason for hiding this comment

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

After further testing, I found out that isAbsolute is not what we need here because it returns false for foo/bar. value.startsWith('./') || value.startsWith('../') suits better.

@nicosayer
Copy link

ping @evenchange4 would love to see that

@kolyasya
Copy link

@evenchange4 really need this feature to be merged, could you help please?

@evenchange4 evenchange4 merged commit ba5dba8 into evenchange4:master Jan 24, 2019
evenchange4 added a commit that referenced this pull request Jan 24, 2019
This covers the use-case of having a mono-repo setup with graphql files in another package of your mono-repo. These packages will be symlinked in `node_modules`.

This PR uses the work from #37 as a basis
@evenchange4
Copy link
Owner

Thanks! Released v1.2.0 with your changes.

@vinhlh vinhlh deleted the absolute-paths branch January 25, 2019 01:37
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

6 participants