nx-remotecache-custom icon indicating copy to clipboard operation
nx-remotecache-custom copied to clipboard

Console output not appending succesful tasks

Open robinpellegrims opened this issue 2 years ago • 8 comments

This is a follow-up on a bug report for the package @pellegrims/nx-remotecache-s3, which is depending on this awesome library.

The issue is about the console output with the custom task runner not appending succesful job results to previous results as is the case for the default task runner in nx > v14.

I was wondering if you encounter the same issue on other packages depending on nx-remotecache-custom? Any clue what causes this behavior?

robinpellegrims avatar Dec 17 '22 15:12 robinpellegrims

Well I guess it's because the plugin is directly writing to the console, while Nx itself is using line replacement for keeping the progress up to date. As an intermediate fix you can turn on silent to disable any output from the plugin. For a longterm fix, I'll have to check different ways of displaying whether it was a cache-hit, or not.

Also great to see that there are other nx-remotecache packages, which are using this package! I didn't know about this s3 implementation until now 🚀 👍

NiklasPor avatar Dec 18 '22 10:12 NiklasPor

Also great to see that there are other nx-remotecache packages, which are using this package! I didn't know about this s3 implementation until now rocket +1

I recently found out even Vercel is using it: https://github.com/vercel/remote-cache/tree/main/packages/remote-nx :partying_face:

robinpellegrims avatar Dec 18 '22 11:12 robinpellegrims

I find myself manually patching node_modules/nx-remotecache-custom/log.js, to replace

const log = console.log

with

const log = () => {}

to have cleaner log output. I'd be happy to contribute a silent mode, if you tell me how you'd like it to look like (configuration? environment variable?)

cuddlecake avatar Sep 26 '23 10:09 cuddlecake

@cuddlecake at the bottom of the readme there is the silent option displayed:

// nx.json
"tasksRunnerOptions": {
  "default": {
    "options": {
      "name": "My Storage",
      "silent": true
    }
  }
}

NiklasPor avatar Sep 26 '23 10:09 NiklasPor

I tried it with silent, but the output still looks like this:

image

Whereas I would have hoped for just one chunk like this, that continuously updates. image

I get this only when I replace the log with a noop function.

cuddlecake avatar Sep 26 '23 15:09 cuddlecake

Got it, I'll check it 👍

NiklasPor avatar Sep 26 '23 15:09 NiklasPor

+1 it would be nice to get the original output formatting with this awesome library

brnbs avatar Nov 05 '23 16:11 brnbs

+1 would love to have a non-polluted dev console but still capture the critical info. I've peeked into how to accomplish this to little success...it is possible to hook into the nx output by using:

const nxOutput = require("nx/src/utils/output");

Much like Lerna does. But even given that, I'm not totally sure how that would be useful since it's trying to produce logs whereas Lerna is just hack overriding stuff.

A viable approach might be to accumulate the cache status in a singleton, and then output it by overriding one of the methods so that you could add info...but still a little wonky

comp615 avatar Jan 23 '24 22:01 comp615