fermyon / spin-js-sdk

https://developer.fermyon.com/spin/javascript-components
Apache License 2.0
52 stars 18 forks source link

Add snippets to enable `spin add` #66

Closed radu-matei closed 1 year ago

radu-matei commented 1 year ago

cc @itowlson

Signed-off-by: Radu Matei radu.matei@fermyon.com

karthik2804 commented 1 year ago

I run into an error when I try to add a TypeScript component but it succeeds when using a js-component.

# errors out
$ spin add http-ts test-component --accept-defaults
Error: liquid: Unknown variable
  with:
    requested variable=msg

# succeeds
$ spin add http-js test-component --accept-defaults
radu-matei commented 1 year ago

Make sure to uninstall the TS template before, I just re-ran spin add with a TypeScript component and everything seems to work fine for me.

karthik2804 commented 1 year ago

That solved it! I had to install (update) the templates from your branch. This works as expected.

spin templates install --update --git https://github.com/radu-matei/spin-js-sdk/ --branch templates-add-component

I keep running into the same error when I try to install the templates from a local directory where the PR was checked out with the following command

spin templates install --update --dir ./

Not sure if this is an issue only on my end. I will take another look tomorrow.

karthik2804 commented 1 year ago

@radu-matei Do you want to include the fixes to the template to derive name, trigger.base and path as pointed above or should I make a separate PR for that.

radu-matei commented 1 year ago

Feel free to create a separate PR, @karthik2804! Thanks!