Hi all - using vanilla npm you can: ```npm install...
# gradle
r
Hi all - using vanilla npm you can:
Copy code
npm install <git-host>:<git-user>/<repo-name>
npm install <git repo url>
… and this will result in npm installing a dependency from a github repo/ref as if it was a standard npm module: https://docs.npmjs.com/cli/v8/commands/npm-install I’ve tried lots of different permutations of this in gradle + npm and no matter what I try it always errors in various ways e.g.
implementation(npm("username/repo#branchname"))
implementation(npm("username/repo#branchname", "*"))
implementation(npm("username/repo", "commitref"))
So question: Is it possible to use gradle + npm to install npm dependencies from github locations? Many thanks!
Solved this in the end - it is actually the
version
where you are meant to put the repo/version so it is in fact e.g.:
Copy code
implementation(npm("@jsonforms/material-renderers", "github:rhiadj/material-renderers#master"))
Only reason I realised is seeing this logic used for
file:
https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/targets/js/npm/NpmDependency.kt#L142 And so decided to see if
github:
also works and it does. Perhaps not that obvious so hope this helps someone else!
👍 1