-
Notifications
You must be signed in to change notification settings - Fork 35
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
Make yarn-run-dev not move queries.json to build folder #162
Open
simonvbrae
wants to merge
14
commits into
comunica:master
Choose a base branch
from
simonvbrae:fix-yarn-run-dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3e68e3d
Make yarn-run-dev not move queries.json to build folder
simonvbrae 3d2aefd
Delete queries.json config linefor build configuration
simonvbrae 039b728
Cleanup
simonvbrae e612c26
Use correct config for yarn dev-prod script
simonvbrae fcfb7d8
Test for CI
simonvbrae 5b44f4d
Undo change, can't force CI to run on github
simonvbrae e97a6e8
Add some debug output
simonvbrae 8a7e47d
remove obsolete addition to buildcontext
simonvbrae 19394a5
remove debug prints
simonvbrae f3e2b3a
copy queries.json from CWD to fix CI
simonvbrae 04d66b2
Debug path.resolve vs path.join & presence of build folder for CI
simonvbrae f0d32c6
Change back line that didn't need changing
simonvbrae 167cc95
Create build folder to fix CI
simonvbrae dfbd305
Copy queries.json from process.cwd()
simonvbrae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not sure this is correct, as this may break overriding queries.json when using
bin/generate.js
.Can you double-check this? (as we don't have unit tests for this)
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.
It seems to still work; using the option
-q
results in custom queries being made available.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.
Should I add a unit test for this? And would it be a good start to check if the custom query correctly ends up in
queries.json
in thebuild
folder?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.
A test would be great indeed! But let's keep this for a separate PR. I'll merge this one already. Thanks for checking!
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.
I'm sorry for raising this point again, but the lacking unit test is making me a bit paranoid right now 😅
Could you try invoking
bin/generate.js
with a custom queries config from a completely different directory to check everything works correctly?Because the usage of
__dirname
here would cause thequeries.json
file to be loaded from the repo directory, and not from a different directory.But I could be missing something.
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.
Better safe than sorry!
Calling
./bin/generate -q /home/custom_queries
worked correctly.The reason it works is that
queries.json
seems to be generated in the directory denoted by__dirname
and copied from there tobuild/
.I thought, what if
queries.json
gets generated incwd()
, which could be incompatible with using__dirname
in some cases. I tested this in two ways:I ran
bin/generate -q /home/custom_queries
outside of the repo, this failed because it could not resolvebabel-loader
, I assume this is normal behaviour?I also ran
.bin/generate
from a subdirectory of the repo. This worked correctly.Do these tests cover everything?
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.
That should also work, but probably doesn't in this case because it can't find the node_modules.
Can you try globally installing this package (your dev version), and running the bin like that? (
yarn link
should also be able to do that (at least yarn classic, not sure about the newer ones))You should then be able to run
comunica-web-client-generator
from anywhere.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.
This also seemed to work:
comunica-web-client-generator -q /home/custom_queries
works in any directory and I used a print to make sure it's using my local version correctly.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.
I just re-read your previous comment.
The fact that
queries.json
is generated in__dirname
is a bit strange.This means that even when running the command elsewhere,
queries.json
will get generated within the directory of the source code.I would the source code to remain immutable, and only the cwd to get modified.
Do you think it's feasible to restore the old behaviour of this file getting generated in
process.cwd()
? This would also simplify debugging on this file.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.
I have restored it and tested, everything seems to work correctly, including custom queries folder via
-q
.