https://pulumi.com logo
#general
Title
# general
b

boundless-monkey-50243

09/02/2018, 3:43 PM
I very much like how predictable using Node modules is downstream though
b

big-piano-35669

09/02/2018, 3:46 PM
I do wonder sometimes whether hijacking module exports for stack outputs is too clever, compared to simply having an API, pulumi.registerStackOutputs or something. At least then we'd get to define a precise API signature and semantics.
b

boundless-monkey-50243

09/02/2018, 3:47 PM
To be honest? I didn't even think to look if I needed to register outputs.
I just assumed that exports were The Way It's Done.
JS has trained me to assume that modules are the way you get data out to the thing calling your code, so I think it's fine
"just stick your Express endpoint in a file with the correct docs and export them all nice"
(n.b.: swagger-express is not a great library, so I wouldn't recommend it as best practices, but it was the first example off the top of my head)
b

big-piano-35669

09/02/2018, 3:50 PM
Great, glad to hear this bit was intuitive. Now just to make it work the way you'd expect 😊
b

boundless-monkey-50243

09/02/2018, 3:50 PM
\o/
Once I get a little further along with this stuff this seems like the sort of thing I would just PR, but I'm still trying to figure out where the heck I am 😉
b

big-piano-35669

09/02/2018, 5:42 PM
Ok, good news; the simple case of
module.exports = main()
is really just a bug in the way we implemented stack outputs. I have a fix queued up here https://github.com/pulumi/pulumi/pull/1866 and this will get into the 0.16 release we're starting RC for on Wednesday. The other suggestions definitely require a bit more design discussion with the team, so stay tuned on that bit.