aqua
aqua copied to clipboard
Detect imports like `import @fluencelabs/registry/...` and suggest users to `npm i -g @fluencelabs/registry`
It's a good UX to provide actionable suggestions to fix the problem.
In case of missing imports, we could try to detect if it's an import from some library, and suggest to install it via npm.
However, there's a problem of detection, consider:
import "protocols/ipfs/ipfs.aqua"
import "@protocols/ipfs/ipfs.aqua"
import "nice-library/awesomeness.aqua"
import "@fluencelabs/registry/api.aqua"
Which one is referring to NPM package and which one isn't? I see several ways to approach this:
- Hard-code
@fluencelabs
prefix and show suggestions only for these libraries2. - Suggest blindly. e.g.,
npm i -g protocols @protocols/ipfs nice-library @fluencelabs/registry
- Check if library exists on NPM. For the example above, would have to check
protocols
,@protocols/ipfs
,nice-library
,@fluencelabs/registry
. A lot of checks.