corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

Recursive dependency download/import #105

Closed Vafa-Andalibi closed 5 years ago

Vafa-Andalibi commented 5 years ago

Apologies for opening another issue for yet another question which might not be relevant to this package either. Is there any way to download a module and its dependencies all recursively so to import them in the script one by one? Is this a good practice at all?

For instance this yang model has several dependencies and each has another set of dependencies and so on.

Thank you,

sekur commented 5 years ago

I've considered including external url based import feature (where you download/process) schemas from external sites but that would require async logic during parse.

For now, you can refer to https://github.com/corenova/yang-js/blob/master/TUTORIAL.md#interal-package-bundle

This would allow you to perform the recursive dependency resolution as long as the schemas are available in your local filesystem and you use package.json to point them to the right place.

Let me know if this is what you had in mind.

sekur commented 5 years ago

BTW, I think it might be worth checking out yang-loader (loader for webpack) which may potentially allow you to implement such download/resolve functionality.

Vafa-Andalibi commented 5 years ago

Thanks, I downloaded the yang-loader but there is no documentation or any help. The github repository and the github page is also pointing to yang-js repository. Is there any documentation for yang-loader?

Vafa-Andalibi commented 5 years ago

I eventually downloaded them manually from the yang repository here and put them with the dependencies in the same folder. However still cannot import them in the js file probably because of #103.