Skip to content

How to install and build additional dependency? #373

Description

@falk-stefan

I am generating a TypeScript API-client via the task :server.generateClient in my web-app build.gradle.

In order to compile the web-app, I need to build and compile the API-client as well which will be located at $rootDir/generated/meditation-rest-client.

My problem is that I don't know how I can run these two commands

npm --prefix generated/meditation-rest-client/ run build --aot --prod
npm --prefix generated/meditation-rest-client/dist install

at the and of the makeClients task and then the following for building the web-app:

npm run ng -- build --configuration=development --base-href / --output-path build/ --deploy-url / --prod

How can I run the above commands in my gradle script?

npm_run_build {
  inputs.files fileTree('src')
  inputs.file 'package.json'
  inputs.file 'package-lock.json'
  outputs.dir 'build'
}

task makeClients {
  doFirst {
    def clientDir = tasks.getByPath(':server:generateClient').apiClientDir()
    copy {
      from clientDir
      into 'generated/meditation-rest-client' 
    }
  }
  doLast {
    // TODO
    // npm --prefix generated/meditation-rest-client/ run build --aot --prod
    // npm --prefix generated/meditation-rest-client/dist install
  }
  dependsOn ':server:generateClient'
}

task buildWebApp {
  dependsOn tasks.makeClients, npm_run_build
}

assemble.dependsOn buildWebApp

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions