Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install and build additional dependency? #373

Open
falk-stefan opened this issue Jan 9, 2021 · 1 comment
Open

How to install and build additional dependency? #373

falk-stefan opened this issue Jan 9, 2021 · 1 comment

Comments

@falk-stefan
Copy link

falk-stefan commented Jan 9, 2021

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
@deepy
Copy link

deepy commented Jan 9, 2021

You could create a NpmTask and have your makeClients be finalizedBy that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants