timwis / jkan

A lightweight, backend-free open data portal, powered by Jekyll
https://jkan.io
MIT License
219 stars 311 forks source link

Use parcel for JS bundling #240

Closed timwis closed 1 year ago

timwis commented 1 year ago

Closes #219

timwis commented 1 year ago

Hi @lydiascarf, thanks for testing this!

Regarding the vendor directory, good catch—I haven't been using docker in development, and my guess is @BryanQuigley may have vendor in his global .gitignore or something. I agree that should be added to the repo's .gitignore file (in a separate PR).

As for the 5,000 files, the good news is that has nothing to do with parcel. It looks like that's just how caching worked in the jekyll/jekyll:3.9.2 image, and it's been fixed in the latest image. I created this branch a few days before #236 was merged, so you would have been using the old image version when you tested. I've just merged the latest from v2 into this branch, so if you try it again, you should only have a handful of files in the vendor directory. And just to confirm, those are ruby dependencies.

Regarding the package-lock.json diff, that one definitely surprised me! But I can see now what caused it—after removing the dependencies, I corrected the package name in a separate commit. I didn't realise the package name gets saved in package-lock.json, but apparently it does:

diff --git a/package-lock.json b/package-lock.json
index d542852..0942b8f 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,11 @@
 {
-  "name": "es6-boilerplate",
+  "name": "jkan",
   "version": "1.0.0",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
-      "name": "es6-boilerplate",
-      "version": "1.0.0",
+      "name": "jkan",
       "license": "MIT",
       "dependencies": {
         "bootstrap": "^4.3.1",

Finally, there should already be two scripts in package.json: build and watch. If you run npm run watch, it will watch your JavaScript files for changes and automatically regenerate the bundled file in your _site directory. This does not run a development server; you must run jekyll serve for that as normal. This requires two terminal windows. We could do something clever and tie those into a single command (like this), but there would be a few things to think through there, and I'd suggest that be in a separate PR. In the meantime, the commands are the same as the ones in the existing documentation, though I appreciate that documentation is a bit outdated now with v2, and it should probably be in source control rather than the wiki.

lydiascarf commented 1 year ago

Thanks for the quick update and clear explanation! :bowing_woman: