Fork me on GitHub
#shadow-cljs
<
2020-03-22
>
coby02:03:03

oh, I was wondering if I did something to make those go away...glad to hear they're coming back 😄

kwrooijen13:03:50

Hi, is it possible to edit node modules and have those changes be picked up by shadow-cljs?

kwrooijen13:03:54

For debugging purposes

thheller14:03:16

@kevin.van.rooijen shadow-cljs no longer watches individual files in node_modules, it only watches package.json files for modifications. so you can touch node_modules/the-dep/package.json which should trigger a rebuild

kwrooijen14:03:29

Thanks, that does trigger a rebuild.

deep-symmetry20:03:56

I successfully finished porting my big LaTeX documents to Asciidoctor/Antora with the help of a byte-field diagram generator I created as a node module using shadow-cljs. I had been using it straight out of Git, but today I just published it to npm (my first npm module) so I can start documenting it the way people will actually want to use it. But when I try to change my build pipeline to use it from the npm install instead of my local git repo, I am getting an error I can’t understand:

$ANTORA_DJ --fetch doc/dev_svg.yml --stacktrace
no "source-map-support" (run "npm install source-map-support --save-dev" to get it)
Error: ENOENT: no such file or directory, open '/Users/jim/git/dysentery/node_modules/bytefield-svg/.shadow-cljs/builds/lib/dev/out/cljs-runtime/goog.debug.error.js'
    at Object.openSync (fs.js:436:3)
    at Object.readFileSync (fs.js:341:35)
    at global.SHADOW_IMPORT (/Users/jim/git/dysentery/node_modules/bytefield-svg/lib.js:58:15)
    at /Users/jim/git/dysentery/node_modules/bytefield-svg/lib.js:2212:1
    at /Users/jim/git/dysentery/node_modules/bytefield-svg/lib.js:5:26
    at Object.<anonymous> (/Users/jim/git/dysentery/node_modules/bytefield-svg/lib.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
I am running the command inside my dysentery repository, where I have locally installed my bytefield-svg npm module. Its source is here: https://github.com/Deep-Symmetry/bytefield-svg

deep-symmetry20:03:00

Do I need to build it in a different way to publish it to npm or something?

deep-symmetry20:03:14

(The error message is correct in that there is no .shadow-cljs directory in the npm-installed copy of bytefield-svg. That directory does exist in the git repo where I built the module to publish to npm. I am a total npm n00b, and pretty wet behind the ears when it comes to shadow-cljs as well, this project was my first non-JVM Clojure effort, so hopefully someone can help me understand what is going on!)

thheller20:03:31

you cannot publish development builds to npm, they are only meant to run on the machine that compiled it

thheller20:03:42

you must use shadow-cljs release your-build and publish that instead

deep-symmetry20:03:39

Ok, that makes sense. I will give it a shot. Does it make sense to set up an npm script for that?

deep-symmetry20:03:17

In your command line what is your-build?

thheller20:03:39

whatever your build id is

deep-symmetry20:03:10

I don’t know what a build id is. The name in package.json?

thheller20:03:40

how do you use shadow-cljs now?

thheller20:03:45

i mean what command do you run

thheller20:03:58

it will have the build id in it ... its the key in the :builds map

thheller20:03:07

well ... and what does that run?

deep-symmetry20:03:38

Yup, was just going there. 😄 It runs shadow-cljs compile lib so I am guessing the magic id is lib.

deep-symmetry21:03:04

So I will add a release script. Thanks! Trying…

dpsutton21:03:47

Is the npm script helpful at all? Maybe the simple shadow-cljs api might be beneficial for you while you’re learning. Way less indirection

deep-symmetry21:03:26

As it is, I have a devil of a time when I dabble in JS projects remembering if they use npm, yarn, or gulp to build; adding another tool seems even worse. But I understand where you are coming from.

deep-symmetry21:03:55

Anyway, having to rebuild gave me a chance to update my dependencies on shadow-cljs and borkdude/sci, so at least 1.0.1 is more than a 1.0.0 that works! 😉

deep-symmetry21:03:28

Yes! The npm-installed version works now. Thanks again for your patient and clear help.