@@ -36,14 +36,23 @@ file = loadPlugin(id: "org.savantbuild.plugin:file:${savantVersion}")
3636idea = loadPlugin(id: "org.savantbuild.plugin:idea:1.0.1")
3737release = loadPlugin(id: "org.savantbuild.plugin:release-git:${savantVersion}")
3838
39- target(name: "clean", description: "Cleans build directory") {
39+ target(name: "init", description: "Initializes the project") {
40+ def proc = 'npm install'.execute()
41+ proc.consumeProcessOutput(System.out, System.err)
42+ proc.waitFor()
43+ if (proc.exitValue() != 0) {
44+ fail("Failed to run npm install")
45+ }
46+ }
47+
48+ target(name: "clean", description: "Cleans build directory", dependsOn: ["init"]) {
4049 file.prune(dir: "build")
4150 file.delete {
4251 fileSet(dir: ".", includePatterns: [~/.+\.zip/])
4352 }
4453}
4554
46- target(name: "build ", description: "Builds the js files") {
55+ target(name: "compile ", description: "Builds the js files", dependsOn: ["init"] ) {
4756 def proc = 'npm ci'.execute()
4857 proc.consumeProcessOutput(System.out, System.err)
4958 proc.waitFor()
@@ -66,7 +75,7 @@ target(name: "build", description: "Builds the js files") {
6675 }
6776}
6877
69- target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["build "]) {
78+ target(name: "int", description: "Releases a local integration build of the project", dependsOn: ["compile "]) {
7079 file.delete {
7180 fileSet(dir: "build", includePatterns: [~/fusionauth-typescript-client.+\.zip/])
7281 }
@@ -84,7 +93,7 @@ target(name: "idea", description: "Updates the IntelliJ IDEA module file") {
8493 idea.iml()
8594}
8695
87- target(name: "test", description: "Runs the tests", dependsOn: ["build "]) {
96+ target(name: "test", description: "Runs the tests", dependsOn: ["compile "]) {
8897 if (new ProcessBuilder('npm', 'test').inheritIO().start().waitFor() != 0) {
8998 fail("Tests failed")
9099 }
0 commit comments