I would like to ask you if anyone can help me please with setting up my dev. workflow for the KPI part of the application. My steps so far are following:
Use –setup to enter dev-mode
Make change in the code
Re-build the container with –buld-kpi
Restart configuration
It’s obvious that rebuilding the whole container is not most optimal way to test my new build.
I can execute npm run watch inside of the kpi container but how i would reach web-dev-server to see my changes?
Sorry this isn’t documented better. If you change Python code, that’s handled by manage.py runserver_plus, which kobo-install’s developer mode turns on for you (in place of uWSGI).
For front-end code, try ./run.py -cf run --publish 3000:3000 kpi npm run watch. This will be fast if Linux is your host but slower if it’s macOS, due to the way Docker’s disk volumes work. It’s possible to start npm run watch on your host OS instead of within a Docker container as well; ping me or @magicznyleszek if you need help with this.
The answer to that question is to map port 3000 from the host into the container where npm run watch is running. That’s what my previous post suggests:
Hi @jnm, I tried the command you mentioned but this errors showed up.
ERROR in Entry module not found: Error: Can’t resolve ‘/srv/src/kpi/’ in ‘/srv/src/kpi’
ERROR in multi (webpack)-dev-server/client?http://0.0.0.0:3000 (webpack)/hot/dev-server.js ./
Module not found: Error: Can’t resolve ‘/srv/src/kpi/’ in ‘/srv/src/kpi’
@ multi (webpack)-dev-server/client?http://0.0.0.0:3000 (webpack)/hot/dev-server.js ./ main[2]
Hello @jnm, I tried to access the domain where the dev.server port 3000 pointing in and it’s showing me the list of directories not the application itself.
Are you sure you’re editing the Python code in the right location? It’s easy to end up with multiple copies of the code and edit the wrong one by mistake. To find out, try this command:
Look for the Source that corresponds to "Destination": "/srv/src/kpi" and make sure you’re editing the code there. (The same steps should work for kobocat as well.)
Hello, don’t include kobo-install$ as part of the command: that is the command prompt. You should make sure you’ve changed into the kobo-install directory and then run everything after the $. I assume you’re trying to follow the instructions below since those are the only ones where kobo-install$ is included; if that’s true, then you should be typing docker inspect (followed by the rest of the command) into your shell.
Also, I don’t use zsh (I use bash), so if you encounter other weird happenings, you might try to run the commands in bash instead. Good luck! Please remember that you’re on your own doing this kind of development. We (the KoBo team) try to offer as much unofficial support as possible, but our time for responding to this kind of inquiry is pretty limited.
Thank you very much for your answer so quickly, I have switched to bash to make it easier and avoid future problems.
I run the code but nothing comes out in the output, I don’t understand why.
My intention is to see if I have made the changes in the correct part of the code.
Even so, if I run “./run.py -cf run --publish 3000:3000 kpi npm run watch”
I get this result, I don’t know if it will help.
Reading files…
167 SVGs found.
Generating fonts…
Adding timestamp to files…
Copying k-icons.css to SCSS file…
Generating definition file…
「wds」: Project is running at http://0.0.0.0:3000/
「wds」: webpack output is served from http://kf.kobo.local:3000/static/compiled/
「wds」: Content not from webpack is served from /srv/src/kpi
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
(node:65) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see Introduce getOptions · Issue #56 · webpack/loader-utils · GitHub
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
at Object.parseQuery (/srv/src/kpi/node_modules/less-terrible-coffeelint-loader/node_modules/loader-utils/index.js:78:3)
at Object.checkSource (/srv/src/kpi/node_modules/less-terrible-coffeelint-loader/index.js:90:21)
at Object. (/srv/src/kpi/node_modules/less-terrible-coffeelint-loader/index.js:130:19)
at /srv/src/kpi/node_modules/less-terrible-coffeelint-loader/index.js:77:7
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
That output looks okay, but it seems incomplete. You should see Compiled successfully as the last line. It might take a few minutes; if you want some reassurance that things are not stuck, use a process monitor like top to make sure node is still using a lot of CPU time.
Once you see this, you should be able to load http://kf.kobo.local:1234 (replacing 1234 with whatever port you chose during setup) and see the changes you made to front-end code. Additionally—and this is the nice part—as long as you leave npm run watch running, it will detect new changes to front-end code and recompile automatically. These automatic recompilations are much faster than the initial startup. Each time it detects changes and recompiles, you’ll see this again on the terminal:
I finally get into this but then do I need to see the changes here: http://kf.kobo.local:3000/static/compiled/
because it only shows a withe screen with this
Cannot GET /static/compiled/