embroider-build / addon-blueprint

Blueprint for v2-formatted Ember addons
MIT License
29 stars 28 forks source link

release-it stuff errors, preventing addon generation #21

Open NullVoxPopuli opened 2 years ago

NullVoxPopuli commented 2 years ago

having a flag like https://github.com/embroider-build/addon-blueprint/issues/9 would be really good.

Here is the error I got:

 ember addon my-addon -b ../NullVoxPopuli/addon-blueprint/
# ....
Error creating new application. Removing generated directory `./my-addon`
Command failed with ENOENT: create-rwjblue-release-it-setup --no-install
spawn create-rwjblue-release-it-setup ENOENT

Stack Trace and Error Report: /tmp/error.dump.db9873fe8c3dfb583cc98606cb31108f.log

when this error occurs, the addon directory is removed.

ef4 commented 2 years ago

I can confirm that the release-it setup breaks installation for me too.

I suspect it only works for someone who has previously done a global install of create-rwjblue-release-it-setup. At the point where the execa runs, the node_modules haven't been installed yet so execution fails.

simonihmig commented 2 years ago

Hm, strange. There was indeed this issue before (#11), which was obfuscated for me as I indeed had release-it installed globally. But I thought this was fixed by #12! 🤔

At the point where the execa runs, the node_modules haven't been installed yet so execution fails.

You mean the node_modules of the generated addon? But these are not needed, we need the node_modules of the blueprint, which include create-rwjblue-release-it-setup and which must be there when the blueprint runs. Or what do I miss?

Anyway, I will investigate this later...

ef4 commented 2 years ago

Perhaps that distinction is the problem. If execa is locating node binaries relative to the cwd it wouldn't reliably work here. I don't actually know though what execa is doing.

simonihmig commented 2 years ago

I spent some time on this, but couldn't reproduce...

So it turned out that I did have create-rwjblue-release-it-setup installed globally. However things seem to have been messed up a bit (couldn't yarn global remove it). Probaby due to having installed things with different tools (yarn, volta) over the years, idk... Anyway, after removing create-rwjblue-release-it-setup the blueprint still completed flawlessly!

Then, to rule out anything particular of my (messed up?) system has an effect, I ran the blueprint within a freshly created docker container, no shared volumes, so nothing which could have leaked into it. And there it also works just fine!? 🤔

If you want to try it, this is what I did:

docker run -it node bash
# then, on the guest machine:
npx ember-cli addon my-addon -b embroider-build/addon-blueprint --yarn

Just to rule this completely out: you both have been using the very latest version of the blueprint, not any eventually stale local copy?

If execa is locating node binaries relative to the cwd it wouldn't reliably work here

The fix (#12) I mentioned above specifically makes sure that execa looks for it based on the blueprint's folder, see https://github.com/embroider-build/addon-blueprint/blob/main/index.js#L83