Make yarn-run-dev not move queries.json to build folder
This is a draft PR, I am still making changes.
Calling yarn run dev would result in the queries.json file being moved to build/ after generation resulting in missing data sources and queries in the development server.
This PR changes lets that move happen outside of webpack so it doesn't happen when running yarn run dev, only when running yarn run build.
Thanks @simonvbrae, looks good!
Can you confirm build and serving works correctly in these cases? (because the CI currently only checks one of these)
yarn run dev(yarn run dev-prodshould be the same)yarn run buildnode bin/generate.jsIf yes, I'll merge this right away!
I have tested all of the options, it's ready for merge!
@simonvbrae It looks like the CI doesn't pass. Can you check why?
@simonvbrae It looks like the CI doesn't pass. Can you check why?
The error is
Error: ENOENT: no such file or directory, rename '/home/runner/work/jQuery-Widget.js/jQuery-Widget.js/queries.json' -> '/home/runner/work/jQuery-Widget.js/jQuery-Widget.js/build/queries.json'
This could be caused by this line we discussed above, the failing CI runs may be expecting queries.json to be present in CWD. I've changed it back, which should fix the CI.
Still seems to be failing after your change :/
The issue seems to be caused by an absent build folder, my current commit creates the folder, which fixes the CI.
But the absent build folder raises a few questions:
- Where is the build output if the build folder doesn't exist? This is especially strange considering that all the webpack entries have this exact build folder (that doesn't exist) as their output path.
- So why is the call to
webpack()successful when all of it's entries have an output.path that doesn't exist?
I didn't find anything in the documentation suggesting that webpack creates this directory and, in practise, it doesn't seem to create it because the error of build folder not existing happens after the call to webpack().
I'm not sure as to whether everything is correct within the CI but I am committing what makes the CI pass for now.
@simonvbrae Is this one ready for review?