natemoo-re/microsite

Microsite pins a CPU core on creation and building, no output

rschristian opened this issue · 10 comments

Hello! Saw your post in the Preact slack, decided to give this a quick test tonight.

Unfortunately I'm having a really weird issue where Microsite appears to pin one (of my 4) CPU cores at 100% when doing any operation. I let npm init microsite microsite-test run for about 15 minutes and all I got were fans. NPX would let me know it installed 4 deps in less than a couple seconds and then I received no more output.

I then decided to skip that and clone your template manually. Same issue. The template is unedited and after running yarn/(npm run) build I get no terminal output and more CPU core maxing out. It does seem to cycle which core gets pinned at 100%, not sure if that's relevant information or not. Might just be Node shuffling them.

I'll provide my system + tool specs here, certainly let me know what else I can provide.

Environment Info:
  System:
    OS: Linux 5.8 Manjaro Linux
    CPU: (4) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 14.15.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 6.14.8 - /usr/bin/npm

Yikes! Sorry this is happening, but thanks for opening an issue.

I assume this is the first time you've run into something like this? I can think of one shared thing between the create-microsite and microsite packages that is probably pretty uncommon—they pass the following arguments to node via the shebang at the top of the file.

#!/usr/bin/env node --experimental-modules --experimental-specifier-resolution=node

I tracked down this comment on StackOverflow which suggests that Linux doesn't handle arguments passed to node in this way. I'll do some more digging and see what I can come up with.

Yeah I can't recall running into anything like this in the past. Some shebang shenanigans here and there I believe but noting resembling this.

Happy to be a guinea pig to help resolve of course.

Really hoping these changes fix your problem. Can you try again with npm init microsite (should use create-microsite@0.1.1 automatically.) Assuming that works, microsite@0.6.14 should also work now!

The resolution here involved a few things:

I removed all the flags from the shebang in create-microsite, since node@14 is LTS and has unflagged --experimental-modules and I wasn't actually using --experimental-specifier-resolution=node.

microsite was a bit harder, since I was using bare imports. typescript won't rewrite them for you (see typescript#16577), but it turns out you can add the .js extension in the source without a problem. This removed the need for --experimental-specifier-resolution=node.

So now both packages have no arguments in the shebang (#!/usr/bin/env node). That should work cross-platform without a problem.

Hmm, unless I'm using this incorrectly, no project actually gets created, though the command does now finish. Can't find the project anywhere in my home directory, so I assume it's just not written?

2020-11-22_20-25

Glad it actually runs now! Can confirm that you're using it correctly! That's weird that you're not seeing any output... I'm going to try to reproduce.

I just cloned the template manually to build and that portion does seem to be working now. Output certainly seems in-line with what I'd expect.

Awesome! create-microsite was swallowing uncaught errors, so maybe the output will be more helpful now?

Really appreciate you taking the time to give this tool a shot!

She works now! Looks like it wasn't a swallowed error but changing from join to resolve did the trick.

I'll close this now as the problems all seem to be addressed. Thanks for your quick response, I look forward to using Microsite!

Awesome, I suspected that might be the case. Thanks for triaging this with me! That's a ✅ on Microsite's first real issue.

By the way, as you're playing around with things, you can pass the following to microsite build. --debug-hydration will log out component hydration events and --no-clean will keep the intermediate output. I'll add this as a note somewhere.