0

I currently have a Ratpack application which I am using to pass data via an API to a react app. I found an example online that first does a yarn install and then a yarn build, I now want it to do a yarn start whenever I run ./gradlew run so I don't have to start my Ratpack app and then go and seperately start the react application. Is this possible? Here is my current react gradle build script.

plugins {
    id "com.moowork.node" version "1.0.1"
}

apply plugin: "java"

buildDir = new File("gradleBuild")

sourceSets {
    main {
        resources {
            srcDir 'build'
        }
    }
}

task cleanNode() {
    delete 'build'
    delete 'node_modules'
}

processResources.dependsOn = ['yarn_build']
yarn_build.dependsOn = ['yarn_install']
clean.dependsOn("cleanNode"
N P
  • 2,319
  • 7
  • 32
  • 54
  • Looks like your example might be from [my boilerplate project](https://github.com/gschrader/ratpack-react-boilerplate). It seems the gradle-node-plugin isn't quite ready with yarn support. I can't even seem to do a `yarn_start` without an error currently. If it worked I think all that might be required would be a `run.dependsOn = [':react:yarn_start']` in the ratpack `build.gradle` file. – Glen Jan 30 '17 at 18:24
  • Thanks for the reply, I'll keep that in mind! And thanks for the boilerplate project, really helped – N P Feb 03 '17 at 15:15
  • How do you get your index.html into your templates directory? – N P Feb 09 '17 at 09:06

0 Answers0