It would be nice if you could play with cadl without installing it globally via npm install -g.

I tried these steps:

md repro
cd repro
npm uninstall -g @cadl-lang/compiler # to make sure it didn't interfere
npm init -y
npm install @cadl-lang/compiler
npx cadl code install
code .

This errors starting the language server, it can't find the cadl-server executable. We should be able to make it find it off workspace root without relying on the global executable to run its resolver for this case. That should be a relatievely straight-forward fix.

The other problem I see in this scenario is that I can't use npx cadl init to get started because I need to npm install @cadl-lang/compiler first while cadl init templates help me to do that. Chicken and egg.

We should probably fix the reliance on global cadl to find local cadl and then at least document an alternate flow that doesn't require npm install -g.

0

npx cadl init could probably move to something like npm init @cadl-lang as documented here, at least as an option.

1

does npx -p @cadl-lang/compiler cadl init not work? This is definitely not optimal and having the @cadl-lang/create package would be nice to simplify but I think we can already do that.

1
© 2022 pullanswer.com - All rights reserved.